Add SetOff menu (experimental)
This commit is contained in:
4
Makefile
4
Makefile
@@ -45,6 +45,7 @@ ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0
|
|||||||
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
|
ENABLE_FEAT_F4HWN_SPECTRUM ?= 1
|
||||||
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1
|
ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1
|
||||||
ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
|
ENABLE_FEAT_F4HWN_CHARGING_C ?= 1
|
||||||
|
ENABLE_FEAT_F4HWN_SLEEP ?= 1
|
||||||
ENABLE_FEAT_F4HWN_PMR ?= 0
|
ENABLE_FEAT_F4HWN_PMR ?= 0
|
||||||
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0
|
ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0
|
||||||
ENABLE_FEAT_F4HWN_CA ?= 1
|
ENABLE_FEAT_F4HWN_CA ?= 1
|
||||||
@@ -418,6 +419,9 @@ endif
|
|||||||
ifeq ($(ENABLE_FEAT_F4HWN_CHARGING_C),1)
|
ifeq ($(ENABLE_FEAT_F4HWN_CHARGING_C),1)
|
||||||
CFLAGS += -DENABLE_FEAT_F4HWN_CHARGING_C
|
CFLAGS += -DENABLE_FEAT_F4HWN_CHARGING_C
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_FEAT_F4HWN_SLEEP),1)
|
||||||
|
CFLAGS += -DENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_FEAT_F4HWN_PMR),1)
|
ifeq ($(ENABLE_FEAT_F4HWN_PMR),1)
|
||||||
CFLAGS += -DENABLE_FEAT_F4HWN_PMR
|
CFLAGS += -DENABLE_FEAT_F4HWN_PMR
|
||||||
endif
|
endif
|
||||||
|
25
app/app.c
25
app/app.c
@@ -1567,6 +1567,31 @@ void APP_TimeSlice500ms(void)
|
|||||||
BACKLIGHT_TurnOff();
|
BACKLIGHT_TurnOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
if (gSleepModeCountdown_500ms == gSetting_set_off * 120 && gWakeUp) {
|
||||||
|
ST7565_Init();
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||||
|
gWakeUp = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gSleepModeCountdown_500ms > 0 && --gSleepModeCountdown_500ms == 0) {
|
||||||
|
gBacklightCountdown_500ms = 0;
|
||||||
|
BACKLIGHT_TurnOff();
|
||||||
|
ST7565_ShutDown();
|
||||||
|
gWakeUp = true;
|
||||||
|
gPowerSaveCountdownExpired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gWakeUp) {
|
||||||
|
static bool swap = true;
|
||||||
|
swap = !swap; // Alterne l'état à chaque exécution
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, swap);
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, swap);
|
||||||
|
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (gReducedService)
|
if (gReducedService)
|
||||||
{
|
{
|
||||||
BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent);
|
BOARD_ADC_GetBatteryInfo(&gBatteryCurrentVoltage, &gBatteryCurrent);
|
||||||
|
18
app/menu.c
18
app/menu.c
@@ -376,6 +376,12 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = gSubMenu_SIDEFUNCTIONS_size-1;
|
*pMax = gSubMenu_SIDEFUNCTIONS_size-1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
case MENU_SET_OFF:
|
||||||
|
*pMax = 120;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case MENU_SET_PWR:
|
case MENU_SET_PWR:
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_SET_PWR) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_SET_PWR) - 1;
|
||||||
@@ -868,6 +874,12 @@ void MENU_AcceptSetting(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
case MENU_SET_OFF:
|
||||||
|
gSetting_set_off = gSubMenuSelection;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case MENU_SET_PWR:
|
case MENU_SET_PWR:
|
||||||
gSetting_set_pwr = gSubMenuSelection;
|
gSetting_set_pwr = gSubMenuSelection;
|
||||||
@@ -1294,6 +1306,12 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
case MENU_SET_OFF:
|
||||||
|
gSubMenuSelection = gSetting_set_off;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case MENU_SET_PWR:
|
case MENU_SET_PWR:
|
||||||
gSubMenuSelection = gSetting_set_pwr;
|
gSubMenuSelection = gSetting_set_pwr;
|
||||||
|
@@ -31,6 +31,10 @@
|
|||||||
uint16_t gBacklightCountdown_500ms = 0;
|
uint16_t gBacklightCountdown_500ms = 0;
|
||||||
bool backlightOn;
|
bool backlightOn;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
uint16_t gSleepModeCountdown_500ms = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
void BACKLIGHT_InitHardware()
|
void BACKLIGHT_InitHardware()
|
||||||
{
|
{
|
||||||
// 48MHz / 94 / 1024 ~ 500Hz
|
// 48MHz / 94 / 1024 ~ 500Hz
|
||||||
@@ -117,6 +121,10 @@ void BACKLIGHT_TurnOn(void)
|
|||||||
gBacklightCountdown_500ms = 0;
|
gBacklightCountdown_500ms = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
gSleepModeCountdown_500ms = gSetting_set_off * 120;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void BACKLIGHT_TurnOff()
|
void BACKLIGHT_TurnOff()
|
||||||
|
@@ -23,6 +23,10 @@
|
|||||||
extern uint16_t gBacklightCountdown_500ms;
|
extern uint16_t gBacklightCountdown_500ms;
|
||||||
extern uint8_t gBacklightBrightness;
|
extern uint8_t gBacklightBrightness;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
extern uint16_t gSleepModeCountdown_500ms;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_BLMIN_TMP_OFF
|
#ifdef ENABLE_BLMIN_TMP_OFF
|
||||||
typedef enum {
|
typedef enum {
|
||||||
BLMIN_STAT_ON,
|
BLMIN_STAT_ON,
|
||||||
|
@@ -256,6 +256,17 @@ void ST7565_Init(void)
|
|||||||
ST7565_FillScreen(0x00);
|
ST7565_FillScreen(0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
void ST7565_ShutDown(void)
|
||||||
|
{
|
||||||
|
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||||
|
ST7565_WriteByte(ST7565_CMD_POWER_CIRCUIT | 0b000); // VB=0 VR=1 VF=1
|
||||||
|
ST7565_WriteByte(ST7565_CMD_SET_START_LINE | 0); // line 0
|
||||||
|
ST7565_WriteByte(ST7565_CMD_DISPLAY_ON_OFF | 0); // D=1
|
||||||
|
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void ST7565_FixInterfGlitch(void)
|
void ST7565_FixInterfGlitch(void)
|
||||||
{
|
{
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||||
|
@@ -33,6 +33,9 @@ void ST7565_BlitLine(unsigned line);
|
|||||||
void ST7565_BlitStatusLine(void);
|
void ST7565_BlitStatusLine(void);
|
||||||
void ST7565_FillScreen(uint8_t Value);
|
void ST7565_FillScreen(uint8_t Value);
|
||||||
void ST7565_Init(void);
|
void ST7565_Init(void);
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
void ST7565_ShutDown(void);
|
||||||
|
#endif
|
||||||
void ST7565_FixInterfGlitch(void);
|
void ST7565_FixInterfGlitch(void);
|
||||||
void ST7565_HardwareReset(void);
|
void ST7565_HardwareReset(void);
|
||||||
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);
|
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);
|
||||||
|
4
main.c
4
main.c
@@ -130,9 +130,13 @@ void Main(void)
|
|||||||
SETTINGS_SaveSettings();
|
SETTINGS_SaveSettings();
|
||||||
#ifndef ENABLE_VOX
|
#ifndef ENABLE_VOX
|
||||||
gMenuCursor = 64; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
|
gMenuCursor = 64; // move to hidden section, fix me if change... !!! Remove VOX and Mic Bar
|
||||||
|
#else
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
gMenuCursor = 67; // move to hidden section, fix me if change... !!!
|
||||||
#else
|
#else
|
||||||
gMenuCursor = 66; // move to hidden section, fix me if change... !!!
|
gMenuCursor = 66; // move to hidden section, fix me if change... !!!
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
gSubMenuSelection = gSetting_F_LOCK;
|
gSubMenuSelection = gSetting_F_LOCK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
5
misc.c
5
misc.c
@@ -104,6 +104,11 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
bool gSetting_AM_fix = true;
|
bool gSetting_AM_fix = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
uint8_t gSetting_set_off = 1;
|
||||||
|
bool gWakeUp = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
uint8_t gSetting_set_pwr = 1;
|
uint8_t gSetting_set_pwr = 1;
|
||||||
bool gSetting_set_ptt = 0;
|
bool gSetting_set_ptt = 0;
|
||||||
|
5
misc.h
5
misc.h
@@ -156,6 +156,11 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx;
|
|||||||
extern bool gSetting_AM_fix;
|
extern bool gSetting_AM_fix;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
extern uint8_t gSetting_set_off;
|
||||||
|
extern bool gWakeUp;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
extern uint8_t gSetting_set_pwr;
|
extern uint8_t gSetting_set_pwr;
|
||||||
extern bool gSetting_set_ptt;
|
extern bool gSetting_set_ptt;
|
||||||
|
@@ -346,7 +346,10 @@ void SETTINGS_InitEEPROM(void)
|
|||||||
int ctr_value = Data[5] & 0x0F;
|
int ctr_value = Data[5] & 0x0F;
|
||||||
gSetting_set_ctr = (ctr_value > 0 && ctr_value < 16) ? ctr_value : 10;
|
gSetting_set_ctr = (ctr_value > 0 && ctr_value < 16) ? ctr_value : 10;
|
||||||
|
|
||||||
gSetting_set_tmr = Data[4] & 1;
|
gSetting_set_tmr = Data[4] & 0x01;
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
gSetting_set_off = Data[4] >> 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Warning
|
// Warning
|
||||||
// Be aware, Data[3] is use by Spectrum
|
// Be aware, Data[3] is use by Spectrum
|
||||||
@@ -740,7 +743,11 @@ void SETTINGS_SaveSettings(void)
|
|||||||
tmp = tmp | (1 << 3);
|
tmp = tmp | (1 << 3);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
State[4] = (gSetting_set_off << 1) | (gSetting_set_tmr & 0x01);
|
||||||
|
#else
|
||||||
State[4] = gSetting_set_tmr ? (1 << 0) : 0;
|
State[4] = gSetting_set_tmr ? (1 << 0) : 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
tmp = (gSetting_set_inv << 0) |
|
tmp = (gSetting_set_inv << 0) |
|
||||||
(gSetting_set_lck << 1) |
|
(gSetting_set_lck << 1) |
|
||||||
|
16
ui/menu.c
16
ui/menu.c
@@ -147,6 +147,9 @@ const t_menu_item MenuList[] =
|
|||||||
{"SetMet", MENU_SET_MET },
|
{"SetMet", MENU_SET_MET },
|
||||||
{"SetGui", MENU_SET_GUI },
|
{"SetGui", MENU_SET_GUI },
|
||||||
{"SetTmr", MENU_SET_TMR },
|
{"SetTmr", MENU_SET_TMR },
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
{"SetOff", MENU_SET_OFF },
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
// hidden menu items from here on
|
// hidden menu items from here on
|
||||||
// enabled if pressing both the PTT and upper side button at power-on
|
// enabled if pressing both the PTT and upper side button at power-on
|
||||||
@@ -978,6 +981,19 @@ void UI_DisplayMenu(void)
|
|||||||
strcpy(String, gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].name);
|
strcpy(String, gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
case MENU_SET_OFF:
|
||||||
|
if(gSubMenuSelection == 0)
|
||||||
|
{
|
||||||
|
sprintf(String, "%s", "OFF");
|
||||||
|
}
|
||||||
|
else if(gSubMenuSelection < 121)
|
||||||
|
{
|
||||||
|
sprintf(String, "%02dh:%02dm", (gSubMenuSelection / 60), (gSubMenuSelection % 60));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
case MENU_SET_PWR:
|
case MENU_SET_PWR:
|
||||||
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection + 1], gSubMenu_SET_PWR[gSubMenuSelection]);
|
sprintf(String, "%s\n%sW", gSubMenu_TXP[gSubMenuSelection + 1], gSubMenu_SET_PWR[gSubMenuSelection]);
|
||||||
|
@@ -125,6 +125,9 @@ enum
|
|||||||
#ifdef ENABLE_F_CAL_MENU
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
MENU_F_CALI, // reference xtal calibration
|
MENU_F_CALI, // reference xtal calibration
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||||
|
MENU_SET_OFF,
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_FEAT_F4HWN
|
#ifdef ENABLE_FEAT_F4HWN
|
||||||
MENU_SET_PWR,
|
MENU_SET_PWR,
|
||||||
MENU_SET_PTT,
|
MENU_SET_PTT,
|
||||||
|
Reference in New Issue
Block a user