From 64502bbbc540140acf77e1eacbe509fdd41d3353 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Wed, 20 Mar 2024 04:16:31 +0100 Subject: [PATCH 01/16] Save 48 octets (thank you Joc) --- app/menu.c | 80 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/app/menu.c b/app/menu.c index 2af07ec..a5aef0f 100644 --- a/app/menu.c +++ b/app/menu.c @@ -113,25 +113,27 @@ void MENU_StopCssScan(void) int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) { + *pMin = 0; + switch (menu_id) { case MENU_SQL: - *pMin = 0; + //*pMin = 0; *pMax = 9; break; case MENU_STEP: - *pMin = 0; + //*pMin = 0; *pMax = STEP_N_ELEM - 1; break; case MENU_ABR: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1; break; case MENU_ABR_MIN: - *pMin = 0; + //*pMin = 0; *pMax = 9; break; @@ -141,85 +143,85 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) break; case MENU_F_LOCK: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_F_LOCK) - 1; break; case MENU_MDF: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_MDF) - 1; break; case MENU_TXP: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_TXP) - 1; break; case MENU_SFT_D: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_SFT_D) - 1; break; case MENU_TDR: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_RXMode) - 1; break; #ifdef ENABLE_VOICE case MENU_VOICE: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_VOICE) - 1; break; #endif case MENU_SC_REV: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_SC_REV) - 1; break; case MENU_ROGER: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_ROGER) - 1; break; case MENU_PONMSG: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_PONMSG) - 1; break; case MENU_R_DCS: case MENU_T_DCS: - *pMin = 0; + //*pMin = 0; *pMax = 208; //*pMax = (ARRAY_SIZE(DCS_Options) * 2); break; case MENU_R_CTCS: case MENU_T_CTCS: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(CTCSS_Options); break; case MENU_W_N: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_W_N) - 1; break; #ifdef ENABLE_ALARM case MENU_AL_MOD: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_AL_MOD) - 1; break; #endif case MENU_RESET: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_RESET) - 1; break; case MENU_COMPAND: case MENU_ABR_ON_TX_RX: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_RX_TX) - 1; break; @@ -250,23 +252,23 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) #ifndef ENABLE_FEAT_F4HWN case MENU_SCREN: #endif - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1; break; case MENU_AM: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gModulationStr) - 1; break; #ifndef ENABLE_FEAT_F4HWN case MENU_SCR: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_SCRAMBLER) - 1; break; #endif case MENU_TOT: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_TOT) - 1; break; @@ -274,7 +276,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_VOX: #endif case MENU_RP_STE: - *pMin = 0; + //*pMin = 0; *pMax = 10; break; @@ -282,7 +284,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_1_CALL: case MENU_DEL_CH: case MENU_MEM_NAME: - *pMin = 0; + //*pMin = 0; *pMax = MR_CHANNEL_LAST; break; @@ -293,33 +295,33 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) break; case MENU_SAVE: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_SAVE) - 1; break; case MENU_MIC: - *pMin = 0; + //*pMin = 0; *pMax = 4; break; case MENU_S_LIST: - *pMin = 0; + //*pMin = 0; *pMax = 2; break; #ifdef ENABLE_DTMF_CALLING case MENU_D_RSP: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_D_RSP) - 1; break; #endif case MENU_PTT_ID: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1; break; case MENU_BAT_TXT: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1; break; @@ -353,7 +355,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) break; case MENU_BATTYP: - *pMin = 0; + //*pMin = 0; *pMax = 1; break; @@ -362,22 +364,22 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_F2SHRT: case MENU_F2LONG: case MENU_MLONG: - *pMin = 0; + //*pMin = 0; *pMax = gSubMenu_SIDEFUNCTIONS_size-1; break; #ifdef ENABLE_FEAT_F4HWN case MENU_SET_LOW: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_SET_LOW) - 1; break; case MENU_SET_PTT: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_SET_PTT) - 1; break; case MENU_SET_TOT: case MENU_SET_EOT: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_SET_TOT) - 1; break; case MENU_SET_CTR: @@ -385,16 +387,16 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) *pMax = 15; break; case MENU_SET_INV: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_OFF_ON) - 1; break; case MENU_SET_LCK: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_SET_LCK) - 1; break; case MENU_SET_MET: case MENU_SET_GUI: - *pMin = 0; + //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_SET_MET) - 1; break; #endif From b9ecbc48e46b0c4e7d01bf4419d37dcfd45f3211 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Wed, 20 Mar 2024 16:13:54 +0100 Subject: [PATCH 02/16] Update Donors --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 33398e4..99eb25f 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Anyway, have fun. # Donations -Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO and Stéphane F5LGW for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻 +Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW and Jorge Ornelas for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻 ## Table of Contents From 7ed9889ef4ae52f753be9394dca44b0678c0c919 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 21 Mar 2024 03:16:34 +0100 Subject: [PATCH 03/16] Remove blink and SOS --- Makefile | 2 +- app/app.c | 6 ++- app/flashlight.c | 109 +++++++++++++++++++++++++++-------------------- app/flashlight.h | 20 +++++---- 4 files changed, 79 insertions(+), 58 deletions(-) diff --git a/Makefile b/Makefile index 412f224..efbd2b4 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1) VERSION_STRING_1 ?= v0.22 AUTHOR_STRING_2 ?= F4HWN - VERSION_STRING_2 ?= v2.3 + VERSION_STRING_2 ?= v2.4 AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2) VERSION_STRING ?= $(VERSION_STRING_2) diff --git a/app/app.c b/app/app.c index c49c475..26dcac1 100644 --- a/app/app.c +++ b/app/app.c @@ -1303,8 +1303,10 @@ void APP_TimeSlice10ms(void) return; #endif -#ifdef ENABLE_FLASHLIGHT - FlashlightTimeSlice(); +#ifndef ENABLE_FEAT_F4HWN + #ifdef ENABLE_FLASHLIGHT + FlashlightTimeSlice(); + #endif #endif #ifdef ENABLE_VOX diff --git a/app/flashlight.c b/app/flashlight.c index 32c6c1a..9cb94b9 100644 --- a/app/flashlight.c +++ b/app/flashlight.c @@ -5,62 +5,79 @@ #include "flashlight.h" -enum FlashlightMode_t gFlashLightState; +#ifndef ENABLE_FEAT_F4HWN + enum FlashlightMode_t gFlashLightState; -void FlashlightTimeSlice() -{ - if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0) { - GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); - return; - } - - if (gFlashLightState == FLASHLIGHT_SOS) { - const uint16_t u = 15; - static uint8_t c; - static uint16_t next; - - if (gFlashLightBlinkCounter - next > 7 * u) { - c = 0; - next = gFlashLightBlinkCounter + 1; + void FlashlightTimeSlice() + { + if (gFlashLightState == FLASHLIGHT_BLINK && (gFlashLightBlinkCounter & 15u) == 0) { + GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); return; } - if (gFlashLightBlinkCounter == next) { - if (c==0) { - GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); - } else { - GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); + if (gFlashLightState == FLASHLIGHT_SOS) { + const uint16_t u = 15; + static uint8_t c; + static uint16_t next; + + if (gFlashLightBlinkCounter - next > 7 * u) { + c = 0; + next = gFlashLightBlinkCounter + 1; + return; } - if (c >= 18) { - next = gFlashLightBlinkCounter + 7 * u; - c = 0; - } else if(c==7 || c==9 || c==11) { - next = gFlashLightBlinkCounter + 3 * u; - } else { - next = gFlashLightBlinkCounter + u; + if (gFlashLightBlinkCounter == next) { + if (c==0) { + GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); + } else { + GPIO_FlipBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); + } + + if (c >= 18) { + next = gFlashLightBlinkCounter + 7 * u; + c = 0; + } else if(c==7 || c==9 || c==11) { + next = gFlashLightBlinkCounter + 3 * u; + } else { + next = gFlashLightBlinkCounter + u; + } + c++; } - c++; } } -} -void ACTION_FlashLight(void) -{ - switch (gFlashLightState) { - case FLASHLIGHT_OFF: - gFlashLightState++; - GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); - break; - case FLASHLIGHT_ON: - case FLASHLIGHT_BLINK: - gFlashLightState++; - break; - case FLASHLIGHT_SOS: - default: - gFlashLightState = 0; - GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); + void ACTION_FlashLight(void) + { + switch (gFlashLightState) { + case FLASHLIGHT_OFF: + gFlashLightState++; + GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); + break; + case FLASHLIGHT_ON: + case FLASHLIGHT_BLINK: + gFlashLightState++; + break; + case FLASHLIGHT_SOS: + default: + gFlashLightState = 0; + GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); + } } -} +#else + void ACTION_FlashLight(void) + { + static bool gFlashLightState = false; + if(gFlashLightState) + { + GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); + } + else + { + GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT); + } + + gFlashLightState = (gFlashLightState) ? false : true; + } +#endif #endif diff --git a/app/flashlight.h b/app/flashlight.h index 61ada50..9c0a7c4 100644 --- a/app/flashlight.h +++ b/app/flashlight.h @@ -5,17 +5,19 @@ #include -enum FlashlightMode_t { - FLASHLIGHT_OFF = 0, - FLASHLIGHT_ON, - FLASHLIGHT_BLINK, - FLASHLIGHT_SOS -}; +#ifndef ENABLE_FEAT_F4HWN + enum FlashlightMode_t { + FLASHLIGHT_OFF = 0, + FLASHLIGHT_ON, + FLASHLIGHT_BLINK, + FLASHLIGHT_SOS + }; -extern enum FlashlightMode_t gFlashLightState; -extern volatile uint16_t gFlashLightBlinkCounter; + extern enum FlashlightMode_t gFlashLightState; + extern volatile uint16_t gFlashLightBlinkCounter; -void FlashlightTimeSlice(void); + void FlashlightTimeSlice(void); +#endif void ACTION_FlashLight(void); #endif From 582d54f5adc5c62a13a80fd4bece8f458b11f4c5 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 21 Mar 2024 03:20:58 +0100 Subject: [PATCH 04/16] Clean screen on startup --- ui/welcome.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/welcome.c b/ui/welcome.c index 9d04b05..6b1357f 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -55,9 +55,9 @@ void UI_DisplayWelcome(void) UI_DisplayClear(); #ifdef ENABLE_FEAT_F4HWN - //ST7565_BlitStatusLine(); // Uncoment me if more memory free - //ST7565_BlitFullScreen(); // Uncoment me if more memory free - + ST7565_BlitStatusLine(); + 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); #else From e9c2a2ed2ae9eeddc3cbfa8fe93d0df58b958de3 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sat, 23 Mar 2024 02:16:40 +0100 Subject: [PATCH 05/16] Remove fucking ENABLE_CTCSS_TAIL_PHASE_SHIFT --- Makefile | 2 +- app/app.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index efbd2b4..fea9d9d 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ ENABLE_KEEP_MEM_NAME ?= 1 ENABLE_WIDE_RX ?= 1 ENABLE_TX_WHEN_AM ?= 0 ENABLE_F_CAL_MENU ?= 0 -ENABLE_CTCSS_TAIL_PHASE_SHIFT ?= 1 +ENABLE_CTCSS_TAIL_PHASE_SHIFT ?= 0 ENABLE_BOOT_BEEPS ?= 0 ENABLE_SHOW_CHARGE_LEVEL ?= 0 ENABLE_REVERSE_BAT_SYMBOL ?= 0 diff --git a/app/app.c b/app/app.c index 26dcac1..f438d83 100644 --- a/app/app.c +++ b/app/app.c @@ -356,7 +356,7 @@ static void HandleReceive(void) Mode == END_OF_RX_MODE_SKIP && gNextTimeslice40ms && gEeprom.TAIL_TONE_ELIMINATION && - (gCurrentCodeType == CODE_TYPE_DIGITAL || gCurrentCodeType == CODE_TYPE_REVERSE_DIGITAL) && + (gCurrentCodeType == CODE_TYPE_DIGITAL || gCurrentCodeType == CODE_TYPE_REVERSE_DIGITAL) && BK4819_GetCTCType() == 1) Mode = END_OF_RX_MODE_TTE; else @@ -399,8 +399,7 @@ Skip: break; case END_OF_RX_MODE_TTE: - if (gEeprom.TAIL_TONE_ELIMINATION) - { + if (gEeprom.TAIL_TONE_ELIMINATION) { AUDIO_AudioPathOff(); gTailNoteEliminationCountdown_10ms = 20; From caaef912c4e1723617d0980b4e3568dc13012b2a Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sat, 23 Mar 2024 02:17:09 +0100 Subject: [PATCH 06/16] Remove fucking ENABLE_CTCSS_TAIL_PHASE_SHIFT --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 99eb25f..5e9d5aa 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,6 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * scan list 2 ignored, * scan range limit, * and more... -* enabled ENABLE_CTCSS_TAIL_PHASE_SHIFT, * disabled ENABLE_DTMF_CALLING, * disabled SCRAMBLER, * unlock TX on all bands needs only to be repeat 3 times, From d95491b73d1bc9c2798cfc410592eaa40afae5c2 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Sat, 23 Mar 2024 02:33:43 +0100 Subject: [PATCH 07/16] Clean code --- app/main.c | 4 +--- app/menu.c | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/main.c b/app/main.c index 8f9a9e1..b4301ae 100644 --- a/app/main.c +++ b/app/main.c @@ -43,7 +43,7 @@ #include "ui/ui.h" #include -void toggle_chan_scanlist(void) +static void toggle_chan_scanlist(void) { // toggle the selected channels scanlist setting if (SCANNER_IsScanning()) @@ -258,13 +258,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) case KEY_UP: gEeprom.SQUELCH_LEVEL = (gEeprom.SQUELCH_LEVEL < 9) ? gEeprom.SQUELCH_LEVEL + 1: 9; gVfoConfigureMode = VFO_CONFIGURE; - //gRequestDisplayScreen = DISPLAY_MAIN; gWasFKeyPressed = false; break; case KEY_DOWN: gEeprom.SQUELCH_LEVEL = (gEeprom.SQUELCH_LEVEL > 0) ? gEeprom.SQUELCH_LEVEL - 1: 0; gVfoConfigureMode = VFO_CONFIGURE; - //gRequestDisplayScreen = DISPLAY_MAIN; gWasFKeyPressed = false; break; diff --git a/app/menu.c b/app/menu.c index a5aef0f..c1f0641 100644 --- a/app/menu.c +++ b/app/menu.c @@ -436,7 +436,6 @@ void MENU_AcceptSetting(void) if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) { gRequestSaveChannel = 1; - return; } return; From 8ec757dbfedbb07c4aa5c1a2a2f250ba2fb30a83 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 25 Mar 2024 01:28:49 +0100 Subject: [PATCH 08/16] Add debug helper in status --- misc.c | 1 + misc.h | 2 ++ radio.c | 24 +++++++++++++++++----- ui/status.c | 58 ++++++++++++++++++++++++++++++++++------------------- 4 files changed, 59 insertions(+), 26 deletions(-) diff --git a/misc.c b/misc.c index 6640a34..c6fc797 100644 --- a/misc.c +++ b/misc.c @@ -115,6 +115,7 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; bool gSetting_set_met = 0; bool gSetting_set_gui = 0; bool gSetting_set_ptt_session; + uint8_t gDebug; #endif #ifdef ENABLE_AUDIO_BAR diff --git a/misc.h b/misc.h index fa22619..f3828d7 100644 --- a/misc.h +++ b/misc.h @@ -349,6 +349,8 @@ extern volatile uint8_t boot_counter_10ms; extern uint8_t gBacklightBrightnessOld; extern uint8_t gPttOnePushCounter; extern uint32_t gBlinkCounter; + extern uint8_t gDebug; + #endif int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit); diff --git a/radio.c b/radio.c index 4d363eb..7174e6f 100644 --- a/radio.c +++ b/radio.c @@ -474,24 +474,38 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) #ifdef ENABLE_FEAT_F4HWN // make low and mid even lower + + uint8_t shift[] = {0, 0, 0, 0, 0}; + + /* + if(Band == 5) + { + shift[0] = 3; + shift[1] = 3; + shift[2] = 4; + shift[3] = 7; + shift[4] = 8; + } + */ + if (pInfo->OUTPUT_POWER == OUTPUT_POWER_LOW) { for(uint8_t p = 0; p < 3; p++ ) { switch (gSetting_set_low) { case 0: - Txp[p] = (Txp[p] * 4) / 25; + Txp[p] = (Txp[p] * 4) / 25 - shift[gSetting_set_low]; break; case 1: - Txp[p] = (Txp[p] * 4) / 19; + Txp[p] = (Txp[p] * 4) / 19 + shift[gSetting_set_low]; break; case 2: - Txp[p] = (Txp[p] * 4) / 13; + Txp[p] = (Txp[p] * 4) / 13 + shift[gSetting_set_low]; break; case 3: - Txp[p] = (Txp[p] * 4) / 10; + Txp[p] = (Txp[p] * 4) / 10 + shift[gSetting_set_low]; break; case 4: - Txp[p] = (Txp[p] * 4) / 7; + Txp[p] = (Txp[p] * 4) / 7 + shift[gSetting_set_low]; break; } diff --git a/ui/status.c b/ui/status.c index 6c4ea3f..10f6d4f 100644 --- a/ui/status.c +++ b/ui/status.c @@ -101,32 +101,48 @@ void UI_DisplayStatus() } x += 10; // font character width -#ifdef ENABLE_VOICE - // VOICE indicator - if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF){ - memcpy(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt)); - x1 = x + sizeof(BITMAP_VoicePrompt); + // Only for debug + // Only for debug + // Only for debug + + bool debug = false; + if(debug) + { + char sDebug[8] = ""; + sprintf(sDebug, "%d", gDebug); + UI_PrintStringSmallBufferNormal(sDebug, line + x + 1); + x += 16; } - x += sizeof(BITMAP_VoicePrompt); -#endif + else + { - if(!SCANNER_IsScanning()) { - uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; - if(dw == 1 || dw == 3) { // DWR - dual watch + respond - if(gDualWatchActive) - memcpy(line + x + (dw==1?0:2), gFontDWR, sizeof(gFontDWR) - (dw==1?0:5)); + #ifdef ENABLE_VOICE + // VOICE indicator + if (gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF){ + memcpy(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt)); + x1 = x + sizeof(BITMAP_VoicePrompt); + } + x += sizeof(BITMAP_VoicePrompt); + #endif + + if(!SCANNER_IsScanning()) { + uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2; + if(dw == 1 || dw == 3) { // DWR - dual watch + respond + if(gDualWatchActive) + memcpy(line + x + (dw==1?0:2), gFontDWR, sizeof(gFontDWR) - (dw==1?0:5)); + else + memcpy(line + x + 3, gFontHold, sizeof(gFontHold)); + } + else if(dw == 2) { // XB - crossband + memcpy(line + x + 2, gFontXB, sizeof(gFontXB)); + } else - memcpy(line + x + 3, gFontHold, sizeof(gFontHold)); - } - else if(dw == 2) { // XB - crossband - memcpy(line + x + 2, gFontXB, sizeof(gFontXB)); - } - else - { - memcpy(line + x + 2, gFontMO, sizeof(gFontMO)); + { + memcpy(line + x + 2, gFontMO, sizeof(gFontMO)); + } } + x += sizeof(gFontDWR) + 3; } - x += sizeof(gFontDWR) + 3; #ifdef ENABLE_VOX // VOX indicator From 25ced9401ed963831ac9fac39d6503e311df303e Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 26 Mar 2024 00:34:04 +0100 Subject: [PATCH 09/16] Add exclude memory channel --- app/chFrScanner.c | 16 +++++++++++++++- app/chFrScanner.h | 5 +++++ app/main.c | 24 ++++++++++++++++++++++++ app/scanner.c | 12 +----------- misc.c | 1 + misc.h | 2 +- settings.c | 8 ++++++++ 7 files changed, 55 insertions(+), 13 deletions(-) diff --git a/app/chFrScanner.c b/app/chFrScanner.c index 4d7f844..6aba97c 100644 --- a/app/chFrScanner.c +++ b/app/chFrScanner.c @@ -25,7 +25,13 @@ typedef enum { scan_next_chan_t currentScanList; uint32_t initialFrqOrChan; uint8_t initialCROSS_BAND_RX_TX; -uint32_t lastFoundFrqOrChan; + +#ifndef ENABLE_FEAT_F4HWN + uint32_t lastFoundFrqOrChan; +#else + uint32_t lastFoundFrqOrChan; + uint32_t lastFoundFrqOrChanOld; +#endif static void NextFreqChannel(void); static void NextMemChannel(void); @@ -61,6 +67,10 @@ void CHFRSCANNER_Start(const bool storeBackupSettings, const int8_t scan_directi NextFreqChannel(); } +#ifdef ENABLE_FEAT_F4HWN + lastFoundFrqOrChanOld = lastFoundFrqOrChan; +#endif + gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms; gScheduleScanListen = false; gRxReceptionMode = RX_MODE_NONE; @@ -109,6 +119,10 @@ void CHFRSCANNER_Found(void) break; } +#ifdef ENABLE_FEAT_F4HWN + lastFoundFrqOrChanOld = lastFoundFrqOrChan; +#endif + if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE)) { //memory scan lastFoundFrqOrChan = gRxVfo->CHANNEL_SAVE; } diff --git a/app/chFrScanner.h b/app/chFrScanner.h index 4038461..484b726 100644 --- a/app/chFrScanner.h +++ b/app/chFrScanner.h @@ -20,4 +20,9 @@ void CHFRSCANNER_Stop(void); void CHFRSCANNER_Start(const bool storeBackupSettings, const int8_t scan_direction); void CHFRSCANNER_ContinueScanning(void); +#ifdef ENABLE_FEAT_F4HWN + extern uint32_t lastFoundFrqOrChan; + extern uint32_t lastFoundFrqOrChanOld; +#endif + #endif \ No newline at end of file diff --git a/app/main.c b/app/main.c index b4301ae..e7d84e1 100644 --- a/app/main.c +++ b/app/main.c @@ -540,6 +540,30 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; if (bKeyHeld) { // menu key held down (long press) + + #ifdef ENABLE_FEAT_F4HWN + if(gScanStateDir != SCAN_OFF) + { + gTxVfo->SCANLIST1_PARTICIPATION = 0; + gTxVfo->SCANLIST2_PARTICIPATION = 0; + + gWriteChannel = false; + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); + gWriteChannel = true; + + gVfoConfigureMode = VFO_CONFIGURE; + gFlagResetVfos = true; + + //gDebug = (uint8_t)lastFoundFrqOrChanOld; + + lastFoundFrqOrChan = lastFoundFrqOrChanOld; + + CHFRSCANNER_ContinueScanning(); + + return; + } + #endif + if (bKeyPressed) { // long press MENU key gWasFKeyPressed = false; diff --git a/app/scanner.c b/app/scanner.c index 1bd0d55..6ef6108 100644 --- a/app/scanner.c +++ b/app/scanner.c @@ -41,7 +41,6 @@ bool gScanUseCssResult; STEP_Setting_t stepSetting; uint8_t scanHitCount; - static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { if (!bKeyHeld && bKeyPressed) @@ -259,16 +258,7 @@ static void SCANNER_Key_UP_DOWN(bool bKeyPressed, bool pKeyHeld, int8_t Directio void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { switch (Key) { - case KEY_0: - case KEY_1: - case KEY_2: - case KEY_3: - case KEY_4: - case KEY_5: - case KEY_6: - case KEY_7: - case KEY_8: - case KEY_9: + case KEY_0...KEY_9: SCANNER_Key_DIGITS(Key, bKeyPressed, bKeyHeld); break; case KEY_MENU: diff --git a/misc.c b/misc.c index c6fc797..42e904e 100644 --- a/misc.c +++ b/misc.c @@ -116,6 +116,7 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; bool gSetting_set_gui = 0; bool gSetting_set_ptt_session; uint8_t gDebug; + bool gWriteChannel = true; #endif #ifdef ENABLE_AUDIO_BAR diff --git a/misc.h b/misc.h index f3828d7..28595b4 100644 --- a/misc.h +++ b/misc.h @@ -350,7 +350,7 @@ extern volatile uint8_t boot_counter_10ms; extern uint8_t gPttOnePushCounter; extern uint32_t gBlinkCounter; extern uint8_t gDebug; - + extern bool gWriteChannel; #endif int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit); diff --git a/settings.c b/settings.c index 2481cb5..04301b3 100644 --- a/settings.c +++ b/settings.c @@ -776,7 +776,15 @@ void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep) } state[channel & 7u] = att.__val; + +#ifdef ENABLE_FEAT_F4HWN + if(gWriteChannel) + { + EEPROM_WriteBuffer(offset, state); + } +#else EEPROM_WriteBuffer(offset, state); +#endif gMR_ChannelAttributes[channel] = att; From 259cf446bfcc40831701ceb56d9f48ba8a0ba599 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 26 Mar 2024 04:45:00 +0100 Subject: [PATCH 10/16] Add exclude memory channel --- app/main.c | 6 ++---- app/menu.c | 8 ++++---- misc.c | 1 - misc.h | 1 - settings.c | 6 +++--- settings.h | 2 +- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/main.c b/app/main.c index e7d84e1..fc07cb5 100644 --- a/app/main.c +++ b/app/main.c @@ -65,7 +65,7 @@ static void toggle_chan_scanlist(void) gTxVfo->SCANLIST1_PARTICIPATION = !gTxVfo->SCANLIST1_PARTICIPATION; } - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, false); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; @@ -547,9 +547,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) gTxVfo->SCANLIST1_PARTICIPATION = 0; gTxVfo->SCANLIST2_PARTICIPATION = 0; - gWriteChannel = false; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); - gWriteChannel = true; + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; diff --git a/app/menu.c b/app/menu.c index c1f0641..4c45a18 100644 --- a/app/menu.c +++ b/app/menu.c @@ -616,14 +616,14 @@ void MENU_AcceptSetting(void) case MENU_S_ADD1: gTxVfo->SCANLIST1_PARTICIPATION = gSubMenuSelection; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; return; case MENU_S_ADD2: gTxVfo->SCANLIST2_PARTICIPATION = gSubMenuSelection; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; return; @@ -650,7 +650,7 @@ void MENU_AcceptSetting(void) case MENU_COMPAND: gTxVfo->Compander = gSubMenuSelection; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; // gRequestSaveChannel = 1; @@ -756,7 +756,7 @@ void MENU_AcceptSetting(void) #endif case MENU_DEL_CH: - SETTINGS_UpdateChannel(gSubMenuSelection, NULL, false); + SETTINGS_UpdateChannel(gSubMenuSelection, NULL, false, true); gVfoConfigureMode = VFO_CONFIGURE_RELOAD; gFlagResetVfos = true; return; diff --git a/misc.c b/misc.c index 42e904e..c6fc797 100644 --- a/misc.c +++ b/misc.c @@ -116,7 +116,6 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; bool gSetting_set_gui = 0; bool gSetting_set_ptt_session; uint8_t gDebug; - bool gWriteChannel = true; #endif #ifdef ENABLE_AUDIO_BAR diff --git a/misc.h b/misc.h index 28595b4..2d72357 100644 --- a/misc.h +++ b/misc.h @@ -350,7 +350,6 @@ extern volatile uint8_t boot_counter_10ms; extern uint8_t gPttOnePushCounter; extern uint32_t gBlinkCounter; extern uint8_t gDebug; - extern bool gWriteChannel; #endif int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit); diff --git a/settings.c b/settings.c index 04301b3..b0fa696 100644 --- a/settings.c +++ b/settings.c @@ -714,7 +714,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, #endif EEPROM_WriteBuffer(OffsetVFO + 8, State._8); - SETTINGS_UpdateChannel(Channel, pVFO, true); + SETTINGS_UpdateChannel(Channel, pVFO, true, true); if (IS_MR_CHANNEL(Channel)) { #ifndef ENABLE_KEEP_MEM_NAME @@ -749,7 +749,7 @@ void SETTINGS_SaveChannelName(uint8_t channel, const char * name) EEPROM_WriteBuffer(0x0F58 + offset, buf + 8); } -void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep) +void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool save) { #ifdef ENABLE_NOAA if (!IS_NOAA_CHANNEL(channel)) @@ -778,7 +778,7 @@ void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep) state[channel & 7u] = att.__val; #ifdef ENABLE_FEAT_F4HWN - if(gWriteChannel) + if(save) { EEPROM_WriteBuffer(offset, state); } diff --git a/settings.h b/settings.h index 6ae4e87..447c9eb 100644 --- a/settings.h +++ b/settings.h @@ -282,7 +282,7 @@ void SETTINGS_SaveSettings(void); void SETTINGS_SaveChannelName(uint8_t channel, const char * name); void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode); void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration); -void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep); +void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool save); void SETTINGS_WriteBuildOptions(void); #endif From b1db4a633ccddb82fdb41548392c7a3ec24c6feb Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 26 Mar 2024 13:42:51 +0100 Subject: [PATCH 11/16] Add exclude memory channel --- app/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/main.c b/app/main.c index fc07cb5..d1ae573 100644 --- a/app/main.c +++ b/app/main.c @@ -65,7 +65,7 @@ static void toggle_chan_scanlist(void) gTxVfo->SCANLIST1_PARTICIPATION = !gTxVfo->SCANLIST1_PARTICIPATION; } - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, false); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; From 8fa42a5ad7ae3b525d25c9e9ded6eb4e9a77f3fe Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Tue, 26 Mar 2024 22:44:34 +0100 Subject: [PATCH 12/16] Add exclude memory channel --- README.md | 2 +- app/main.c | 4 ++-- app/menu.c | 8 ++++---- settings.c | 6 +++--- settings.h | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 5e9d5aa..758414b 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Anyway, have fun. # Donations -Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW and Jorge Ornelas for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻 +Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas, Laurent F4AXK and Christophe Morel for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻 ## Table of Contents diff --git a/app/main.c b/app/main.c index d1ae573..b9856d7 100644 --- a/app/main.c +++ b/app/main.c @@ -65,7 +65,7 @@ static void toggle_chan_scanlist(void) gTxVfo->SCANLIST1_PARTICIPATION = !gTxVfo->SCANLIST1_PARTICIPATION; } - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; @@ -547,7 +547,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) gTxVfo->SCANLIST1_PARTICIPATION = 0; gTxVfo->SCANLIST2_PARTICIPATION = 0; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true, false); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; diff --git a/app/menu.c b/app/menu.c index 4c45a18..b8d8724 100644 --- a/app/menu.c +++ b/app/menu.c @@ -616,14 +616,14 @@ void MENU_AcceptSetting(void) case MENU_S_ADD1: gTxVfo->SCANLIST1_PARTICIPATION = gSubMenuSelection; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, false, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; return; case MENU_S_ADD2: gTxVfo->SCANLIST2_PARTICIPATION = gSubMenuSelection; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, false, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; return; @@ -650,7 +650,7 @@ void MENU_AcceptSetting(void) case MENU_COMPAND: gTxVfo->Compander = gSubMenuSelection; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, false, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; // gRequestSaveChannel = 1; @@ -756,7 +756,7 @@ void MENU_AcceptSetting(void) #endif case MENU_DEL_CH: - SETTINGS_UpdateChannel(gSubMenuSelection, NULL, false, true); + SETTINGS_UpdateChannel(gSubMenuSelection, NULL, false, false, true); gVfoConfigureMode = VFO_CONFIGURE_RELOAD; gFlagResetVfos = true; return; diff --git a/settings.c b/settings.c index b0fa696..06dbdfe 100644 --- a/settings.c +++ b/settings.c @@ -714,7 +714,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, #endif EEPROM_WriteBuffer(OffsetVFO + 8, State._8); - SETTINGS_UpdateChannel(Channel, pVFO, true, true); + SETTINGS_UpdateChannel(Channel, pVFO, true, true, true); if (IS_MR_CHANNEL(Channel)) { #ifndef ENABLE_KEEP_MEM_NAME @@ -749,7 +749,7 @@ void SETTINGS_SaveChannelName(uint8_t channel, const char * name) EEPROM_WriteBuffer(0x0F58 + offset, buf + 8); } -void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool save) +void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save) { #ifdef ENABLE_NOAA if (!IS_NOAA_CHANNEL(channel)) @@ -771,7 +771,7 @@ void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, att.scanlist1 = pVFO->SCANLIST1_PARTICIPATION; att.scanlist2 = pVFO->SCANLIST2_PARTICIPATION; att.compander = pVFO->Compander; - if (state[channel & 7u] == att.__val) + if (check && state[channel & 7u] == att.__val) return; // no change in the attributes } diff --git a/settings.h b/settings.h index 447c9eb..374c3c5 100644 --- a/settings.h +++ b/settings.h @@ -282,7 +282,7 @@ void SETTINGS_SaveSettings(void); void SETTINGS_SaveChannelName(uint8_t channel, const char * name); void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode); void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration); -void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool save); +void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save); void SETTINGS_WriteBuildOptions(void); #endif From 7ab720a52a6b6926e641628ea725c652d2da3a51 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Wed, 27 Mar 2024 00:07:42 +0100 Subject: [PATCH 13/16] Add exclude memory channel --- app/main.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/app/main.c b/app/main.c index b9856d7..9914271 100644 --- a/app/main.c +++ b/app/main.c @@ -544,19 +544,22 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) #ifdef ENABLE_FEAT_F4HWN if(gScanStateDir != SCAN_OFF) { - gTxVfo->SCANLIST1_PARTICIPATION = 0; - gTxVfo->SCANLIST2_PARTICIPATION = 0; + if(FUNCTION_IsRx()) + { + gTxVfo->SCANLIST1_PARTICIPATION = 0; + gTxVfo->SCANLIST2_PARTICIPATION = 0; - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true, false); + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true, false); - gVfoConfigureMode = VFO_CONFIGURE; - gFlagResetVfos = true; + gVfoConfigureMode = VFO_CONFIGURE; + gFlagResetVfos = true; - //gDebug = (uint8_t)lastFoundFrqOrChanOld; + //gDebug = (uint8_t)lastFoundFrqOrChanOld; - lastFoundFrqOrChan = lastFoundFrqOrChanOld; + lastFoundFrqOrChan = lastFoundFrqOrChanOld; - CHFRSCANNER_ContinueScanning(); + CHFRSCANNER_ContinueScanning(); + } return; } From 349cb0d5f497e62a5081c98b87ab183f782e863b Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Wed, 27 Mar 2024 19:35:58 +0100 Subject: [PATCH 14/16] Change BatVol to SysInf --- README.md | 4 ++-- ui/menu.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 758414b..d7678e3 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ This repository is a fork of [Egzumer custom firmware](https://github.com/egzume All is a cloned and customized version of DualTachyon's open firmware found [here](https://github.com/DualTachyon/uv-k5-firmware) ... a cool achievement ! > [!WARNING] -> EN - Use this firmware at your own risk (entirely). There is absolutely no guarantee that it will work in any way shape or form on your radio(s), it may even brick your radio(s), in which case, you'd need to buy another radio. +> EN - THIS FIRMWARE HAS NO REAL BRAIN. PLEASE USE YOUR OWN. Use this firmware at your own risk (entirely). There is absolutely no guarantee that it will work in any way shape or form on your radio(s), it may even brick your radio(s), in which case, you'd need to buy another radio. Anyway, have fun. > -> _FR - Utilisez ce firmware à vos risques et périls. Il n'y a absolument aucune garantie qu'il fonctionnera d'une manière ou d'une autre sur votre (vos) radio(s), il peut même bousiller votre (vos) radio(s), dans ce cas, vous devrez acheter une autre radio. Quoi qu'il en soit, amusez-vous bien._ +> _FR - CE FIRMWARE N'A PAS DE VÉRITABLE CERVEAU. VEUILLEZ UTILISER LE VÔTRE. Utilisez ce firmware à vos risques et périls. Il n'y a absolument aucune garantie qu'il fonctionnera d'une manière ou d'une autre sur votre (vos) radio(s), il peut même bousiller votre (vos) radio(s), dans ce cas, vous devrez acheter une autre radio. Quoi qu'il en soit, amusez-vous bien._ > [!CAUTION] > EN - I recommend to backup your eeprom with [k5prog](https://github.com/sq5bpf/k5prog) before playing with alternative firmwares. It's a good reflex to have. diff --git a/ui/menu.c b/ui/menu.c index 102f2e8..6f7fbfe 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -122,7 +122,11 @@ const t_menu_item MenuList[] = #ifdef ENABLE_VOX {"VOX", VOICE_ID_VOX, MENU_VOX }, #endif +#ifdef ENABLE_FEAT_F4HWN + {"SysInf", VOICE_ID_INVALID, MENU_VOL }, // was "VOL" +#else {"BatVol", VOICE_ID_INVALID, MENU_VOL }, // was "VOL" +#endif {"RxMode", VOICE_ID_DUAL_STANDBY, MENU_TDR }, {"Sql", VOICE_ID_SQUELCH, MENU_SQL }, #ifdef ENABLE_FEAT_F4HWN @@ -870,9 +874,18 @@ void UI_DisplayMenu(void) break; case MENU_VOL: +#ifdef ENABLE_FEAT_F4HWN + sprintf(String, "%u.%02uV %u%%\n%s\n%s", + gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, + BATTERY_VoltsToPercent(gBatteryVoltageAverage), + AUTHOR_STRING_2, + VERSION_STRING_2 + ); +#else sprintf(String, "%u.%02uV\n%u%%", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, BATTERY_VoltsToPercent(gBatteryVoltageAverage)); +#endif break; case MENU_RESET: From 710f4728b361431fdd87e1c5e7d664cc8c5b7140 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 28 Mar 2024 02:37:40 +0100 Subject: [PATCH 15/16] Fixed Txp because of toxic fucking closed firmwares --- radio.c | 88 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 69 insertions(+), 19 deletions(-) diff --git a/radio.c b/radio.c index 7174e6f..1d0db46 100644 --- a/radio.c +++ b/radio.c @@ -474,54 +474,104 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo) #ifdef ENABLE_FEAT_F4HWN // make low and mid even lower + // and fix values + // because of toxic fucking closed firmwares - uint8_t shift[] = {0, 0, 0, 0, 0}; + uint8_t shift[] = {0, 0, 0, 0, 0, 0, 0}; - /* if(Band == 5) { - shift[0] = 3; - shift[1] = 3; - shift[2] = 4; - shift[3] = 7; - shift[4] = 8; + shift[0] = 2; + shift[1] = 1; + shift[2] = 2; + shift[3] = 2; + shift[4] = 2; + shift[5] = 2; + shift[6] = 2; } - */ if (pInfo->OUTPUT_POWER == OUTPUT_POWER_LOW) { for(uint8_t p = 0; p < 3; p++ ) { switch (gSetting_set_low) { case 0: - Txp[p] = (Txp[p] * 4) / 25 - shift[gSetting_set_low]; + Txp[p] = 16 - shift[gSetting_set_low]; break; case 1: - Txp[p] = (Txp[p] * 4) / 19 + shift[gSetting_set_low]; + Txp[p] = 21 + shift[gSetting_set_low]; break; case 2: - Txp[p] = (Txp[p] * 4) / 13 + shift[gSetting_set_low]; + Txp[p] = 29 + shift[gSetting_set_low]; break; case 3: - Txp[p] = (Txp[p] * 4) / 10 + shift[gSetting_set_low]; + Txp[p] = 37 + shift[gSetting_set_low]; break; case 4: - Txp[p] = (Txp[p] * 4) / 7 + shift[gSetting_set_low]; + Txp[p] = 50 + shift[gSetting_set_low]; break; } } } else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_MID){ - Txp[0] = (Txp[0] * 3) / 4; - Txp[1] = (Txp[1] * 3) / 4; - Txp[2] = (Txp[2] * 3) / 4; + Txp[0] = 77 + shift[5]; + Txp[1] = 77 + shift[5]; + Txp[2] = 77 + shift[5]; } // increase high else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_HIGH){ - Txp[0] = Txp[0] + 30; - Txp[1] = Txp[1] + 30; - Txp[2] = Txp[2] + 30; + Txp[0] = 165 + shift[6]; + Txp[1] = 165 + shift[6]; + Txp[2] = 165 + shift[6]; } + + // uint8_t shift[] = {0, 0, 0, 0, 0}; + + // /* + // if(Band == 5) + // { + // shift[0] = 3; + // shift[1] = 3; + // shift[2] = 4; + // shift[3] = 7; + // shift[4] = 8; + // } + // */ + + // if (pInfo->OUTPUT_POWER == OUTPUT_POWER_LOW) { + // for(uint8_t p = 0; p < 3; p++ ) + // { + // switch (gSetting_set_low) { + // case 0: + // Txp[p] = (Txp[p] * 4) / 25 + shift[gSetting_set_low]; + // break; + // case 1: + // Txp[p] = (Txp[p] * 4) / 19 + shift[gSetting_set_low]; + // break; + // case 2: + // Txp[p] = (Txp[p] * 4) / 13 + shift[gSetting_set_low]; + // break; + // case 3: + // Txp[p] = (Txp[p] * 4) / 10 + shift[gSetting_set_low]; + // break; + // case 4: + // Txp[p] = (Txp[p] * 4) / 7 + shift[gSetting_set_low]; + // break; + // } + + // } + // } + // else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_MID){ + // Txp[0] = (Txp[0] * 3) / 4; + // Txp[1] = (Txp[1] * 3) / 4; + // Txp[2] = (Txp[2] * 3) / 4; + // } + // // increase high + // else if (pInfo->OUTPUT_POWER == OUTPUT_POWER_HIGH){ + // Txp[0] = Txp[0] + 30; + // Txp[1] = Txp[1] + 30; + // Txp[2] = Txp[2] + 30; + // } #else #ifdef ENABLE_REDUCE_LOW_MID_TX_POWER // make low and mid even lower From b353bb72d61c14df79df04d99fab23c568d3bdb7 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Thu, 28 Mar 2024 06:41:36 +0100 Subject: [PATCH 16/16] Add exclude memory channel --- app/main.c | 54 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/app/main.c b/app/main.c index 9914271..807c0b7 100644 --- a/app/main.c +++ b/app/main.c @@ -534,39 +534,41 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld) } } -static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld) +static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) { + //static uint8_t block = 0; + if (bKeyPressed && !bKeyHeld) // menu key pressed gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; if (bKeyHeld) { // menu key held down (long press) - - #ifdef ENABLE_FEAT_F4HWN - if(gScanStateDir != SCAN_OFF) - { - if(FUNCTION_IsRx()) - { - gTxVfo->SCANLIST1_PARTICIPATION = 0; - gTxVfo->SCANLIST2_PARTICIPATION = 0; - - SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true, false); - - gVfoConfigureMode = VFO_CONFIGURE; - gFlagResetVfos = true; - - //gDebug = (uint8_t)lastFoundFrqOrChanOld; - - lastFoundFrqOrChan = lastFoundFrqOrChanOld; - - CHFRSCANNER_ContinueScanning(); - } - - return; - } - #endif - if (bKeyPressed) { // long press MENU key + #ifdef ENABLE_FEAT_F4HWN + if(gScanStateDir != SCAN_OFF && gEeprom.SCAN_LIST_DEFAULT < 2) + { + if(FUNCTION_IsRx()) + { + gTxVfo->SCANLIST1_PARTICIPATION = 0; + gTxVfo->SCANLIST2_PARTICIPATION = 0; + + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true, false); + + gVfoConfigureMode = VFO_CONFIGURE; + gFlagResetVfos = true; + + //block++; + //gDebug = block; + + lastFoundFrqOrChan = lastFoundFrqOrChanOld; + + CHFRSCANNER_ContinueScanning(); + } + + return; + } + #endif + gWasFKeyPressed = false; if (gScreenToDisplay == DISPLAY_MAIN) {