mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 05:53:34 +08:00
sensors: rc refactored min max ifs to constrain
This commit is contained in:
committed by
Lorenz Meier
parent
9527dd7714
commit
a14dbdcfdb
@@ -161,16 +161,7 @@ RCUpdate::get_rc_value(uint8_t func, float min_value, float max_value)
|
|||||||
{
|
{
|
||||||
if (_rc.function[func] >= 0) {
|
if (_rc.function[func] >= 0) {
|
||||||
float value = _rc.channels[_rc.function[func]];
|
float value = _rc.channels[_rc.function[func]];
|
||||||
|
return math::constrain(value, min_value, max_value);
|
||||||
if (value < min_value) {
|
|
||||||
return min_value;
|
|
||||||
|
|
||||||
} else if (value > max_value) {
|
|
||||||
return max_value;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|||||||
Reference in New Issue
Block a user