kopia lustrzana https://github.com/OpenRTX/OpenRTX
Add state_terminate() that saves settings to flash
rodzic
d4981ee288
commit
35bde9bccb
|
@ -121,6 +121,12 @@ extern state_t state;
|
|||
*/
|
||||
void state_init();
|
||||
|
||||
/**
|
||||
* This function terminates the Radio state,
|
||||
* Saving persistent settings to flash.
|
||||
*/
|
||||
void state_terminate();
|
||||
|
||||
/**
|
||||
* This function applies the selected timezone after reading the time from
|
||||
* the RTC.
|
||||
|
|
|
@ -90,6 +90,12 @@ void state_init()
|
|||
}
|
||||
}
|
||||
|
||||
void state_terminate()
|
||||
{
|
||||
// Write settings to flash memory
|
||||
nvm_writeSettings(&state.settings);
|
||||
}
|
||||
|
||||
void state_applyTimezone()
|
||||
{
|
||||
if(state.time.hour + state.settings.utc_timezone >= 24)
|
||||
|
|
|
@ -696,6 +696,13 @@ void ui_saveState()
|
|||
|
||||
void ui_updateFSM(event_t event, bool *sync_rtx)
|
||||
{
|
||||
// The volume knob has been set to OFF, shutdown the radio
|
||||
if(state.v_bat <= 0)
|
||||
{
|
||||
state_terminate();
|
||||
platform_terminate();
|
||||
return;
|
||||
}
|
||||
// Check if battery has enough charge to operate
|
||||
float charge = battery_getCharge(state.v_bat);
|
||||
if (!state.emergency && charge <= 0)
|
||||
|
|
Ładowanie…
Reference in New Issue