Add Switch BackLight action

This commit is contained in:
Armel FAUVEAU
2024-03-11 02:48:21 +01:00
parent f31e8c319e
commit ad3b8b5b9a
13 changed files with 53 additions and 14 deletions

View File

@@ -38,7 +38,7 @@ ENABLE_COPY_CHAN_TO_VFO ?= 1
ENABLE_SPECTRUM ?= 1
ENABLE_REDUCE_LOW_MID_TX_POWER?= 0
ENABLE_BYP_RAW_DEMODULATORS ?= 0
ENABLE_BLMIN_TMP_OFF ?= 1
ENABLE_BLMIN_TMP_OFF ?= 0
ENABLE_SCAN_RANGES ?= 1
ENABLE_FEAT_F4HWN ?= 1

View File

@@ -105,6 +105,7 @@ void (*action_opt_table[])(void) = {
[ACTION_OPT_RXMODE] = &ACTION_RxMode,
[ACTION_OPT_PTT] = &ACTION_Ptt,
[ACTION_OPT_WN] = &ACTION_Wn,
[ACTION_OPT_BACKLIGHT] = &ACTION_BackLight,
#else
[ACTION_OPT_RXMODE] = &FUNCTION_NOP,
#endif
@@ -487,4 +488,18 @@ void ACTION_Wn(void)
BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false);
#endif
}
void ACTION_BackLight(void)
{
gBackLight = true;
if(gBacklightBrightnessOld == gEeprom.BACKLIGHT_MAX)
{
gEeprom.BACKLIGHT_TIME = 0;
}
else
{
gEeprom.BACKLIGHT_TIME = 7;
}
BACKLIGHT_TurnOn();
}
#endif

View File

@@ -39,6 +39,7 @@ void ACTION_SwitchDemodul(void);
void ACTION_RxMode(void);
void ACTION_Ptt(void);
void ACTION_Wn(void);
void ACTION_BackLight(void);
#endif
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);

View File

@@ -559,6 +559,9 @@ void MENU_AcceptSetting(void)
case MENU_ABR:
gEeprom.BACKLIGHT_TIME = gSubMenuSelection;
#ifdef ENABLE_FEAT_F4HWN
gBackLight = false;
#endif
break;
case MENU_ABR_MIN:

View File

@@ -58,12 +58,20 @@ const uint8_t gFontScanAll[10] =
0b00111110
};
/*
const uint8_t gFontF[1][7] =
const uint8_t gFontLight[11] =
{
{0x7f, 0x7f, 0x41, 0x75, 0x75, 0x7f, 0x7f},
0b00000000,
0b00011100,
0b00100010,
0b01000001,
0b01001101,
0b01110001,
0b01001101,
0b01000001,
0b00100010,
0b00011100,
0b00000000,
};
*/
const uint8_t gFontXB[2][6] =
{ // "XB"

View File

@@ -12,9 +12,8 @@ extern const uint8_t gFontPttClassic[2][6];
extern const uint8_t gFontFM[2][6];
extern const uint8_t gFontKeyLock[1][8];
extern const uint8_t gFontScanAll[10];
/*
extern const uint8_t gFontF[1][7];
*/
extern const uint8_t gFontLight[11];
extern const uint8_t gFontXB[2][6];
extern const uint8_t gFontMO[2][6];
extern const uint8_t gFontDWR[3][6];

View File

@@ -24,6 +24,7 @@
#ifdef ENABLE_FEAT_F4HWN
#include "driver/system.h"
#include "audio.h"
uint8_t gBacklightBrightnessOld = 0;
#endif
// this is decremented once every 500ms
@@ -59,6 +60,10 @@ void BACKLIGHT_InitHardware()
void BACKLIGHT_TurnOn(void)
{
#ifdef ENABLE_FEAT_F4HWN
gBacklightBrightnessOld = BACKLIGHT_GetBrightness();
#endif
if (gEeprom.BACKLIGHT_TIME == 0) {
BACKLIGHT_TurnOff();
return;

View File

@@ -38,4 +38,8 @@ bool BACKLIGHT_IsOn();
void BACKLIGHT_SetBrightness(uint8_t brigtness);
uint8_t BACKLIGHT_GetBrightness(void);
#ifdef ENABLE_FEAT_F4HWN
extern uint8_t gBacklightBrightnessOld;
#endif
#endif

2
misc.c
View File

@@ -276,7 +276,7 @@ uint8_t gIsLocked = 0xFF;
#ifdef ENABLE_FEAT_F4HWN
bool gPttOnePush = true;
bool gBackLight = false;
uint8_t gPttOnePushCounter = 0;
uint32_t gBlinkCounter = 0;
#endif

1
misc.h
View File

@@ -343,6 +343,7 @@ extern uint8_t gIsLocked;
extern volatile uint8_t boot_counter_10ms;
#ifdef ENABLE_FEAT_F4HWN
extern bool gBackLight;
extern uint8_t gPttOnePushCounter;
extern uint32_t gBlinkCounter;
#endif

View File

@@ -99,6 +99,7 @@ enum ACTION_OPT_t {
ACTION_OPT_RXMODE,
ACTION_OPT_PTT,
ACTION_OPT_WN,
ACTION_OPT_BACKLIGHT,
#endif
ACTION_OPT_LEN
};

View File

@@ -424,6 +424,7 @@ const t_sidefunction gSubMenu_SIDEFUNCTIONS[] =
{"SWITCH\nRX MODE", ACTION_OPT_RXMODE},
{"SWITCH\nPTT", ACTION_OPT_PTT},
{"SWITCH\nWIDE\nNARROW", ACTION_OPT_WN},
{"SWITCH\nBACKLIGHT", ACTION_OPT_BACKLIGHT},
#endif
};

View File

@@ -160,11 +160,6 @@ void UI_DisplayStatus()
x1 = x;
}
else if (gWasFKeyPressed) {
/*
memcpy(line + x, gFontF, sizeof(gFontF));
x += sizeof(gFontF);
*/
UI_PrintStringSmallBufferNormal("F", line + x + 1);
x += sizeof(gFontKeyLock);
@@ -174,6 +169,12 @@ void UI_DisplayStatus()
}
x1 = x;
}
else if(gBackLight)
{
memcpy(line + x + 1, gFontLight, sizeof(gFontLight));
x += sizeof(gFontLight);
x1 = x;
}
{ // battery voltage or percentage
char s[8] = "";