There was quite convoluted logic there, and what I believe, was a bug.
Rationale:
Both,
- gBatterySaveCountdown_10ms = battery_save_count_10ms;, and
- gSchedulePowerSave = false
are always executed inside FUNCTION_Select().
So the code is equivalent to:
if (any of those OR'd) {
gBatterySaveCountdown_10ms = battery_save_count_10ms;
gSchedulePowerSave = false; (but only if we have NOAA disabled)
} else {
[other stuff from FUNCTION_Select()]
gBatterySaveCountdown_10ms = battery_save_count_10ms;
gSchedulePowerSave = false; (regarless of having NOAA or not)
}
So:
- OR is true, have NOAA-> don't clear gSchedulePowerSave
-> implies we will enter here, again, until the OR is false, but only if we have NOAA.
- OR is False -> clear gSchedulePowerSave.
Moreover, checking with DualTachyon code at
https://github.com/DualTachyon/uv-k5-firmware/blob/6f8afac8864e0349ecf8b10f91ce8f69273013db/app/app.c#L747
gSchedulePowerSave is always set to false if it was true.
Backlight is set to FULL when interacting with backlight menu entries,
but it is not set back to MAX when exiting from those entries. This
commit corrects that behaviour.
This was formely tested all over using testing for the state of
gSerialConfigCountDown_500ms in a couple of ways. This logic have been
extracted into a function to make the code more readable.
Also testing it with > 0 was a bit misleading as the variable is
unsigned so tesing with == and != is enough.
- Fixes Alarms bypassing TX restrictions
- Adds enumerations
- Makes use of mode ALARM_STATE_SITE_ALARM (formely ALARM_STATE_ALARM) instead
checking against ALARM_STATE_TXALARM && ALARM_MODE == ALARM_MODE_TONE
all over the place