diff --git a/Makefile b/Makefile index d9c508a..6e35cc5 100644 --- a/Makefile +++ b/Makefile @@ -45,8 +45,12 @@ ENABLE_FEAT_F4HWN_SCREENSHOT ?= 0 ENABLE_FEAT_F4HWN_SPECTRUM ?= 1 ENABLE_FEAT_F4HWN_RX_TX_TIMER ?= 1 ENABLE_FEAT_F4HWN_CHARGING_C ?= 1 -ENABLE_FEAT_F4HWN_SLEEP ?= 1 -ENABLE_FEAT_F4HWN_PMR ?= 0 +ENABLE_FEAT_F4HWN_SLEEP ?= 1 +ENABLE_FEAT_F4HWN_RESTORE_SCAN ?= 1 +ENABLE_FEAT_F4HWN_NARROWER ?= 1 +ENABLE_FEAT_F4HWN_VOL ?= 0 +ENABLE_FEAT_F4HWN_RESET_CHANNEL ?= 0 +ENABLE_FEAT_F4HWN_PMR ?= 0 ENABLE_FEAT_F4HWN_GMRS_FRS_MURS ?= 0 ENABLE_FEAT_F4HWN_CA ?= 1 @@ -218,7 +222,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1) VERSION_STRING_1 ?= v0.22 AUTHOR_STRING_2 ?= F4HWN - VERSION_STRING_2 ?= v3.5 + VERSION_STRING_2 ?= v3.6 AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2) VERSION_STRING ?= $(VERSION_STRING_2) @@ -404,8 +408,11 @@ endif ifeq ($(ENABLE_FEAT_F4HWN),1) CFLAGS += -DENABLE_FEAT_F4HWN CFLAGS += -DALERT_TOT=10 + CFLAGS += -DSQL_TONE=550 # For SA818, use 600 and python3 sa818.py --port /dev/ttyS2 radio --frequency 434.975 --ctcss 71.9 --tail Open CFLAGS += -DAUTHOR_STRING_1=\"$(AUTHOR_STRING_1)\" -DVERSION_STRING_1=\"$(VERSION_STRING_1)\" CFLAGS += -DAUTHOR_STRING_2=\"$(AUTHOR_STRING_2)\" -DVERSION_STRING_2=\"$(VERSION_STRING_2)\" +else + CFLAGS += -DSQL_TONE=550 endif ifeq ($(ENABLE_FEAT_F4HWN_SCREENSHOT),1) CFLAGS += -DENABLE_FEAT_F4HWN_SCREENSHOT @@ -422,6 +429,18 @@ endif ifeq ($(ENABLE_FEAT_F4HWN_SLEEP),1) CFLAGS += -DENABLE_FEAT_F4HWN_SLEEP endif +ifeq ($(ENABLE_FEAT_F4HWN_RESTORE_SCAN),1) + CFLAGS += -DENABLE_FEAT_F4HWN_RESTORE_SCAN +endif +ifeq ($(ENABLE_FEAT_F4HWN_NARROWER),1) + CFLAGS += -DENABLE_FEAT_F4HWN_NARROWER +endif +ifeq ($(ENABLE_FEAT_F4HWN_VOL),1) + CFLAGS += -DENABLE_FEAT_F4HWN_VOL +endif +ifeq ($(ENABLE_FEAT_F4HWN_RESET_CHANNEL),1) + CFLAGS += -DENABLE_FEAT_F4HWN_RESET_CHANNEL +endif ifeq ($(ENABLE_FEAT_F4HWN_PMR),1) CFLAGS += -DENABLE_FEAT_F4HWN_PMR endif diff --git a/README.md b/README.md index 75f9a9f..d30e018 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Anyway, have fun. # Donations -Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC206, Frédéric F4ESO, Stéphane F5LGW, Jorge Ornelas, Laurent F4AXK, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern, Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Levente Szőke (2 times), Bernard-Michel Herrera, Jérôme Saintespes, Paul Davies, RS and Johan F4WAT 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, Christophe Morel, Clayton W0LED, Pierre Antoine F6FWB, Jean-Claude 14FRS3306, Thierry F4GVO, Eric F1NOU, PricelessToolkit, Ady M6NYJ, Tom McGovern, Joseph Roth, Pierre-Yves Colin, Frank DJ7FG, Marcel Testaz, Brian Frobisher, Yannick F4JFO, Paolo Bussola, Dirk DL8DF, Levente Szőke (2 times), Bernard-Michel Herrera, Jérôme Saintespes, Paul Davies, RS, Johan F4WAT and Robert Wörle for their [donations](https://www.paypal.com/paypalme/F4HWN). That’s so kind of them. Thanks so much 🙏🏻 ## Table of Contents @@ -41,7 +41,7 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * [License](#license) * [Example changes/updates](#example-changesupdates) -## Main features: +## Main features and improvements from F4HWN: * improve default power settings level: * Low1 to Low5 (<~20mW, ~125mW, ~250mW, ~500mW, ~1W), @@ -68,27 +68,30 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * rename BackLt to BLTime, * rename BltTRX to BLTxRx, * improve memory channel input, + * improve keyboard frequency input, * add percent and gauge to Air Copy, * improve audio bar, * and more... * new menu entries and changes: * add SetPwr menu to set User power (<20mW, 125mW, 250mW, 500mW, 1W, 2W or 5W), - * add SetPtt menu to set PTT mode (Classic or OnePush), - * add SetTot menu to set TOT alert (Off, Sound, Visual, All), + * add SetPTT menu to set PTT mode (Classic or OnePush), + * add SetTOT menu to set TOT alert (Off, Sound, Visual, All), * add SetCtr menu to set contrast (0 to 15), * add SetInv menu to set screen in invert mode (Off or On), - * add SetEot menu to set EOT (End Of Transmission) alert (Off, Sound, Visual, All), + * add SetEOT menu to set EOT (End Of Transmission) alert (Off, Sound, Visual, All), * add SetMet menu to set s-meter style (Classic or Tiny), * add SetLck menu to set what is locked (Keys or Keys + PTT), - * add SetGui menu to set font size on the VFO baseline (Classic or Tiny), + * add SetGUI menu to set font size on the VFO baseline (Classic or Tiny), * add TXLock menu to open TX on channel, * add SetTmr menu to set RX and TX timers (Off or On), * add SetOff menu to set the delay before the transceiver goes into deep sleep (Off or 1 minute to 2 hours), + * add SetNFM menu to set Narrow width (12.5kHz or 6.25kHz), * rename BatVol menu (52/63) to SysInf, which displays the firmware version in addition to the battery status, * improve PonMsg menu, * improve BackLt menu, * improve TxTOut menu, - * improve ScnRev menu (CARRIER FAST, CARRIER SLOW, STOP, TIMEOUT from 5 secondes to 2 minutes) + * improve ScnRev menu (CARRIER from 250ms to 20s, STOP, TIMEOUT from 5s to 2m) + * improve KeyLck menu (OFF, delay from 15s to 10m) * add HAM CA F Lock band (for Canadian zone), * remove blink and SOS functionality, * remove AM Fix menu (AM Fix is ENABLED by default), @@ -109,6 +112,7 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * scan lists [1, 2, 3], * scan all (all channels with ou without list), * add scan list shortcuts, + * add scan resume mode on startup, * new actions: * RX MODE, * MAIN ONLY, diff --git a/app/action.c b/app/action.c index 73a2f0b..4d33bb5 100644 --- a/app/action.c +++ b/app/action.c @@ -220,6 +220,9 @@ void ACTION_Scan(bool bRestart) // channel mode. Keep scanning but toggle between scan lists gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 6; + #ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN + SETTINGS_WriteCurrentState(); + #endif // jump to the next channel CHFRSCANNER_Start(false, gScanStateDir); @@ -517,29 +520,61 @@ void ACTION_MainOnly(void) void ACTION_Ptt(void) { - gSetting_set_ptt_session = (gSetting_set_ptt_session == 0) ? 1: 0; + gSetting_set_ptt_session = !gSetting_set_ptt_session; } void ACTION_Wn(void) { - if (FUNCTION_IsRx()) - { - gRxVfo->CHANNEL_BANDWIDTH = (gRxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0; - #ifdef ENABLE_AM_FIX - BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH, true); - #else - BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH, false); - #endif - } - else - { - gTxVfo->CHANNEL_BANDWIDTH = (gTxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0; - #ifdef ENABLE_AM_FIX - BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, true); - #else - BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false); - #endif - } + #ifdef ENABLE_FEAT_F4HWN_NARROWER + bool narrower = 0; + if (FUNCTION_IsRx()) + { + gRxVfo->CHANNEL_BANDWIDTH = (gRxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0; + if(gRxVfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1) + { + narrower = 1; + } + + #ifdef ENABLE_AM_FIX + BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH + narrower, true); + #else + BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH + narrower, false); + #endif + } + else + { + gTxVfo->CHANNEL_BANDWIDTH = (gTxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0; + if(gTxVfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1) + { + narrower = 1; + } + + #ifdef ENABLE_AM_FIX + BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, true); + #else + BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false); + #endif + } + #else + if (FUNCTION_IsRx()) + { + gRxVfo->CHANNEL_BANDWIDTH = (gRxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0; + #ifdef ENABLE_AM_FIX + BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH, true); + #else + BK4819_SetFilterBandwidth(gRxVfo->CHANNEL_BANDWIDTH, false); + #endif + } + else + { + gTxVfo->CHANNEL_BANDWIDTH = (gTxVfo->CHANNEL_BANDWIDTH == 0) ? 1: 0; + #ifdef ENABLE_AM_FIX + BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, true); + #else + BK4819_SetFilterBandwidth(gTxVfo->CHANNEL_BANDWIDTH, false); + #endif + } + #endif } void ACTION_BackLight(void) diff --git a/app/app.c b/app/app.c index d58e23d..dd2c502 100644 --- a/app/app.c +++ b/app/app.c @@ -1129,7 +1129,7 @@ void APP_Update(void) #ifdef ENABLE_FEAT_F4HWN_SLEEP if(gWakeUp) { - gPowerSave_10ms = 1000; // Why ? Why not :) 10s + gPowerSave_10ms = gEeprom.BATTERY_SAVE * 200; // deep sleep now indexed on BatSav } else { diff --git a/app/chFrScanner.c b/app/chFrScanner.c index b249dc6..f326c4d 100644 --- a/app/chFrScanner.c +++ b/app/chFrScanner.c @@ -196,6 +196,11 @@ void CHFRSCANNER_Stop(void) } } + #ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN + gEeprom.CURRENT_STATE = 0; + SETTINGS_WriteCurrentState(); + #endif + RADIO_SetupRegisters(true); gUpdateDisplay = true; } diff --git a/app/fm.c b/app/fm.c index 248ad2c..81cc283 100644 --- a/app/fm.c +++ b/app/fm.c @@ -185,36 +185,53 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit) const uint16_t Deviation = BK1080_REG_07_GET_FREQD(Test2); if (BK1080_REG_07_GET_SNR(Test2) <= 2) { - goto Bail; + BK1080_FrequencyDeviation = Deviation; + BK1080_BaseFrequency = Frequency; + + return ret; } const uint16_t Status = BK1080_ReadRegister(BK1080_REG_10); if ((Status & BK1080_REG_10_MASK_AFCRL) != BK1080_REG_10_AFCRL_NOT_RAILED || BK1080_REG_10_GET_RSSI(Status) < 10) { - goto Bail; + BK1080_FrequencyDeviation = Deviation; + BK1080_BaseFrequency = Frequency; + + return ret; } //if (Deviation > -281 && Deviation < 280) if (Deviation >= 280 && Deviation <= 3815) { - goto Bail; + BK1080_FrequencyDeviation = Deviation; + BK1080_BaseFrequency = Frequency; + + return ret; } // not BLE(less than or equal) if (Frequency > LowerLimit && (Frequency - BK1080_BaseFrequency) == 1) { if (BK1080_FrequencyDeviation & 0x800 || (BK1080_FrequencyDeviation < 20)) - goto Bail; + { + BK1080_FrequencyDeviation = Deviation; + BK1080_BaseFrequency = Frequency; + + return ret; + } } // not BLT(less than) if (Frequency >= LowerLimit && (BK1080_BaseFrequency - Frequency) == 1) { if ((BK1080_FrequencyDeviation & 0x800) == 0 || (BK1080_FrequencyDeviation > 4075)) - goto Bail; + { + BK1080_FrequencyDeviation = Deviation; + BK1080_BaseFrequency = Frequency; + + return ret; + } } ret = 0; - -Bail: BK1080_FrequencyDeviation = Deviation; BK1080_BaseFrequency = Frequency; diff --git a/app/main.c b/app/main.c index 328cb06..f69e3a6 100644 --- a/app/main.c +++ b/app/main.c @@ -407,6 +407,9 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) switch(Key) { case KEY_0...KEY_5: gEeprom.SCAN_LIST_DEFAULT = Key; + #ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN + SETTINGS_WriteCurrentState(); + #endif break; default: break; @@ -442,13 +445,33 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) #ifdef ENABLE_VOICE gAnotherVoiceID = (VOICE_ID_t)Key; #endif - bool isGigaF = gTxVfo->pRX->Frequency >= _1GHz_in_KHz; - if (gInputBoxIndex < 6 + isGigaF) { + uint8_t totalDigits = 6; // by default frequency is lower than 1 GHz + if (gTxVfo->pRX->Frequency >= _1GHz_in_KHz) { + totalDigits = 7; // if frequency is uppen than GHz + } + + if (gInputBoxIndex == 0) { + // do nothing return; } - gInputBoxIndex = 0; - uint32_t Frequency = StrToUL(INPUTBOX_GetAscii()) * 100; + gKeyInputCountdown = (key_input_timeout_500ms / 5); // short time... + + const char *inputStr = INPUTBOX_GetAscii(); + uint8_t inputLength = gInputBoxIndex; + + // convert to int + uint32_t inputFreq = StrToUL(inputStr); + + // how many zero to add + uint8_t zerosToAdd = totalDigits - inputLength; + + // add missing zero + for (uint8_t i = 0; i < zerosToAdd; i++) { + inputFreq *= 10; + } + + uint32_t Frequency = inputFreq * 100; // clamp the frequency entered to some valid value if (Frequency < frequencyBandTable[0].lower) { @@ -684,6 +707,17 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) if (!bKeyPressed) // released return; + #ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN + if(gScanRangeStart == 0) // No ScanRange + { + gEeprom.CURRENT_STATE = 1; + } + else // ScanRange + { + gEeprom.CURRENT_STATE = 2; + } + SETTINGS_WriteCurrentState(); + #endif ACTION_Scan(false);// toggle scanning gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; @@ -732,6 +766,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) // scan the CTCSS/DCS code gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX; gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF; + SCANNER_Start(true); gRequestDisplayScreen = DISPLAY_SCANNER; } diff --git a/app/menu.c b/app/menu.c index 44886dc..f5edf32 100644 --- a/app/menu.c +++ b/app/menu.c @@ -309,7 +309,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_SAVE: //*pMin = 0; - *pMax = ARRAY_SIZE(gSubMenu_SAVE) - 1; + *pMax = 5; break; case MENU_MIC: @@ -418,6 +418,18 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) //*pMin = 0; *pMax = ARRAY_SIZE(gSubMenu_SET_MET) - 1; break; + #ifdef ENABLE_FEAT_F4HWN_NARROWER + case MENU_SET_NFM: + //*pMin = 0; + *pMax = ARRAY_SIZE(gSubMenu_SET_NFM) - 1; + break; + #endif + #ifdef ENABLE_FEAT_F4HWN_VOL + case MENU_SET_VOL: + //*pMin = 0; + *pMax = 63; + break; + #endif #endif default: @@ -917,6 +929,18 @@ void MENU_AcceptSetting(void) case MENU_SET_GUI: gSetting_set_gui = gSubMenuSelection; break; + #ifdef ENABLE_FEAT_F4HWN_NARROWER + case MENU_SET_NFM: + gSetting_set_nfm = gSubMenuSelection; + RADIO_SetTxParameters(); + RADIO_SetupRegisters(true); + break; + #endif + #ifdef ENABLE_FEAT_F4HWN_VOL + case MENU_SET_VOL: + gEeprom.VOLUME_GAIN = gSubMenuSelection; + break; + #endif case MENU_SET_TMR: gSetting_set_tmr = gSubMenuSelection; break; @@ -1351,6 +1375,16 @@ void MENU_ShowCurrentSetting(void) case MENU_SET_GUI: gSubMenuSelection = gSetting_set_gui; break; + #ifdef ENABLE_FEAT_F4HWN_NARROWER + case MENU_SET_NFM: + gSubMenuSelection = gSetting_set_nfm; + break; + #endif + #ifdef ENABLE_FEAT_F4HWN_VOL + case MENU_SET_VOL: + gSubMenuSelection = gEeprom.VOLUME_GAIN; + break; + #endif case MENU_SET_TMR: gSubMenuSelection = gSetting_set_tmr; break; diff --git a/archive/f4hwn.bandscope.packed.v3.6.bin b/archive/f4hwn.bandscope.packed.v3.6.bin new file mode 100644 index 0000000..3f63ce1 Binary files /dev/null and b/archive/f4hwn.bandscope.packed.v3.6.bin differ diff --git a/archive/f4hwn.broadcast.packed.v3.6.bin b/archive/f4hwn.broadcast.packed.v3.6.bin new file mode 100644 index 0000000..e7315ce Binary files /dev/null and b/archive/f4hwn.broadcast.packed.v3.6.bin differ diff --git a/archive/f4hwn.voxless.packed.v3.6.bin b/archive/f4hwn.voxless.packed.v3.6.bin new file mode 100644 index 0000000..65612e6 Binary files /dev/null and b/archive/f4hwn.voxless.packed.v3.6.bin differ diff --git a/compile-with-docker-all.sh b/compile-with-docker-all.sh index 82ad416..0dcba60 100755 --- a/compile-with-docker-all.sh +++ b/compile-with-docker-all.sh @@ -3,28 +3,63 @@ IMAGE_NAME="uvk5" rm "${PWD}/compiled-firmware/*" docker build -t $IMAGE_NAME . -docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \ -ENABLE_SPECTRUM=1 \ -ENABLE_FMRADIO=0 \ -ENABLE_AIRCOPY=1 \ -ENABLE_NOAA=0 \ -TARGET=f4hwn.bandscope \ -&& cp f4hwn.bandscope* compiled-firmware/" -docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \ -ENABLE_SPECTRUM=0 \ -ENABLE_FMRADIO=1 \ -ENABLE_AIRCOPY=1 \ -ENABLE_NOAA=0 \ -TARGET=f4hwn.broadcast \ -&& cp f4hwn.broadcast* compiled-firmware/" -docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \ -ENABLE_SPECTRUM=1 \ -ENABLE_FMRADIO=1 \ -ENABLE_VOX=0 \ -ENABLE_AIRCOPY=0 \ -ENABLE_AUDIO_BAR=0 \ -ENABLE_FEAT_F4HWN_SPECTRUM=0 \ -ENABLE_FEAT_F4HWN_SLEEP=0 \ -ENABLE_NOAA=0 \ -TARGET=f4hwn.voxless \ -&& cp f4hwn.voxless* compiled-firmware/" \ No newline at end of file + +bandscope() { + echo "Bandscope compilation..." + docker run --rm -v "${PWD}/compiled-firmware/:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "rm ./compiled-firmware/*; cd /app && make -s \ + ENABLE_SPECTRUM=1 \ + ENABLE_FMRADIO=0 \ + ENABLE_AIRCOPY=1 \ + ENABLE_NOAA=0 \ + TARGET=f4hwn.bandscope \ + && cp f4hwn.bandscope* compiled-firmware/" +} + +broadcast() { + echo "Broadcast compilation..." + docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \ + ENABLE_SPECTRUM=0 \ + ENABLE_FMRADIO=1 \ + ENABLE_AIRCOPY=1 \ + ENABLE_NOAA=0 \ + TARGET=f4hwn.broadcast \ + && cp f4hwn.broadcast* compiled-firmware/" +} + +voxless() { + echo "Voxless compilation..." + docker run --rm -v "${PWD}/compiled-firmware:/app/compiled-firmware" $IMAGE_NAME /bin/bash -c "cd /app && make -s \ + ENABLE_SPECTRUM=1 \ + ENABLE_FMRADIO=1 \ + ENABLE_VOX=0 \ + ENABLE_AIRCOPY=0 \ + ENABLE_AUDIO_BAR=0 \ + ENABLE_FEAT_F4HWN_SPECTRUM=0 \ + ENABLE_NOAA=0 \ + ENABLE_FEAT_F4HWN_RESTORE_SCAN=0 \ + ENABLE_FEAT_F4HWN_CHARGING_C=0 \ + ENABLE_FEAT_F4HWN_NARROWER=0 \ + TARGET=f4hwn.voxless \ + && cp f4hwn.voxless* compiled-firmware/" +} + +case "$1" in + bandscope) + bandscope + ;; + broadcast) + broadcast + ;; + voxless) + voxless + ;; + all) + bandscope + broadcast + voxless + ;; + *) + echo "Usage: $0 {bandscope|broadcast|voxless|all}" + exit 1 + ;; +esac \ No newline at end of file diff --git a/driver/backlight.c b/driver/backlight.c index 997b388..32f5f5b 100644 --- a/driver/backlight.c +++ b/driver/backlight.c @@ -104,11 +104,15 @@ void BACKLIGHT_TurnOn(void) #ifdef ENABLE_FEAT_F4HWN if(gK5startup == true) { - for(uint8_t i = 0; i <= gEeprom.BACKLIGHT_MAX; i++) - { - BACKLIGHT_SetBrightness(i); - SYSTEM_DelayMs(50); - } + #if defined(ENABLE_FMRADIO) && defined(ENABLE_SPECTRUM) + BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX); + #else + for(uint8_t i = 0; i <= gEeprom.BACKLIGHT_MAX; i++) + { + BACKLIGHT_SetBrightness(i); + SYSTEM_DelayMs(50); + } + #endif BACKLIGHT_Sound(); } diff --git a/driver/bk4819.c b/driver/bk4819.c index 8501939..cb6aa2f 100644 --- a/driver/bk4819.c +++ b/driver/bk4819.c @@ -613,51 +613,49 @@ void BK4819_SetFilterBandwidth(const BK4819_FilterBandwidth_t Bandwidth, const b { default: case BK4819_FILTER_BW_WIDE: // 25kHz - val = (4u << 12) | // *3 RF filter bandwidth - (6u << 6) | // *0 AFTxLPF2 filter Band Width - (2u << 4) | // 2 BW Mode Selection - (1u << 3) | // 1 - (0u << 2); // 0 Gain after FM Demodulation - if (weak_no_different) { // make the RX bandwidth the same with weak signals - val |= (4u << 9); // *0 RF filter bandwidth when signal is weak + val = 0x3628; // Old value 0x49a8 < v3.6 } else { - /// with weak RX signals the RX bandwidth is reduced - val |= (2u << 9); // *0 RF filter bandwidth when signal is weak + // with weak RX signals the RX bandwidth is reduced + val = 0x3428; // Old value 0x45a8 < v3.6 } break; case BK4819_FILTER_BW_NARROW: // 12.5kHz - val = (4u << 12) | // *4 RF filter bandwidth - (0u << 6) | // *1 AFTxLPF2 filter Band Width - (0u << 4) | // 0 BW Mode Selection - (1u << 3) | // 1 - (0u << 2); // 0 Gain after FM Demodulation - if (weak_no_different) { - val |= (4u << 9); // *0 RF filter bandwidth when signal is weak + // make the RX bandwidth the same with weak signals + val = 0x3648; // Old value 0x4808 < v3.6 } else { - val |= (2u << 9); + // with weak RX signals the RX bandwidth is reduced + val = 0x3448; // Old value 0x4408 < v3.6 } break; case BK4819_FILTER_BW_NARROWER: // 6.25kHz - val = (3u << 12) | // 3 RF filter bandwidth - (3u << 9) | // *0 RF filter bandwidth when signal is weak - (1u << 6) | // 1 AFTxLPF2 filter Band Width - (1u << 4) | // 1 BW Mode Selection - (1u << 3) | // 1 - (0u << 2); // 0 Gain after FM Demodulation - if (weak_no_different) { - val |= (3u << 9); + // make the RX bandwidth the same with weak signals + val = 0x1348; // Old value 0x3658 < v3.6 } else { - val |= (0u << 9); // 0 RF filter bandwidth when signal is weak + // with weak RX signals the RX bandwidth is reduced + val = 0x1148; // Old value 0x3658 < v3.6 } break; + + /* + case BK4819_FILTER_BW_AM: // 8.33kHz + if (weak_no_different) { + // make the RX bandwidth the same with weak signals + val = 0x4858; + } else { + // with weak RX signals the RX bandwidth is reduced + val = 0x4458; + } + + break; + */ } BK4819_WriteRegister(BK4819_REG_43, val); diff --git a/functions.c b/functions.c index ada5019..289226f 100644 --- a/functions.c +++ b/functions.c @@ -121,7 +121,7 @@ void FUNCTION_PowerSave() { #ifdef ENABLE_FEAT_F4HWN_SLEEP if(gWakeUp) { - gPowerSave_10ms = 1000; // Why ? Why not :) 10s + gPowerSave_10ms = gEeprom.BATTERY_SAVE * 250; // deep sleep now indexed on BatSav } else { diff --git a/main.c b/main.c index 3af6286..95d5e49 100644 --- a/main.c +++ b/main.c @@ -29,6 +29,16 @@ #include "settings.h" #include "version.h" +#ifdef ENABLE_FEAT_F4HWN + #ifdef ENABLE_FMRADIO + #include "app/fm.h" + #endif + #ifdef ENABLE_SPECTRUM + #include "app/spectrum.h" + #endif + #include "app/chFrScanner.h" +#endif + #include "app/app.h" #include "app/dtmf.h" #include "bsp/dp32g030/gpio.h" @@ -242,6 +252,44 @@ void Main(void) #endif } + #ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN + switch (gEeprom.CURRENT_STATE) { + case 1: + //gScanRangeStart = 0; + //ACTION_Scan(false); + gEeprom.SCAN_LIST_DEFAULT = gEeprom.CURRENT_LIST; + CHFRSCANNER_Start(true, SCAN_FWD); + break; + + case 2: + gScanRangeStart = gScanRangeStart ? 0 : gTxVfo->pRX->Frequency; + gScanRangeStop = gEeprom.VfoInfo[!gEeprom.TX_VFO].freq_config_RX.Frequency; + if(gScanRangeStart > gScanRangeStop) + { + SWAP(gScanRangeStart, gScanRangeStop); + } + //ACTION_Scan(false); + CHFRSCANNER_Start(true, SCAN_FWD); + break; + + #ifdef ENABLE_FMRADIO + case 3: + FM_Start(); // For compiler alignments and paddings... + break; + #endif + + #ifdef ENABLE_SPECTRUM + case 4: + APP_RunSpectrum(); // For compiler alignments and paddings... + break; + #endif + + default: + // No action for CURRENT_STATE == 0 or other unexpected values + break; + } + #endif + while (true) { APP_Update(); diff --git a/misc.c b/misc.c index 5b34b20..40adb3b 100644 --- a/misc.c +++ b/misc.c @@ -125,6 +125,9 @@ enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; bool gSetting_set_lck = false; bool gSetting_set_met = 0; bool gSetting_set_gui = 0; + #ifdef ENABLE_FEAT_F4HWN_NARROWER + bool gSetting_set_nfm = 0; + #endif bool gSetting_set_tmr = 0; bool gSetting_set_ptt_session; uint8_t gDebug; diff --git a/misc.h b/misc.h index a4d25b0..9b05c2a 100644 --- a/misc.h +++ b/misc.h @@ -178,6 +178,9 @@ extern enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; extern bool gSetting_set_lck; extern bool gSetting_set_met; extern bool gSetting_set_gui; + #ifdef ENABLE_FEAT_F4HWN_NARROWER + extern bool gSetting_set_nfm; + #endif extern bool gSetting_set_tmr; extern bool gSetting_set_ptt_session; extern uint8_t gDebug; diff --git a/radio.c b/radio.c index 5170545..927a8f9 100644 --- a/radio.c +++ b/radio.c @@ -658,6 +658,13 @@ void RADIO_SetupRegisters(bool switchToForeground) { BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH; + #ifdef ENABLE_FEAT_F4HWN_NARROWER + if(Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1) + { + Bandwidth = BK4819_FILTER_BW_NARROWER; + } + #endif + AUDIO_AudioPathOff(); gEnableSpeaker = false; @@ -671,6 +678,7 @@ void RADIO_SetupRegisters(bool switchToForeground) [[fallthrough]]; case BK4819_FILTER_BW_WIDE: case BK4819_FILTER_BW_NARROW: + case BK4819_FILTER_BW_NARROWER: #ifdef ENABLE_AM_FIX // BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->Modulation == MODULATION_AM && gSetting_AM_fix); BK4819_SetFilterBandwidth(Bandwidth, true); @@ -745,13 +753,8 @@ void RADIO_SetupRegisters(bool switchToForeground) { default: case CODE_TYPE_OFF: - BK4819_SetCTCSSFrequency(670); - - //#ifndef ENABLE_CTCSS_TAIL_PHASE_SHIFT - BK4819_SetTailDetection(550); // QS's 55Hz tone method - //#else - // BK4819_SetTailDetection(670); // 67Hz - //#endif + BK4819_SetCTCSSFrequency(SQL_TONE); + BK4819_SetTailDetection(SQL_TONE); // Default 550 = QS's 55Hz tone method InterruptMask = BK4819_REG_3F_CxCSS_TAIL | BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST; break; @@ -760,7 +763,7 @@ void RADIO_SetupRegisters(bool switchToForeground) BK4819_SetCTCSSFrequency(CTCSS_Options[Code]); //#ifndef ENABLE_CTCSS_TAIL_PHASE_SHIFT - BK4819_SetTailDetection(550); // QS's 55Hz tone method + // BK4819_SetTailDetection(550); // QS's 55Hz tone method //#else // BK4819_SetTailDetection(CTCSS_Options[Code]); //#endif @@ -892,6 +895,13 @@ void RADIO_SetTxParameters(void) { BK4819_FilterBandwidth_t Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH; + #ifdef ENABLE_FEAT_F4HWN_NARROWER + if(Bandwidth == BK4819_FILTER_BW_NARROW && gSetting_set_nfm == 1) + { + Bandwidth = BK4819_FILTER_BW_NARROWER; + } + #endif + AUDIO_AudioPathOff(); gEnableSpeaker = false; @@ -905,6 +915,7 @@ void RADIO_SetTxParameters(void) [[fallthrough]]; case BK4819_FILTER_BW_WIDE: case BK4819_FILTER_BW_NARROW: + case BK4819_FILTER_BW_NARROWER: #ifdef ENABLE_AM_FIX // BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->Modulation == MODULATION_AM && gSetting_AM_fix); BK4819_SetFilterBandwidth(Bandwidth, true); diff --git a/settings.c b/settings.c index 43a7cdf..1aa2afb 100644 --- a/settings.c +++ b/settings.c @@ -27,6 +27,7 @@ #include "settings.h" #include "ui/menu.h" +#ifdef ENABLE_FEAT_F4HWN_RESET_CHANNEL static const uint32_t gDefaultFrequencyTable[] = { 14500000, // @@ -35,6 +36,7 @@ static const uint32_t gDefaultFrequencyTable[] = 43320000, // 43350000 // }; +#endif EEPROM_Config_t gEeprom = { 0 }; @@ -65,11 +67,23 @@ void SETTINGS_InitEEPROM(void) #endif gEeprom.CHANNEL_DISPLAY_MODE = (Data[1] < 4) ? Data[1] : MDF_FREQUENCY; // 4 instead of 3 - extra display mode gEeprom.CROSS_BAND_RX_TX = (Data[2] < 3) ? Data[2] : CROSS_BAND_OFF; - gEeprom.BATTERY_SAVE = (Data[3] < 5) ? Data[3] : 4; + gEeprom.BATTERY_SAVE = (Data[3] < 6) ? Data[3] : 4; gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A; gEeprom.BACKLIGHT_TIME = (Data[5] < 62) ? Data[5] : 12; - gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false; - gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true; + #ifdef ENABLE_FEAT_F4HWN_NARROWER + gEeprom.TAIL_TONE_ELIMINATION = ((Data[6] & 0x01) < 2) ? (Data[6] & 0x01) : false; + gSetting_set_nfm = (((Data[6] >> 1) & 0x03) < 3) ? ((Data[6] >> 1) & 0x03) : 0; + #else + gEeprom.TAIL_TONE_ELIMINATION = (Data[6] < 2) ? Data[6] : false; + #endif + + #ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN + gEeprom.VFO_OPEN = Data[7] & 0x01; + gEeprom.CURRENT_STATE = (Data[7] >> 1) & 0x07; + gEeprom.CURRENT_LIST = (Data[7] >> 4) & 0x07; + #else + gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true; + #endif // 0E80..0E87 EEPROM_ReadBuffer(0x0E80, Data, 8); @@ -492,15 +506,17 @@ void SETTINGS_FactoryReset(bool bIsAll) { RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, 43350000); - // set the first few memory channels - for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++) - { - const uint32_t Frequency = gDefaultFrequencyTable[i]; - gRxVfo->freq_config_RX.Frequency = Frequency; - gRxVfo->freq_config_TX.Frequency = Frequency; - gRxVfo->Band = FREQUENCY_GetBand(Frequency); - SETTINGS_SaveChannel(MR_CHANNEL_FIRST + i, 0, gRxVfo, 2); - } + #ifdef ENABLE_FEAT_F4HWN_RESET_CHANNEL + // set the first few memory channels + for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++) + { + const uint32_t Frequency = gDefaultFrequencyTable[i]; + gRxVfo->freq_config_RX.Frequency = Frequency; + gRxVfo->freq_config_TX.Frequency = Frequency; + gRxVfo->Band = FREQUENCY_GetBand(Frequency); + SETTINGS_SaveChannel(MR_CHANNEL_FIRST + i, 0, gRxVfo, 2); + } + #endif #ifdef ENABLE_FEAT_F4HWN EEPROM_WriteBuffer(0x1FF0, Template); @@ -609,8 +625,17 @@ void SETTINGS_SaveSettings(void) State[5] = gEeprom.BACKLIGHT_TIME; #endif - State[6] = gEeprom.TAIL_TONE_ELIMINATION; - State[7] = gEeprom.VFO_OPEN; + #ifdef ENABLE_FEAT_F4HWN_NARROWER + State[6] = (gEeprom.TAIL_TONE_ELIMINATION & 0x01) | ((gSetting_set_nfm & 0x03) << 1); + #else + State[6] = gEeprom.TAIL_TONE_ELIMINATION; + #endif + + #ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN + State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) | ((gEeprom.SCAN_LIST_DEFAULT & 0x07) << 4); + #else + State[7] = gEeprom.VFO_OPEN; + #endif EEPROM_WriteBuffer(0x0E78, State); State[0] = gEeprom.BEEP_CONTROL; @@ -770,6 +795,10 @@ void SETTINGS_SaveSettings(void) EEPROM_WriteBuffer(0x1FF0, State); #endif + +#ifdef ENABLE_FEAT_F4HWN_VOL + SETTINGS_WriteCurrentVol(); +#endif } void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode) @@ -960,4 +989,25 @@ State[1] = 0 #endif ; EEPROM_WriteBuffer(0x1FF0, State); -} \ No newline at end of file +} + +#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN + void SETTINGS_WriteCurrentState(void) + { + uint8_t State[8]; + EEPROM_ReadBuffer(0x0E78, State, sizeof(State)); + //State[3] = (gEeprom.CURRENT_STATE << 4) | (gEeprom.BATTERY_SAVE & 0x0F); + State[7] = (gEeprom.VFO_OPEN & 0x01) | ((gEeprom.CURRENT_STATE & 0x07) << 1) | ((gEeprom.SCAN_LIST_DEFAULT & 0x07) << 4); + EEPROM_WriteBuffer(0x0E78, State); + } +#endif + +#ifdef ENABLE_FEAT_F4HWN_VOL + void SETTINGS_WriteCurrentVol(void) + { + uint8_t State[8]; + EEPROM_ReadBuffer(0x1F88, State, sizeof(State)); + State[6] = gEeprom.VOLUME_GAIN; + EEPROM_WriteBuffer(0x1F88, State); + } +#endif diff --git a/settings.h b/settings.h index cd26363..d104b2b 100644 --- a/settings.h +++ b/settings.h @@ -204,6 +204,10 @@ typedef struct { bool SCAN_LIST_ENABLED[3]; uint8_t SCANLIST_PRIORITY_CH1[3]; uint8_t SCANLIST_PRIORITY_CH2[3]; +#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN + uint8_t CURRENT_STATE; + uint8_t CURRENT_LIST; +#endif uint8_t field29_0x26; uint8_t field30_0x27; @@ -301,5 +305,10 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration); void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, bool check, bool save); void SETTINGS_WriteBuildOptions(void); - +#ifdef ENABLE_FEAT_F4HWN_RESTORE_SCAN + void SETTINGS_WriteCurrentState(void); +#endif +#ifdef ENABLE_FEAT_F4HWN_VOL + void SETTINGS_WriteCurrentVol(void); +#endif #endif diff --git a/ui/main.c b/ui/main.c index 321f54a..b9d7c04 100644 --- a/ui/main.c +++ b/ui/main.c @@ -1276,16 +1276,36 @@ void UI_DisplayMain(void) #endif #if ENABLE_FEAT_F4HWN - if (isMainOnly(true)) - { - const char *bandWidthNames[] = {"W", "N"}; - UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], LCD_WIDTH + 80, 0, line + 1); - } - else - { - const char *bandWidthNames[] = {"WIDE", "NAR"}; - GUI_DisplaySmallest(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], 91, line == 0 ? 17 : 49, false, true); - } + #ifdef ENABLE_FEAT_F4HWN_NARROWER + bool narrower = 0; + + if(vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW && gSetting_set_nfm == 1) + { + narrower = 1; + } + + if (isMainOnly(true)) + { + const char *bandWidthNames[] = {"W", "N", "N+"}; + UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], LCD_WIDTH + 80, 0, line + 1); + } + else + { + const char *bandWidthNames[] = {"WIDE", "NAR", "NAR+"}; + GUI_DisplaySmallest(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH + narrower], 91, line == 0 ? 17 : 49, false, true); + } + #else + if (isMainOnly(true)) + { + const char *bandWidthNames[] = {"W", "N"}; + UI_PrintStringSmallNormal(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], LCD_WIDTH + 80, 0, line + 1); + } + else + { + const char *bandWidthNames[] = {"WIDE", "NAR"}; + GUI_DisplaySmallest(bandWidthNames[vfoInfo->CHANNEL_BANDWIDTH], 91, line == 0 ? 17 : 49, false, true); + } + #endif #else if (vfoInfo->CHANNEL_BANDWIDTH == BANDWIDTH_NARROW) UI_PrintStringSmallNormal("N", LCD_WIDTH + 70, 0, line + 1); diff --git a/ui/menu.c b/ui/menu.c index 633f20b..7a4d2d2 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -138,18 +138,24 @@ const t_menu_item MenuList[] = {"Sql", MENU_SQL }, #ifdef ENABLE_FEAT_F4HWN {"SetPwr", MENU_SET_PWR }, - {"SetPtt", MENU_SET_PTT }, - {"SetTot", MENU_SET_TOT }, - {"SetEot", MENU_SET_EOT }, + {"SetPTT", MENU_SET_PTT }, + {"SetTOT", MENU_SET_TOT }, + {"SetEOT", MENU_SET_EOT }, {"SetCtr", MENU_SET_CTR }, {"SetInv", MENU_SET_INV }, {"SetLck", MENU_SET_LCK }, {"SetMet", MENU_SET_MET }, - {"SetGui", MENU_SET_GUI }, + {"SetGUI", MENU_SET_GUI }, {"SetTmr", MENU_SET_TMR }, #ifdef ENABLE_FEAT_F4HWN_SLEEP {"SetOff", MENU_SET_OFF }, #endif +#ifdef ENABLE_FEAT_F4HWN_NARROWER + {"SetNFM", MENU_SET_NFM }, +#endif +#ifdef ENABLE_FEAT_F4HWN_VOL + {"SetVol", MENU_SET_VOL }, +#endif #endif // hidden menu items from here on // enabled if pressing both the PTT and upper side button at power-on @@ -206,15 +212,6 @@ const char gSubMenu_OFF_ON[][4] = "ON" }; -const char gSubMenu_SAVE[][4] = -{ - "OFF", - "1:1", - "1:2", - "1:3", - "1:4" -}; - const char* const gSubMenu_RXMode[] = { "MAIN\nONLY", // TX and RX on main only @@ -390,6 +387,14 @@ const char gSubMenu_SCRAMBLER[][7] = "TINY", "CLASSIC" }; + + #ifdef ENABLE_FEAT_F4HWN_NARROWER + const char gSubMenu_SET_NFM[][9] = + { + "NARROW", + "NARROWER" + }; + #endif #endif const t_sidefunction gSubMenu_SIDEFUNCTIONS[] = @@ -664,10 +669,7 @@ void UI_DisplayMenu(void) #ifdef ENABLE_VOX case MENU_VOX: - if (gSubMenuSelection == 0) - strcpy(String, "OFF"); - else - sprintf(String, "%d", gSubMenuSelection); + sprintf(String, gSubMenuSelection == 0 ? "OFF" : "%u", gSubMenuSelection); break; #endif @@ -813,7 +815,7 @@ void UI_DisplayMenu(void) } case MENU_SAVE: - strcpy(String, gSubMenu_SAVE[gSubMenuSelection]); + sprintf(String, gSubMenuSelection == 0 ? "OFF" : "1:%u", gSubMenuSelection); break; case MENU_TDR: @@ -850,10 +852,7 @@ void UI_DisplayMenu(void) break; case MENU_RP_STE: - if (gSubMenuSelection == 0) - strcpy(String, "OFF"); - else - sprintf(String, "%d*100ms", gSubMenuSelection); + sprintf(String, gSubMenuSelection == 0 ? "OFF" : "%u*100ms", gSubMenuSelection); break; case MENU_S_LIST: @@ -1045,6 +1044,23 @@ void UI_DisplayMenu(void) strcpy(String, gSubMenu_SET_MET[gSubMenuSelection]); // Same as SET_MET break; + #ifdef ENABLE_FEAT_F4HWN_NARROWER + case MENU_SET_NFM: + strcpy(String, gSubMenu_SET_NFM[gSubMenuSelection]); + break; + #endif + + #ifdef ENABLE_FEAT_F4HWN_VOL + case MENU_SET_VOL: + sprintf(String, gSubMenuSelection == 0 ? "OFF" : "%02u", gSubMenuSelection); + gEeprom.VOLUME_GAIN = gSubMenuSelection; + BK4819_WriteRegister(BK4819_REG_48, + (11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference + ( 0u << 10) | // AF Rx Gain-1 + (gEeprom.VOLUME_GAIN << 4) | // AF Rx Gain-2 + (gEeprom.DAC_GAIN << 0)); // AF DAC Gain (after Gain-1 and Gain-2) + break; + #endif #endif } diff --git a/ui/menu.h b/ui/menu.h index c5192c7..b7efb20 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -141,6 +141,12 @@ enum MENU_SET_MET, MENU_SET_GUI, MENU_SET_TMR, + #ifdef ENABLE_FEAT_F4HWN_NARROWER + MENU_SET_NFM, + #endif + #ifdef ENABLE_FEAT_F4HWN_VOL + MENU_SET_VOL, + #endif #endif MENU_BATCAL, // battery voltage calibration MENU_F1SHRT, @@ -158,7 +164,6 @@ extern const char gSubMenu_TXP[8][6]; extern const char gSubMenu_SFT_D[3][4]; extern const char gSubMenu_W_N[2][7]; extern const char gSubMenu_OFF_ON[2][4]; -extern const char gSubMenu_SAVE[5][4]; extern const char gSubMenu_TOT[11][7]; extern const char* const gSubMenu_RXMode[4]; @@ -179,6 +184,9 @@ extern const char gSubMenu_D_RSP[4][11]; extern const char gSubMenu_SET_TOT[4][7]; extern const char gSubMenu_SET_LCK[2][9]; extern const char gSubMenu_SET_MET[2][8]; + #ifdef ENABLE_FEAT_F4HWN_NARROWER + extern const char gSubMenu_SET_NFM[2][9]; + #endif #endif extern const char* const gSubMenu_PTT_ID[5];