mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-11 02:18:29 -04:00
ACM: prevent link flood with "Low Battery" warnings
thanks to Marco for noticing this
This commit is contained in:
parent
9ef4595ad3
commit
af1573ad30
@ -59,7 +59,15 @@ static void failsafe_off_event()
|
||||
|
||||
static void low_battery_event(void)
|
||||
{
|
||||
gcs_send_text_P(SEVERITY_HIGH,PSTR("Low Battery!"));
|
||||
static uint32_t last_low_battery_message;
|
||||
uint32_t tnow = millis();
|
||||
if (((uint32_t)(tnow - last_low_battery_message)) > 5000) {
|
||||
// only send this message at 5s intervals at most or we may
|
||||
// flood the link
|
||||
gcs_send_text_P(SEVERITY_LOW,PSTR("Low Battery!"));
|
||||
last_low_battery_message = tnow;
|
||||
}
|
||||
|
||||
low_batt = true;
|
||||
|
||||
// if we are in Auto mode, come home
|
||||
|
Loading…
Reference in New Issue
Block a user