mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-17 17:47: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) {
|
||||
float value = _rc.channels[_rc.function[func]];
|
||||
|
||||
if (value < min_value) {
|
||||
return min_value;
|
||||
|
||||
} else if (value > max_value) {
|
||||
return max_value;
|
||||
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return math::constrain(value, min_value, max_value);
|
||||
|
||||
} else {
|
||||
return 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user