Refactoring

This commit is contained in:
Krzysiek Egzmont
2023-10-22 02:12:07 +02:00
parent a8ae1b7739
commit ffb26a1f86
5 changed files with 17 additions and 10 deletions

View File

@@ -412,9 +412,9 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
ACTION_Scan(true);
break;
case ACTION_OPT_VOX:
#ifdef ENABLE_VOX
ACTION_Vox();
#endif
#ifdef ENABLE_VOX
ACTION_Vox();
#endif
break;
case ACTION_OPT_ALARM:
#ifdef ENABLE_ALARM

View File

@@ -485,7 +485,7 @@ void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix)
gEnableSpeaker = true;
if (gSetting_backlight_on_tx_rx >= 2)
if (gSetting_backlight_on_tx_rx >= BACKLIGHT_ON_TR_RX)
BACKLIGHT_TurnOn();
if (gScanStateDir != SCAN_OFF)
@@ -1963,7 +1963,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (gEeprom.AUTO_KEYPAD_LOCK)
gKeyLockCountdown = 30; // 15 seconds
if (!bKeyPressed)
if (!bKeyPressed) // key released
{
if (gFlagSaveVfo)
{
@@ -1996,9 +1996,10 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
GUI_SelectNextDisplay(DISPLAY_MAIN);
}
}
else
else // key pressed or held
{
if (Key != KEY_PTT || gSetting_backlight_on_tx_rx == 1 || gSetting_backlight_on_tx_rx == 3)
if (Key != KEY_PTT || gSetting_backlight_on_tx_rx == BACKLIGHT_ON_TR_TX
|| gSetting_backlight_on_tx_rx == BACKLIGHT_ON_TR_TXRX)
BACKLIGHT_TurnOn();
if (Key == KEY_EXIT && bKeyHeld)

View File

@@ -237,7 +237,8 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
else
BK4819_DisableScramble();
if (gSetting_backlight_on_tx_rx == 1 || gSetting_backlight_on_tx_rx == 3)
if (gSetting_backlight_on_tx_rx == BACKLIGHT_ON_TR_TX ||
gSetting_backlight_on_tx_rx == BACKLIGHT_ON_TR_TXRX)
BACKLIGHT_TurnOn();
break;

1
misc.c
View File

@@ -122,7 +122,6 @@ volatile bool gSchedulePowerSave;
volatile bool gScheduleDualWatch = true;
volatile uint16_t gDualWatchCountdown_10ms;
volatile bool gDualWatchCountdownExpired = true;
bool gDualWatchActive = false;
volatile uint8_t gSerialConfigCountDown_500ms;

8
misc.h
View File

@@ -94,6 +94,13 @@ enum scan_next_chan_t {
};
typedef enum scan_next_chan_t scan_next_chan_t;
enum BacklightOnRxTx_t {
BACKLIGHT_ON_TR_OFF,
BACKLIGHT_ON_TR_TX,
BACKLIGHT_ON_TR_RX,
BACKLIGHT_ON_TR_TXRX
};
extern const uint8_t fm_radio_countdown_500ms;
extern const uint16_t fm_play_countdown_scan_10ms;
extern const uint16_t fm_play_countdown_noscan_10ms;
@@ -199,7 +206,6 @@ extern volatile bool gSchedulePowerSave;
extern volatile bool gScheduleDualWatch;
extern volatile uint16_t gDualWatchCountdown_10ms;
extern volatile bool gDualWatchCountdownExpired;
extern bool gDualWatchActive;
extern volatile uint8_t gSerialConfigCountDown_500ms;