Made UI fsm skip low battery check when TX is enabled to avoid spurious triggers of low battery alert caused by the high current absorption from RF PA

This commit is contained in:
Silvano Seva 2021-02-24 21:00:30 +01:00
parent 6b24895ef3
commit 056c53b35d
2 changed files with 22 additions and 20 deletions

View File

@ -251,11 +251,6 @@ static void dev_task(void *arg)
(void) arg; (void) arg;
OS_ERR os_err; OS_ERR os_err;
// Initialise battery voltage, to avoid filter settling transient
OSMutexPend(&state_mutex, 0u, OS_OPT_PEND_BLOCKING, 0u, &os_err);
state.v_bat = platform_getVbat();
OSMutexPost(&state_mutex, OS_OPT_POST_NONE, &os_err);
while(1) while(1)
{ {
// Lock mutex and update internal state // Lock mutex and update internal state

View File

@ -703,12 +703,17 @@ void ui_updateFSM(event_t event, bool *sync_rtx)
platform_terminate(); platform_terminate();
return; return;
} }
// Check if battery has enough charge to operate
float charge = battery_getCharge(state.v_bat); // Check if battery has enough charge to operate.
if (!state.emergency && charge <= 0) // Check is skipped if there is an ongoing transmission, since the voltage
// drop caused by the RF PA power absorption causes spurious triggers of
// the low battery alert.
bool txOngoing = platform_getPttStatus();
if ((!state.emergency) && (!txOngoing) && (state.charge <= 0))
{ {
state.ui_screen = LOW_BAT; state.ui_screen = LOW_BAT;
if(event.type == EVENT_KBD && event.payload) { if(event.type == EVENT_KBD && event.payload)
{
state.ui_screen = MAIN_VFO; state.ui_screen = MAIN_VFO;
state.emergency = true; state.emergency = true;
} }
@ -726,7 +731,9 @@ void ui_updateFSM(event_t event, bool *sync_rtx)
macro_menu = true; macro_menu = true;
_ui_fsm_menuMacro(msg, sync_rtx); _ui_fsm_menuMacro(msg, sync_rtx);
return; return;
} else { }
else
{
macro_menu = false; macro_menu = false;
} }
switch(state.ui_screen) switch(state.ui_screen)