From f31e8c319e3997038351d6f1c23d261ea94ccf18 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sat, 9 Mar 2024 02:21:50 +0100 Subject: [PATCH 01/11] Fix display bug on ScanRange --- Makefile | 8 ++++++-- compile-with-docker.sh | 2 +- ui/main.c | 34 +++++++++++++++++++++------------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 7e81b13..33b5515 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,11 @@ ENABLE_LTO ?= 1 ############################################################# -TARGET = firmware +ifeq ($(ENABLE_FEAT_F4HWN),1) + TARGET = f4hwn +else + TARGET = firmware +endif ifeq ($(ENABLE_CLANG),1) # GCC's linker, ld, doesn't understand LLVM's generated bytecode @@ -206,7 +210,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1) VERSION_STRING_1 ?= v0.22 AUTHOR_STRING_2 ?= F4HWN - VERSION_STRING_2 ?= v2.2 + VERSION_STRING_2 ?= v2.3 AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2) VERSION_STRING ?= $(VERSION_STRING_2) diff --git a/compile-with-docker.sh b/compile-with-docker.sh index a51ddf8..f78f5ff 100755 --- a/compile-with-docker.sh +++ b/compile-with-docker.sh @@ -3,4 +3,4 @@ IMAGE_NAME="uvk5" docker build -t $IMAGE_NAME . -docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make && cp firmware* compiled-firmware/" \ No newline at end of file +docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make && cp f4hwn* compiled-firmware/" \ No newline at end of file diff --git a/ui/main.c b/ui/main.c index 84124df..38393d5 100644 --- a/ui/main.c +++ b/ui/main.c @@ -646,21 +646,29 @@ void UI_DisplayMain(void) if(gScanRangeStart) { #ifdef ENABLE_FEAT_F4HWN - uint8_t shift = 0; + //if(IS_FREQ_CHANNEL(gEeprom.ScreenChannel[0]) && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[1])) { + if(IS_FREQ_CHANNEL(gEeprom.ScreenChannel[activeTxVFO])) { - if (isMainOnly(false)) - { - shift = 3; + uint8_t shift = 0; + + if (isMainOnly(false)) + { + shift = 3; + } + + UI_PrintString("ScnRng", 5, 0, line + shift, 8); + sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000); + UI_PrintStringSmallNormal(String, 56, 0, line + shift); + sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000); + UI_PrintStringSmallNormal(String, 56, 0, line + shift + 1); + + if (!isMainOnly(false)) + continue; + } + else + { + gScanRangeStart = 0; } - - UI_PrintString("ScnRng", 5, 0, line + shift, 8); - sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000); - UI_PrintStringSmallNormal(String, 56, 0, line + shift); - sprintf(String, "%3u.%05u", gScanRangeStop / 100000, gScanRangeStop % 100000); - UI_PrintStringSmallNormal(String, 56, 0, line + shift + 1); - - if (!isMainOnly(false)) - continue; #else UI_PrintString("ScnRng", 5, 0, line, 8); sprintf(String, "%3u.%05u", gScanRangeStart / 100000, gScanRangeStart % 100000); From ad3b8b5b9af6929efe493e96a5744176fc8362cc Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 11 Mar 2024 02:48:21 +0100 Subject: [PATCH 02/11] Add Switch BackLight action --- Makefile | 2 +- app/action.c | 15 +++++++++++++++ app/action.h | 1 + app/menu.c | 3 +++ bitmaps.c | 16 ++++++++++++---- bitmaps.h | 5 ++--- driver/backlight.c | 5 +++++ driver/backlight.h | 4 ++++ misc.c | 2 +- misc.h | 1 + settings.h | 1 + ui/menu.c | 1 + ui/status.c | 11 ++++++----- 13 files changed, 53 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 33b5515..99e2310 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/app/action.c b/app/action.c index cf93bf9..6c3a7f4 100644 --- a/app/action.c +++ b/app/action.c @@ -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 \ No newline at end of file diff --git a/app/action.h b/app/action.h index 4dc7937..8aec306 100644 --- a/app/action.h +++ b/app/action.h @@ -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); diff --git a/app/menu.c b/app/menu.c index ab5ab3c..78ca0b3 100644 --- a/app/menu.c +++ b/app/menu.c @@ -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: diff --git a/bitmaps.c b/bitmaps.c index d6b3185..2adcfad 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -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" diff --git a/bitmaps.h b/bitmaps.h index 8db1421..ffca734 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -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]; diff --git a/driver/backlight.c b/driver/backlight.c index 8705a01..da1132e 100644 --- a/driver/backlight.c +++ b/driver/backlight.c @@ -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; diff --git a/driver/backlight.h b/driver/backlight.h index ae3b268..f0688a6 100644 --- a/driver/backlight.h +++ b/driver/backlight.h @@ -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 diff --git a/misc.c b/misc.c index 9d34549..2d84bd0 100644 --- a/misc.c +++ b/misc.c @@ -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 diff --git a/misc.h b/misc.h index 7ed63c6..ad05906 100644 --- a/misc.h +++ b/misc.h @@ -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 diff --git a/settings.h b/settings.h index d0d6b97..6ae4e87 100644 --- a/settings.h +++ b/settings.h @@ -99,6 +99,7 @@ enum ACTION_OPT_t { ACTION_OPT_RXMODE, ACTION_OPT_PTT, ACTION_OPT_WN, + ACTION_OPT_BACKLIGHT, #endif ACTION_OPT_LEN }; diff --git a/ui/menu.c b/ui/menu.c index 56d72a6..5efc378 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -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 }; diff --git a/ui/status.c b/ui/status.c index b267d37..6c4ea3f 100644 --- a/ui/status.c +++ b/ui/status.c @@ -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] = ""; From a9916e5128129baaf1a97312aa0612389a6202ba Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 11 Mar 2024 03:41:24 +0100 Subject: [PATCH 03/11] Change Bulb --- bitmaps.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bitmaps.c b/bitmaps.c index 2adcfad..3e730ec 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -61,15 +61,15 @@ const uint8_t gFontScanAll[10] = const uint8_t gFontLight[11] = { 0b00000000, - 0b00011100, - 0b00100010, - 0b01000001, - 0b01001101, - 0b01110001, - 0b01001101, - 0b01000001, - 0b00100010, - 0b00011100, + 0b00001100, + 0b00010010, + 0b00100001, + 0b01101101, + 0b01111001, + 0b01101101, + 0b00100001, + 0b00010010, + 0b00001100, 0b00000000, }; From 4b34313c20dcd251d0dd2b1eed79c69e32a4af24 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 11 Mar 2024 03:43:50 +0100 Subject: [PATCH 04/11] Change Bulb --- bitmaps.c | 3 +-- bitmaps.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bitmaps.c b/bitmaps.c index 3e730ec..13adc09 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -58,9 +58,8 @@ const uint8_t gFontScanAll[10] = 0b00111110 }; -const uint8_t gFontLight[11] = +const uint8_t gFontLight[10] = { - 0b00000000, 0b00001100, 0b00010010, 0b00100001, diff --git a/bitmaps.h b/bitmaps.h index ffca734..5a07e61 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -12,7 +12,7 @@ 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 gFontLight[11]; +extern const uint8_t gFontLight[10]; extern const uint8_t gFontXB[2][6]; extern const uint8_t gFontMO[2][6]; From 5200915c13976e0a87291a917cb44758c00ad1a4 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 12 Mar 2024 04:46:26 +0100 Subject: [PATCH 05/11] Revert BackLight Action and add 2 new buttons shortcuts --- app/action.c | 27 +++++++++++++++++++++++---- app/action.h | 1 + app/main.c | 11 +++++++++++ app/menu.c | 13 ++++++++++++- misc.c | 1 + misc.h | 1 + ui/menu.c | 1 - 7 files changed, 49 insertions(+), 6 deletions(-) diff --git a/app/action.c b/app/action.c index 6c3a7f4..d3ccb61 100644 --- a/app/action.c +++ b/app/action.c @@ -491,15 +491,34 @@ void ACTION_Wn(void) void ACTION_BackLight(void) { - gBackLight = true; - if(gBacklightBrightnessOld == gEeprom.BACKLIGHT_MAX) + if(gBackLight) { - gEeprom.BACKLIGHT_TIME = 0; + gEeprom.BACKLIGHT_TIME = gBacklightTimeOriginal; + } + gBackLight = false; + BACKLIGHT_TurnOn(); +} + +void ACTION_BackLightOnDemand(void) +{ + if(gBackLight == false) + { + gBacklightTimeOriginal = gEeprom.BACKLIGHT_TIME; + gEeprom.BACKLIGHT_TIME = 7; + gBackLight = true; } else { - gEeprom.BACKLIGHT_TIME = 7; + if(gBacklightBrightnessOld == gEeprom.BACKLIGHT_MAX) + { + gEeprom.BACKLIGHT_TIME = 0; + } + else + { + gEeprom.BACKLIGHT_TIME = 7; + } } + BACKLIGHT_TurnOn(); } #endif \ No newline at end of file diff --git a/app/action.h b/app/action.h index 8aec306..1d37084 100644 --- a/app/action.h +++ b/app/action.h @@ -39,6 +39,7 @@ void ACTION_SwitchDemodul(void); void ACTION_RxMode(void); void ACTION_Ptt(void); void ACTION_Wn(void); + void ACTION_BackLightOnDemand(void); void ACTION_BackLight(void); #endif diff --git a/app/main.c b/app/main.c index 7d44ed7..5dfe287 100644 --- a/app/main.c +++ b/app/main.c @@ -456,6 +456,17 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) gWasFKeyPressed = false; gUpdateStatus = true; + if(Key == 8) + { + ACTION_BackLightOnDemand(); + return; + } + else if(Key == 9) + { + ACTION_BackLight(); + return; + } + processFKeyFunction(Key, true); } diff --git a/app/menu.c b/app/menu.c index 78ca0b3..2af07ec 100644 --- a/app/menu.c +++ b/app/menu.c @@ -1010,7 +1010,18 @@ void MENU_ShowCurrentSetting(void) #endif case MENU_ABR: - gSubMenuSelection = gEeprom.BACKLIGHT_TIME; + #ifdef ENABLE_FEAT_F4HWN + if(gBackLight) + { + gSubMenuSelection = gBacklightTimeOriginal; + } + else + { + gSubMenuSelection = gEeprom.BACKLIGHT_TIME; + } + #else + gSubMenuSelection = gEeprom.BACKLIGHT_TIME; + #endif break; case MENU_ABR_MIN: diff --git a/misc.c b/misc.c index 2d84bd0..dffb91b 100644 --- a/misc.c +++ b/misc.c @@ -277,6 +277,7 @@ uint8_t gIsLocked = 0xFF; #ifdef ENABLE_FEAT_F4HWN bool gBackLight = false; + uint8_t gBacklightTimeOriginal; uint8_t gPttOnePushCounter = 0; uint32_t gBlinkCounter = 0; #endif diff --git a/misc.h b/misc.h index ad05906..f4a68fd 100644 --- a/misc.h +++ b/misc.h @@ -344,6 +344,7 @@ extern volatile uint8_t boot_counter_10ms; #ifdef ENABLE_FEAT_F4HWN extern bool gBackLight; + extern uint8_t gBacklightTimeOriginal; extern uint8_t gPttOnePushCounter; extern uint32_t gBlinkCounter; #endif diff --git a/ui/menu.c b/ui/menu.c index 5efc378..56d72a6 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -424,7 +424,6 @@ 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 }; From e4f26166fbf1723e82133321ded884f11b2e63d5 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 12 Mar 2024 04:55:13 +0100 Subject: [PATCH 06/11] Revert BackLight Action and add 2 new buttons shortcuts --- driver/backlight.c | 2 +- driver/backlight.h | 4 ---- misc.c | 1 + misc.h | 2 ++ 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/driver/backlight.c b/driver/backlight.c index da1132e..9eab0e9 100644 --- a/driver/backlight.c +++ b/driver/backlight.c @@ -24,7 +24,7 @@ #ifdef ENABLE_FEAT_F4HWN #include "driver/system.h" #include "audio.h" - uint8_t gBacklightBrightnessOld = 0; + #include "misc.h" #endif // this is decremented once every 500ms diff --git a/driver/backlight.h b/driver/backlight.h index f0688a6..ae3b268 100644 --- a/driver/backlight.h +++ b/driver/backlight.h @@ -38,8 +38,4 @@ bool BACKLIGHT_IsOn(); void BACKLIGHT_SetBrightness(uint8_t brigtness); uint8_t BACKLIGHT_GetBrightness(void); -#ifdef ENABLE_FEAT_F4HWN - extern uint8_t gBacklightBrightnessOld; -#endif - #endif diff --git a/misc.c b/misc.c index dffb91b..0e86853 100644 --- a/misc.c +++ b/misc.c @@ -278,6 +278,7 @@ uint8_t gIsLocked = 0xFF; #ifdef ENABLE_FEAT_F4HWN bool gBackLight = false; uint8_t gBacklightTimeOriginal; + uint8_t gBacklightBrightnessOld; uint8_t gPttOnePushCounter = 0; uint32_t gBlinkCounter = 0; #endif diff --git a/misc.h b/misc.h index f4a68fd..109a681 100644 --- a/misc.h +++ b/misc.h @@ -345,6 +345,8 @@ extern volatile uint8_t boot_counter_10ms; #ifdef ENABLE_FEAT_F4HWN extern bool gBackLight; extern uint8_t gBacklightTimeOriginal; + extern uint8_t gBacklightBrightnessOld; + extern uint8_t gPttOnePushCounter; extern uint32_t gBlinkCounter; #endif From fbbfbeb268ff00e59ae8ac6daddc56a7fdcc6698 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 12 Mar 2024 14:58:13 +0100 Subject: [PATCH 07/11] Revert BackLight Action and add 2 new buttons shortcuts --- driver/backlight.c | 16 ++++++++++++---- misc.c | 1 + misc.h | 2 +- settings.c | 15 ++++++++++++++- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/driver/backlight.c b/driver/backlight.c index 9eab0e9..bd92d9c 100644 --- a/driver/backlight.c +++ b/driver/backlight.c @@ -65,6 +65,16 @@ void BACKLIGHT_TurnOn(void) #endif if (gEeprom.BACKLIGHT_TIME == 0) { + #ifdef ENABLE_FEAT_F4HWN + if(gK5startup == true) { + if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_SOUND || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL) + { + AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); + AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); + } + } + gK5startup = false; + #endif BACKLIGHT_TurnOff(); return; } @@ -72,9 +82,7 @@ void BACKLIGHT_TurnOn(void) backlightOn = true; #ifdef ENABLE_FEAT_F4HWN - static bool k5Startup = true; - - if(k5Startup == true) { + if(gK5startup == true) { for(uint8_t i = 0; i <= gEeprom.BACKLIGHT_MAX; i++) { BACKLIGHT_SetBrightness(i); @@ -87,7 +95,7 @@ void BACKLIGHT_TurnOn(void) AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); } - k5Startup = false; + gK5startup = false; } else { diff --git a/misc.c b/misc.c index 0e86853..6640a34 100644 --- a/misc.c +++ b/misc.c @@ -276,6 +276,7 @@ uint8_t gIsLocked = 0xFF; #ifdef ENABLE_FEAT_F4HWN + bool gK5startup = true; bool gBackLight = false; uint8_t gBacklightTimeOriginal; uint8_t gBacklightBrightnessOld; diff --git a/misc.h b/misc.h index 109a681..fa22619 100644 --- a/misc.h +++ b/misc.h @@ -343,10 +343,10 @@ extern uint8_t gIsLocked; extern volatile uint8_t boot_counter_10ms; #ifdef ENABLE_FEAT_F4HWN + extern bool gK5startup; extern bool gBackLight; extern uint8_t gBacklightTimeOriginal; extern uint8_t gBacklightBrightnessOld; - extern uint8_t gPttOnePushCounter; extern uint32_t gBlinkCounter; #endif diff --git a/settings.c b/settings.c index 6dd46fb..2481cb5 100644 --- a/settings.c +++ b/settings.c @@ -528,7 +528,20 @@ void SETTINGS_SaveSettings(void) State[2] = gEeprom.CROSS_BAND_RX_TX; State[3] = gEeprom.BATTERY_SAVE; State[4] = gEeprom.DUAL_WATCH; - State[5] = gEeprom.BACKLIGHT_TIME; + + #ifdef ENABLE_FEAT_F4HWN + if(gBackLight) + { + State[5] = gBacklightTimeOriginal; + } + else + { + State[5] = gEeprom.BACKLIGHT_TIME; + } + #else + State[5] = gEeprom.BACKLIGHT_TIME; + #endif + State[6] = gEeprom.TAIL_TONE_ELIMINATION; State[7] = gEeprom.VFO_OPEN; EEPROM_WriteBuffer(0x0E78, State); From b2e3f70d4b5af893459aca98219a6f2a12942f2e Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 12 Mar 2024 22:37:42 +0100 Subject: [PATCH 08/11] Fix possible SQL issue --- app/main.c | 8 ++++++-- bitmaps.c | 6 ++---- bitmaps.h | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/main.c b/app/main.c index 5dfe287..8f9a9e1 100644 --- a/app/main.c +++ b/app/main.c @@ -161,15 +161,19 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) break; case KEY_2: + #ifdef ENABLE_FEAT_F4HWN + gVfoConfigureMode = VFO_CONFIGURE; + #endif COMMON_SwitchVFOs(); - if (beep) gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; break; case KEY_3: + #ifdef ENABLE_FEAT_F4HWN + gVfoConfigureMode = VFO_CONFIGURE; + #endif COMMON_SwitchVFOMode(); - if (beep) gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; diff --git a/bitmaps.c b/bitmaps.c index 13adc09..e9f9e17 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -44,9 +44,8 @@ const uint8_t gFontKeyLock[1][8] = {0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c} }; -const uint8_t gFontScanAll[10] = +const uint8_t gFontScanAll[9] = { - 0b00000000, 0b00111110, 0b01000001, 0b01000001, @@ -58,7 +57,7 @@ const uint8_t gFontScanAll[10] = 0b00111110 }; -const uint8_t gFontLight[10] = +const uint8_t gFontLight[9] = { 0b00001100, 0b00010010, @@ -69,7 +68,6 @@ const uint8_t gFontLight[10] = 0b00100001, 0b00010010, 0b00001100, - 0b00000000, }; const uint8_t gFontXB[2][6] = diff --git a/bitmaps.h b/bitmaps.h index 5a07e61..667823a 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -11,8 +11,8 @@ extern const uint8_t gFontPttOnePush[2][6]; 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 gFontLight[10]; +extern const uint8_t gFontScanAll[9]; +extern const uint8_t gFontLight[9]; extern const uint8_t gFontXB[2][6]; extern const uint8_t gFontMO[2][6]; From 3cada97405cfb3e0580df03092202d0b84a6b6a0 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Wed, 13 Mar 2024 19:03:45 +0100 Subject: [PATCH 09/11] Optimze CFLAGS --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 99e2310..412f224 100644 --- a/Makefile +++ b/Makefile @@ -239,7 +239,8 @@ endif CFLAGS = ifeq ($(ENABLE_CLANG),0) - CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c2x -MMD + CFLAGS += -Oz -Wall -Werror -mcpu=cortex-m0 -fshort-enums -fno-delete-null-pointer-checks -std=c2x -MMD + #CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c2x -MMD #CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD #CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD #CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD From 857dcec36d3f6186e21b654f0f19108f87b44482 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 14 Mar 2024 06:10:25 +0100 Subject: [PATCH 10/11] Add Last QRG --- driver/backlight.c | 35 +++++++++++++++-------------- ui/helper.c | 2 ++ ui/helper.h | 2 +- ui/main.c | 55 +++++++++++++++++++++++++++------------------- ui/menu.c | 7 +++++- ui/welcome.c | 11 ++++++---- 6 files changed, 67 insertions(+), 45 deletions(-) diff --git a/driver/backlight.c b/driver/backlight.c index bd92d9c..4b0cfde 100644 --- a/driver/backlight.c +++ b/driver/backlight.c @@ -58,6 +58,17 @@ void BACKLIGHT_InitHardware() 0; } +static void BACKLIGHT_Sound(void) +{ + if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_SOUND || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL) + { + AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); + AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); + gK5startup = false; + } +} + + void BACKLIGHT_TurnOn(void) { #ifdef ENABLE_FEAT_F4HWN @@ -65,17 +76,13 @@ void BACKLIGHT_TurnOn(void) #endif if (gEeprom.BACKLIGHT_TIME == 0) { - #ifdef ENABLE_FEAT_F4HWN - if(gK5startup == true) { - if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_SOUND || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL) - { - AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); - AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); - } - } - gK5startup = false; - #endif BACKLIGHT_TurnOff(); + #ifdef ENABLE_FEAT_F4HWN + if(gK5startup == true) + { + BACKLIGHT_Sound(); + } + #endif return; } @@ -89,13 +96,7 @@ void BACKLIGHT_TurnOn(void) SYSTEM_DelayMs(50); } - if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_SOUND || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_ALL) - { - AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); - AUDIO_PlayBeep(BEEP_880HZ_60MS_TRIPLE_BEEP); - } - - gK5startup = false; + BACKLIGHT_Sound(); } else { diff --git a/ui/helper.c b/ui/helper.c index 47b470b..e462970 100644 --- a/ui/helper.c +++ b/ui/helper.c @@ -199,6 +199,7 @@ static void sort(int16_t *a, int16_t *b) } #ifdef ENABLE_FEAT_F4HWN + /* void UI_DrawLineDottedBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black) { if(x2==x1) { @@ -218,6 +219,7 @@ static void sort(int16_t *a, int16_t *b) } } } + */ void PutPixel(uint8_t x, uint8_t y, bool fill) { UI_DrawPixelBuffer(gFrameBuffer, x, y, fill); diff --git a/ui/helper.h b/ui/helper.h index b90afc6..294c744 100644 --- a/ui/helper.h +++ b/ui/helper.h @@ -33,7 +33,7 @@ void UI_DisplayPopup(const char *string); void UI_DrawPixelBuffer(uint8_t (*buffer)[128], uint8_t x, uint8_t y, bool black); #ifdef ENABLE_FEAT_F4HWN - void UI_DrawLineDottedBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black); + //void UI_DrawLineDottedBuffer(uint8_t (*buffer)[128], int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool black); void PutPixel(uint8_t x, uint8_t y, bool fill); void PutPixelStatus(uint8_t x, uint8_t y, bool fill); void GUI_DisplaySmallest(const char *pString, uint8_t x, uint8_t y, bool statusbar, bool fill); diff --git a/ui/main.c b/ui/main.c index 38393d5..fd77268 100644 --- a/ui/main.c +++ b/ui/main.c @@ -45,10 +45,12 @@ center_line_t center_line = CENTER_LINE_NONE; #ifdef ENABLE_FEAT_F4HWN - static bool RxBlink; + static int8_t RxBlink; static int8_t RxBlinkLed = 0; static int8_t RxBlinkLedCounter; static int8_t RxLine; + static uint32_t RxOnVfofrequency; + bool isMainOnlyInputDTMF = false; static bool isMainOnly(bool checkGui) @@ -264,6 +266,7 @@ void DisplayRSSIBar(const bool now) const unsigned int bar_x = 2 + txt_width + 4; // X coord of bar graph #ifdef ENABLE_FEAT_F4HWN + /* const char empty[] = { 0b00000000, 0b00000000, @@ -273,6 +276,7 @@ void DisplayRSSIBar(const bool now) 0b00000000, 0b00000000, }; + */ unsigned int line; if (isMainOnly(false)) @@ -284,28 +288,29 @@ void DisplayRSSIBar(const bool now) line = 3; } - char rx[4]; + //char rx[4]; //sprintf(String, "%d", RxBlink); //UI_PrintStringSmallBold(String, 80, 0, RxLine); if(RxLine >= 0 && center_line != CENTER_LINE_IN_USE) { - if(RxBlink == true) + switch(RxBlink) { - sprintf(rx, "%s", "RX"); - //UI_PrintStringSmallBold("RX", 14, 0, RxLine); - RxBlink = false; + case 0: + UI_PrintStringSmallBold("RX", 14, 0, RxLine); + break; + case 1: + UI_PrintStringSmallBold("RX", 14, 0, RxLine); + RxBlink = 2; + break; + case 2: + for (uint8_t i = 14; i < 30; i++) + { + gFrameBuffer[RxLine][i] = 0x00; + } + RxBlink = 1; + break; } - else - { - sprintf(rx, "%s", " "); - memcpy(gFrameBuffer[RxLine] + 14, &empty, ARRAY_SIZE(empty)); - memcpy(gFrameBuffer[RxLine] + 21, &empty, ARRAY_SIZE(empty)); - - //UI_PrintStringSmallBold(" ", 14, 0, RxLine); - RxBlink = true; - } - UI_PrintStringSmallBold(rx, 14, 0, RxLine); ST7565_BlitLine(RxLine); } #else @@ -753,6 +758,8 @@ void UI_DisplayMain(void) memcpy(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault)); } + uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency; + if (gCurrentFunction == FUNCTION_TRANSMIT) { // transmitting @@ -776,14 +783,15 @@ void UI_DisplayMain(void) #ifdef ENABLE_FEAT_F4HWN RxBlinkLed = 1; RxBlinkLedCounter = 0; + RxLine = line; + RxOnVfofrequency = frequency; if(!isMainVFO) { - RxLine = line; + RxBlink = 1; } else { - RxLine = -1; - UI_PrintStringSmallBold("RX", 14, 0, line); + RxBlink = 0; } #else UI_PrintStringSmallBold("RX", 14, 0, line); @@ -792,6 +800,12 @@ void UI_DisplayMain(void) #ifdef ENABLE_FEAT_F4HWN else { + if(RxOnVfofrequency == frequency && !isMainOnly(false)) + { + UI_PrintStringSmallNormal(">>", 14, 0, line); + //memcpy(p_line0 + 14, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); + } + if(RxBlinkLed == 1) RxBlinkLed = 2; } @@ -841,9 +855,6 @@ void UI_DisplayMain(void) state = VFO_STATE_ALARM; } #endif - - uint32_t frequency = gEeprom.VfoInfo[vfo_num].pRX->Frequency; - if (state != VFO_STATE_NORMAL) { if (state < ARRAY_SIZE(VfoStateStr)) diff --git a/ui/menu.c b/ui/menu.c index 56d72a6..102f2e8 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -469,7 +469,12 @@ void UI_DisplayMenu(void) #ifdef ENABLE_FEAT_F4HWN UI_DrawLineBuffer(gFrameBuffer, 50, 0, 50, 55, 1); // Be ware, status zone = 8 lines, the rest = 56 ->total 64 - UI_DrawLineDottedBuffer(gFrameBuffer, 0, 46, 50, 46, 1); + //UI_DrawLineDottedBuffer(gFrameBuffer, 0, 46, 50, 46, 1); + + for (uint8_t i = 0; i < 50; i += 2) + { + gFrameBuffer[5][i] = 0x40; + } #endif #ifndef ENABLE_CUSTOM_MENU_LAYOUT diff --git a/ui/welcome.c b/ui/welcome.c index c6fd7f6..93f694b 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -55,8 +55,8 @@ void UI_DisplayWelcome(void) UI_DisplayClear(); #ifdef ENABLE_FEAT_F4HWN - ST7565_BlitStatusLine(); // blank status line - ST7565_BlitFullScreen(); + //ST7565_BlitStatusLine(); // blank status line + //ST7565_BlitFullScreen(); if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_NONE || gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_SOUND) { ST7565_FillScreen(0x00); @@ -105,13 +105,16 @@ void UI_DisplayWelcome(void) #ifdef ENABLE_FEAT_F4HWN UI_PrintStringSmallNormal(Version, 0, 128, 4); + for (uint8_t i = 0; i < 128; i++) + { + gFrameBuffer[3][i] ^= 0x80; + } + for (uint8_t i = 18; i < 110; i++) { gFrameBuffer[4][i] ^= 0xFF; } - UI_DrawLineBuffer(gFrameBuffer, 0, 31, 126, 31, 1); - UI_PrintStringSmallNormal(Based, 0, 127, 5); UI_PrintStringSmallNormal(Credits, 0, 127, 6); #else From ab7c1cb9d2d44e5ecf52463cf9f1395b676cfc88 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 14 Mar 2024 18:46:47 +0100 Subject: [PATCH 11/11] Update README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 46b9851..8e826c6 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier, Fr * Step value, * CTCSS or DCS value, * KeyLock message, + * last RX, * and more... * new menu entries: * add SetLow menu to set low power (<20mW, 125mW, 250mW, 500mW and 1W), @@ -71,6 +72,8 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier, Fr * new key combinations: * add the F + UP or F + DOWN key combination to dynamically change the Squelch level, * add the F + F1 or F + F2 key combination to dynamically change the Step, + * add F+8 to quickly switch backlight between BLMin and BLMax on demand (this bypass BackLt strategy), + * add F+9 to return to BackLt strategy. * many fix: * squelch, * s-meter, @@ -79,7 +82,6 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier, Fr * scan range limit, * and more... * enabled ENABLE_CTCSS_TAIL_PHASE_SHIFT, -* enabled ENABLE_BLMIN_TMP_OFF, * disabled ENABLE_DTMF_CALLING, * disabled SCRAMBLER, * unlock TX on all bands needs only to be repeat 3 times,