Skip to content

Commit

Permalink
Refactor alarm code
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
JuantAldea authored and egzumer committed Dec 6, 2023
1 parent 103bdf2 commit cd032c3
Show file tree
Hide file tree
Showing 7 changed files with 271 additions and 286 deletions.
41 changes: 22 additions & 19 deletions app/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,28 +243,31 @@ void ACTION_Scan(bool bRestart)
#endif

#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
static void ACTION_AlarmOr1750(const bool b1750)
{
(void)b1750;
gInputBoxIndex = 0;

#if defined(ENABLE_ALARM) && defined(ENABLE_TX1750)
gAlarmState = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM;
gAlarmRunningCounter = 0;
#elif defined(ENABLE_ALARM)
gAlarmState = ALARM_STATE_TXALARM;
gAlarmRunningCounter = 0;
#else
gAlarmState = ALARM_STATE_TX1750;
#endif
static void ACTION_AlarmOr1750(const bool b1750)
{

gFlagPrepareTX = true;
#if defined(ENABLE_ALARM)
const AlarmState_t alarm_mode = (gEeprom.ALARM_MODE == ALARM_MODE_TONE) ? ALARM_STATE_TXALARM : ALARM_STATE_SITE_ALARM;
gAlarmRunningCounter = 0;
#endif

if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN;
}
#endif
#if defined(ENABLE_ALARM) && defined(ENABLE_TX1750)
gAlarmState = b1750 ? ALARM_STATE_TX1750 : alarm_mode;
#elif defined(ENABLE_ALARM)
gAlarmState = alarm_mode;
#else
gAlarmState = ALARM_STATE_TX1750;
#endif

(void)b1750;
gInputBoxIndex = 0;

gFlagPrepareTX = gAlarmState != ALARM_STATE_OFF;

if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
gRequestDisplayScreen = DISPLAY_MAIN;
}
#endif

#ifdef ENABLE_FMRADIO
void ACTION_FM(void)
Expand Down
Loading

0 comments on commit cd032c3

Please sign in to comment.