mirror of https://github.com/ArduPilot/ardupilot
Plane: wrap Watt Limiiter in #if AP_BATTERY_WATT_MAX_ENABLED
This commit is contained in:
parent
496125a8cb
commit
b468af81ac
|
@ -586,10 +586,12 @@ private:
|
|||
// this controls throttle suppression in auto modes
|
||||
bool throttle_suppressed;
|
||||
|
||||
#if AP_BATTERY_WATT_MAX_ENABLED
|
||||
// reduce throttle to eliminate battery over-current
|
||||
int8_t throttle_watt_limit_max;
|
||||
int8_t throttle_watt_limit_min; // for reverse thrust
|
||||
uint32_t throttle_watt_limit_timer_ms;
|
||||
#endif
|
||||
|
||||
AP_FixedWing::FlightStage flight_stage = AP_FixedWing::FlightStage::NORMAL;
|
||||
|
||||
|
|
|
@ -422,6 +422,7 @@ void Plane::throttle_voltage_comp(int8_t &min_throttle, int8_t &max_throttle) co
|
|||
/*
|
||||
calculate any throttle limits based on the watt limiter
|
||||
*/
|
||||
#if AP_BATTERY_WATT_MAX_ENABLED
|
||||
void Plane::throttle_watt_limiter(int8_t &min_throttle, int8_t &max_throttle)
|
||||
{
|
||||
uint32_t now = millis();
|
||||
|
@ -466,6 +467,7 @@ void Plane::throttle_watt_limiter(int8_t &min_throttle, int8_t &max_throttle)
|
|||
min_throttle = constrain_int16(min_throttle, min_throttle + throttle_watt_limit_min, 0);
|
||||
}
|
||||
}
|
||||
#endif // #if AP_BATTERY_WATT_MAX_ENABLED
|
||||
|
||||
/*
|
||||
setup output channels all non-manual modes
|
||||
|
@ -509,8 +511,10 @@ void Plane::set_servos_controlled(void)
|
|||
// compensate for battery voltage drop
|
||||
throttle_voltage_comp(min_throttle, max_throttle);
|
||||
|
||||
#if AP_BATTERY_WATT_MAX_ENABLED
|
||||
// apply watt limiter
|
||||
throttle_watt_limiter(min_throttle, max_throttle);
|
||||
#endif
|
||||
|
||||
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle,
|
||||
constrain_float(SRV_Channels::get_output_scaled(SRV_Channel::k_throttle), min_throttle, max_throttle));
|
||||
|
|
Loading…
Reference in New Issue