diff --git a/app/action.c b/app/action.c index 9fe229e..222fbcd 100644 --- a/app/action.c +++ b/app/action.c @@ -110,6 +110,9 @@ void (*action_opt_table[])(void) = { [ACTION_OPT_MAINONLY] = &ACTION_MainOnly, [ACTION_OPT_PTT] = &ACTION_Ptt, [ACTION_OPT_WN] = &ACTION_Wn, + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + [ACTION_OPT_POWER_HIGH] = &ACTION_Power_High, + #endif [ACTION_OPT_BACKLIGHT] = &ACTION_BackLight, #else [ACTION_OPT_RXMODE] = &FUNCTION_NOP, @@ -613,4 +616,22 @@ void ACTION_BackLightOnDemand(void) BACKLIGHT_TurnOn(); } + + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + void ACTION_Power_High(void) + { + if(gEeprom.MENU_LOCK == true) // RO is active + { + if (gTxVfo->OUTPUT_POWER == gInitialPower) + gTxVfo->OUTPUT_POWER = OUTPUT_POWER_HIGH; + else if(gTxVfo->OUTPUT_POWER == OUTPUT_POWER_HIGH) + gTxVfo->OUTPUT_POWER = gInitialPower; + } + else + { + if (++gTxVfo->OUTPUT_POWER > OUTPUT_POWER_HIGH) + gTxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW1; + } + } + #endif #endif \ No newline at end of file diff --git a/app/action.h b/app/action.h index 311d3b4..7131c17 100644 --- a/app/action.h +++ b/app/action.h @@ -42,6 +42,9 @@ void ACTION_SwitchDemodul(void); void ACTION_Wn(void); void ACTION_BackLightOnDemand(void); void ACTION_BackLight(void); + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + void ACTION_Power_High(void); + #endif #endif void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); diff --git a/misc.c b/misc.c index 40adb3b..615b573 100644 --- a/misc.c +++ b/misc.c @@ -137,6 +137,10 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; uint8_t crc[15] = { 0 }; uint8_t lErrorsDuringAirCopy = 0; uint8_t gAircopyStep = 0; + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + bool gResetPower = false; + uint8_t gInitialPower = 0; + #endif #endif #ifdef ENABLE_AUDIO_BAR diff --git a/misc.h b/misc.h index 9b05c2a..1a3dc05 100644 --- a/misc.h +++ b/misc.h @@ -190,6 +190,10 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; extern uint8_t crc[15]; extern uint8_t lErrorsDuringAirCopy; extern uint8_t gAircopyStep; + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + extern bool gResetPower; + extern uint8_t gInitialPower; + #endif #endif #ifdef ENABLE_AUDIO_BAR diff --git a/radio.c b/radio.c index 927a8f9..dd04934 100644 --- a/radio.c +++ b/radio.c @@ -159,6 +159,14 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure) { + + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + if(configure == VFO_CONFIGURE_RELOAD) + { + gResetPower = true; + } + #endif + VFO_Info_t *pVfo = &gEeprom.VfoInfo[VFO]; if (!gSetting_350EN) { @@ -428,6 +436,14 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure pVfo->Compander = att.compander; RADIO_ConfigureSquelchAndOutputPower(pVfo); + + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + if(gEeprom.MENU_LOCK && gResetPower) // RO is active + { + gInitialPower = pVfo->OUTPUT_POWER; + gResetPower = false; + } + #endif } void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) diff --git a/settings.h b/settings.h index e2859da..f930d8c 100644 --- a/settings.h +++ b/settings.h @@ -117,6 +117,9 @@ enum ACTION_OPT_t { ACTION_OPT_PTT, ACTION_OPT_WN, ACTION_OPT_BACKLIGHT, + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + ACTION_OPT_POWER_HIGH, + #endif #endif ACTION_OPT_LEN }; diff --git a/ui/menu.c b/ui/menu.c index f51dcb9..a9568a9 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -446,6 +446,9 @@ const t_sidefunction gSubMenu_SIDEFUNCTIONS[] = {"MAIN ONLY", ACTION_OPT_MAINONLY}, {"PTT", ACTION_OPT_PTT}, {"WIDE\nNARROW", ACTION_OPT_WN}, + #ifdef ENABLE_FEAT_F4HWN_MENU_LOCK + {"POWER\nHIGH", ACTION_OPT_POWER_HIGH}, + #endif #endif };