Browse Source

AP_ICEngine: sanity check param values

master
tom pittenger 6 years ago committed by Tom Pittenger
parent
commit
cd920c7609
  1. 9
      libraries/AP_ICEngine/AP_ICEngine.cpp

9
libraries/AP_ICEngine/AP_ICEngine.cpp

@ -217,7 +217,7 @@ void AP_ICEngine::update(void)
// reset initial height while disarmed // reset initial height while disarmed
initial_height = -pos.z; initial_height = -pos.z;
} }
} else if (idle_percent == 0) { // check if we should idle } else if (idle_percent <= 0) { // check if we should idle
// force ignition off when disarmed // force ignition off when disarmed
state = ICE_OFF; state = ICE_OFF;
} }
@ -265,8 +265,11 @@ bool AP_ICEngine::throttle_override(uint8_t &percentage)
return false; return false;
} }
uint8_t current_throttle = SRV_Channels::get_output_scaled(SRV_Channel::k_throttle); if (state == ICE_RUNNING &&
if (idle_percent > current_throttle && state == ICE_RUNNING) { idle_percent > 0 &&
idle_percent < 100 &&
(int16_t)idle_percent > SRV_Channels::get_output_scaled(SRV_Channel::k_throttle))
{
percentage = (uint8_t)idle_percent; percentage = (uint8_t)idle_percent;
return true; return true;
} }

Loading…
Cancel
Save