diff --git a/Makefile b/Makefile index 412f224..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 @@ -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/README.md b/README.md index 33398e4..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. @@ -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, 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 @@ -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, diff --git a/app/app.c b/app/app.c index c49c475..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; @@ -1303,8 +1302,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/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/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 diff --git a/app/main.c b/app/main.c index 8f9a9e1..807c0b7 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()) @@ -65,7 +65,7 @@ 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, true, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; @@ -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; @@ -536,14 +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) 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) { diff --git a/app/menu.c b/app/menu.c index 2af07ec..b8d8724 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 @@ -434,7 +436,6 @@ void MENU_AcceptSetting(void) if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) { gRequestSaveChannel = 1; - return; } return; @@ -615,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, false, 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, false, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; return; @@ -649,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, false, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; // gRequestSaveChannel = 1; @@ -755,7 +756,7 @@ void MENU_AcceptSetting(void) #endif case MENU_DEL_CH: - SETTINGS_UpdateChannel(gSubMenuSelection, NULL, false); + SETTINGS_UpdateChannel(gSubMenuSelection, NULL, false, false, true); gVfoConfigureMode = VFO_CONFIGURE_RELOAD; gFlagResetVfos = true; return; 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 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..2d72357 100644 --- a/misc.h +++ b/misc.h @@ -349,6 +349,7 @@ 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..1d0db46 100644 --- a/radio.c +++ b/radio.c @@ -474,40 +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, 0, 0}; + + if(Band == 5) + { + 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; + Txp[p] = 16 - shift[gSetting_set_low]; break; case 1: - Txp[p] = (Txp[p] * 4) / 19; + Txp[p] = 21 + shift[gSetting_set_low]; break; case 2: - Txp[p] = (Txp[p] * 4) / 13; + Txp[p] = 29 + shift[gSetting_set_low]; break; case 3: - Txp[p] = (Txp[p] * 4) / 10; + Txp[p] = 37 + shift[gSetting_set_low]; break; case 4: - Txp[p] = (Txp[p] * 4) / 7; + 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 diff --git a/settings.c b/settings.c index 2481cb5..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); + 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) +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,12 +771,20 @@ 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 } state[channel & 7u] = att.__val; + +#ifdef ENABLE_FEAT_F4HWN + if(save) + { + EEPROM_WriteBuffer(offset, state); + } +#else EEPROM_WriteBuffer(offset, state); +#endif gMR_ChannelAttributes[channel] = att; diff --git a/settings.h b/settings.h index 6ae4e87..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); +void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save); void SETTINGS_WriteBuildOptions(void); #endif 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: 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 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