diff --git a/Makefile b/Makefile index d72c3e1..040095e 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # 1 = enable # ---- STOCK QUANSHENG FERATURES ---- -ENABLE_FMRADIO ?= 1 +ENABLE_FMRADIO ?= 0 ENABLE_UART ?= 1 ENABLE_AIRCOPY ?= 0 ENABLE_NOAA ?= 0 @@ -213,7 +213,7 @@ ifeq ($(ENABLE_FEAT_F4HWN),1) VERSION_STRING_1 ?= v0.22 AUTHOR_STRING_2 ?= F4HWN - VERSION_STRING_2 ?= v2.8.1 + VERSION_STRING_2 ?= v3.0 AUTHOR_STRING ?= $(AUTHOR_STRING_1)+$(AUTHOR_STRING_2) VERSION_STRING ?= $(VERSION_STRING_2) diff --git a/README.md b/README.md index 5154328..1f73b52 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * improve default power settings level (Low ~125mW, Mid ~2W and High ~5W), * improve s-meter (IARU recommandations), +* improve bandscope (Spectrum Analyser) and add channel name, * improve UI: * menu index is always visible, even if a menu is selected, * s-meter new design (Classic or Tiny), @@ -56,8 +57,9 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * move BatTxt menu from 34/63 to 30/63 (just after BatSave menu 29/63), * rename BackLt to BLTime, * rename BltTRX to BLTxRx, + * improve memory channel input, * and more... -* new menu entries: +* new menu entries and changes: * add SetLow menu to set low power (<20mW, 125mW, 250mW, 500mW and 1W), * add SetPtt menu to set PTT mode (Classic or OnePush), * add SetTot menu to set TOT alert (Off, Sound, Visual, All), @@ -71,11 +73,27 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * improve PonMsg menu, * improve BackLt menu, * improve TxTOut menu, -* improve status bar, + * add PMR 446 F Lock band, + * add HAM CA F Lock band (for Canadian zone), + * add GMRS/FRS/MURS F Lock (for North America zone), + * remove blink and SOS functionality, + * remove AM Fix menu (AM Fix is ENABLED by default). +* improve status bar: * add SetPtt mode in status bar, * change font and bitmaps, * move USB icon to left of battery information, * add RX and TX timers, +* improve lists and scan lists options: + * add new list 3 + * add new list 0 (channel without list...) + * add new scan lists options + * scan list 0 (all channels without list) + * scan list 1 + * scan list 2 + * scan list 3 + * scan lists [1, 2, 3] + * scan all (all channels with ou without list) + * add scan list shortcuts * new actions: * RX MODE, * MAIN ONLY, @@ -87,7 +105,8 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * add the F + F1 or F + F2 key combination to dynamically change the Step, * add F + 8 to quickly switch backlight between BLMin and BLMax on demand (this bypass BackLt strategy), * add F + 9 to return to BackLt strategy, - * add long press on MENU, in * SCAN mode, to temporarily exclude a memory channel if (not working with * SCAN ALL). + * add long press on MENU, in * SCAN mode, to temporarily exclude a memory channel if (not working with * SCAN ALL), + * add short press on [0, 1, 2, 3, 4 or 5], in * SCAN mode, to dynamically change scan list. * many fix: * squelch, * s-meter, @@ -95,12 +114,11 @@ Special thanks to Jean-Cyrille F6IWW, Fabrice 14RC123, David F4BPP, Olivier 14RC * scan list 2 ignored, * scan range limit, * clean display on startup, + * no more PWM noise, * and more... * disabled ENABLE_DTMF_CALLING, * disabled SCRAMBLER, * unlock TX on all bands needs only to be repeat 3 times, -* add PMR 446 F Lock band, -* remove blink and SOS functionality, * code refactoring and many memory optimization, * and more... diff --git a/app/action.c b/app/action.c index 59ceaf4..5edad84 100644 --- a/app/action.c +++ b/app/action.c @@ -219,7 +219,7 @@ void ACTION_Scan(bool bRestart) } // channel mode. Keep scanning but toggle between scan lists - gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3; + gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 6; // jump to the next channel CHFRSCANNER_Start(false, gScanStateDir); diff --git a/app/app.c b/app/app.c index 8de5ab0..2ebad56 100644 --- a/app/app.c +++ b/app/app.c @@ -1466,6 +1466,12 @@ void APP_TimeSlice500ms(void) { if (--gKeyInputCountdown == 0) { + + if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE) && (gInputBoxIndex == 1 || gInputBoxIndex == 2)) + { + SETTINGS_SaveVfoIndices(); + } + cancelUserInputModes(); if (gBeepToPlay != BEEP_NONE) @@ -1474,6 +1480,20 @@ void APP_TimeSlice500ms(void) gBeepToPlay = BEEP_NONE; } } + else + { + if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering channel number + switch (gInputBoxIndex) + { + case 1: + channelMove(gInputBox[0] - 1, false); + break; + case 2: + channelMove(((gInputBox[0] * 10) + gInputBox[1]) - 1, false); + break; + } + } + } } if (gDTMF_RX_live_timeout > 0) @@ -1849,7 +1869,8 @@ static void ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } if (Key <= KEY_9 || Key == KEY_F) { - if (gScanStateDir != SCAN_OFF || gCssBackgroundScan) { // FREQ/CTCSS/DCS scanning + //if (gScanStateDir != SCAN_OFF || gCssBackgroundScan) { // FREQ/CTCSS/DCS scanning + if (gCssBackgroundScan) { // FREQ/CTCSS/DCS scanning if (bKeyPressed && !bKeyHeld) AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL); return; diff --git a/app/chFrScanner.c b/app/chFrScanner.c index 6aba97c..a2904a3 100644 --- a/app/chFrScanner.c +++ b/app/chFrScanner.c @@ -4,6 +4,7 @@ #include "functions.h" #include "misc.h" #include "settings.h" +//#include "debugging.h" int8_t gScanStateDir; bool gScanKeepResult; @@ -194,12 +195,14 @@ static void NextFreqChannel(void) static void NextMemChannel(void) { static unsigned int prev_mr_chan = 0; - const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true; - const int chan1 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT] : -1; - const int chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1; + const bool enabled = (gEeprom.SCAN_LIST_DEFAULT > 0 && gEeprom.SCAN_LIST_DEFAULT < 4) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT - 1] : true; + const int chan1 = (gEeprom.SCAN_LIST_DEFAULT > 0 && gEeprom.SCAN_LIST_DEFAULT < 4) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT - 1] : -1; + const int chan2 = (gEeprom.SCAN_LIST_DEFAULT > 0 && gEeprom.SCAN_LIST_DEFAULT < 4) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT - 1] : -1; const unsigned int prev_chan = gNextMrChannel; unsigned int chan = 0; + //char str[64] = ""; + if (enabled) { switch (currentScanList) @@ -207,28 +210,49 @@ static void NextMemChannel(void) case SCAN_NEXT_CHAN_SCANLIST1: prev_mr_chan = gNextMrChannel; + //sprintf(str, "-> Chan1 %d\n", chan1 + 1); + //LogUart(str); + if (chan1 >= 0) { - if (RADIO_CheckValidChannel(chan1, false, 0)) + if (RADIO_CheckValidChannel(chan1, false, gEeprom.SCAN_LIST_DEFAULT)) { currentScanList = SCAN_NEXT_CHAN_SCANLIST1; gNextMrChannel = chan1; break; } } + [[fallthrough]]; case SCAN_NEXT_CHAN_SCANLIST2: + + //sprintf(str, "-> Chan2 %d\n", chan2 + 1); + //LogUart(str); + if (chan2 >= 0) { - if (RADIO_CheckValidChannel(chan2, false, 0)) + if (RADIO_CheckValidChannel(chan2, false, gEeprom.SCAN_LIST_DEFAULT)) { currentScanList = SCAN_NEXT_CHAN_SCANLIST2; gNextMrChannel = chan2; break; } } + [[fallthrough]]; - + /* + case SCAN_NEXT_CHAN_SCANLIST3: + if (chan3 >= 0) + { + if (RADIO_CheckValidChannel(chan3, false, 0)) + { + currentScanList = SCAN_NEXT_CHAN_SCANLIST3; + gNextMrChannel = chan3; + break; + } + } + [[fallthrough]]; + */ // this bit doesn't yet work if the other VFO is a frequency case SCAN_NEXT_CHAN_DUAL_WATCH: // dual watch is enabled - include the other VFO in the scan @@ -255,13 +279,16 @@ static void NextMemChannel(void) if (!enabled || chan == 0xff) { - chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT); + chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 5) ? true : false, gEeprom.SCAN_LIST_DEFAULT); if (chan == 0xFF) { // no valid channel found chan = MR_CHANNEL_FIRST; } gNextMrChannel = chan; + + //sprintf(str, "----> Chan %d\n", chan + 1); + //LogUart(str); } if (gNextMrChannel != prev_chan) diff --git a/app/main.c b/app/main.c index 5e08a1f..821e15d 100644 --- a/app/main.c +++ b/app/main.c @@ -59,11 +59,21 @@ static void toggle_chan_scanlist(void) return; } + /* if (gTxVfo->SCANLIST1_PARTICIPATION ^ gTxVfo->SCANLIST2_PARTICIPATION){ gTxVfo->SCANLIST2_PARTICIPATION = gTxVfo->SCANLIST1_PARTICIPATION; } else { gTxVfo->SCANLIST1_PARTICIPATION = !gTxVfo->SCANLIST1_PARTICIPATION; } + */ + + uint8_t scanTmp = gTxVfo->SCANLIST1_PARTICIPATION | (gTxVfo->SCANLIST2_PARTICIPATION << 1) | (gTxVfo->SCANLIST3_PARTICIPATION << 2); + + scanTmp = (scanTmp++ < 7) ? scanTmp: 0; + + gTxVfo->SCANLIST1_PARTICIPATION = (scanTmp >> 0) & 0x01; + gTxVfo->SCANLIST2_PARTICIPATION = (scanTmp >> 1) & 0x01; + gTxVfo->SCANLIST3_PARTICIPATION = (scanTmp >> 2) & 0x01; SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true, true); @@ -306,6 +316,38 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) } } +void channelMove(uint16_t Channel, bool End) +{ + const uint8_t Vfo = gEeprom.TX_VFO; + + if(End) + { + gInputBoxIndex = 0; + } + + if (!RADIO_CheckValidChannel(Channel, false, 0)) { + gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; + return; + } + + #ifdef ENABLE_VOICE + gAnotherVoiceID = (VOICE_ID_t)Key; + #endif + + gEeprom.MrChannel[Vfo] = (uint8_t)Channel; + gEeprom.ScreenChannel[Vfo] = (uint8_t)Channel; + //gRequestSaveVFO = true; + gVfoConfigureMode = VFO_CONFIGURE_RELOAD; + + RADIO_ConfigureChannel(gEeprom.TX_VFO, gVfoConfigureMode); + if(End) + { + SETTINGS_SaveVfoIndices(); + } + + return; +} + static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) { if (bKeyHeld) { // key held down @@ -332,6 +374,33 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } if (!gWasFKeyPressed) { // F-key wasn't pressed + + if (gScanStateDir != SCAN_OFF){ + switch(Key) { + case KEY_0: + gEeprom.SCAN_LIST_DEFAULT = 0; + break; + case KEY_1: + gEeprom.SCAN_LIST_DEFAULT = 1; + break; + case KEY_2: + gEeprom.SCAN_LIST_DEFAULT = 2; + break; + case KEY_3: + gEeprom.SCAN_LIST_DEFAULT = 3; + break; + case KEY_4: + gEeprom.SCAN_LIST_DEFAULT = 4; + break; + case KEY_5: + gEeprom.SCAN_LIST_DEFAULT = 5; + break; + default: + break; + } + return; + } + const uint8_t Vfo = gEeprom.TX_VFO; gKeyInputCountdown = key_input_timeout_500ms; INPUTBOX_Append(Key); @@ -339,6 +408,8 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) { // user is entering channel number + gKeyInputCountdown = (key_input_timeout_500ms / 5); // short time... + if (gInputBoxIndex != 3) { #ifdef ENABLE_VOICE gAnotherVoiceID = (VOICE_ID_t)Key; @@ -347,25 +418,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) return; } - gInputBoxIndex = 0; - - const uint16_t Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1; - - if (!RADIO_CheckValidChannel(Channel, false, 0)) { - gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; - return; - } - - #ifdef ENABLE_VOICE - gAnotherVoiceID = (VOICE_ID_t)Key; - #endif - - gEeprom.MrChannel[Vfo] = (uint8_t)Channel; - gEeprom.ScreenChannel[Vfo] = (uint8_t)Channel; - gRequestSaveVFO = true; - gVfoConfigureMode = VFO_CONFIGURE_RELOAD; - - return; + channelMove(((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1, true); } // #ifdef ENABLE_NOAA @@ -538,8 +591,6 @@ static void MAIN_Key_EXIT(bool bKeyPressed, 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; @@ -547,21 +598,20 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld) if (bKeyPressed) { // long press MENU key #ifdef ENABLE_FEAT_F4HWN - if(gScanStateDir != SCAN_OFF && gEeprom.SCAN_LIST_DEFAULT < 2) + // Exclude work with list 1, 2, 3 or all list + if(gScanStateDir != SCAN_OFF && (gEeprom.SCAN_LIST_DEFAULT > 0 && gEeprom.SCAN_LIST_DEFAULT < 5)) { if(FUNCTION_IsRx()) { gTxVfo->SCANLIST1_PARTICIPATION = 0; gTxVfo->SCANLIST2_PARTICIPATION = 0; + gTxVfo->SCANLIST3_PARTICIPATION = 0; SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, true, false); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; - //block++; - //gDebug = block; - lastFoundFrqOrChan = lastFoundFrqOrChanOld; CHFRSCANNER_ContinueScanning(); @@ -678,7 +728,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) gRequestDisplayScreen = DISPLAY_SCANNER; } - gPttWasReleased = true; + //gPttWasReleased = true; Fixed issue #138 gUpdateStatus = true; } diff --git a/app/main.h b/app/main.h index f679aac..ddcc9ff 100644 --- a/app/main.h +++ b/app/main.h @@ -20,6 +20,7 @@ #include "driver/keyboard.h" void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld); +void channelMove(uint16_t Channel, bool End); #endif diff --git a/app/menu.c b/app/menu.c index ebd6107..8916f7d 100644 --- a/app/menu.c +++ b/app/menu.c @@ -225,8 +225,10 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) *pMax = ARRAY_SIZE(gSubMenu_RX_TX) - 1; break; - #ifdef ENABLE_AM_FIX - case MENU_AM_FIX: + #ifndef ENABLE_FEAT_F4HWN + #ifdef ENABLE_AM_FIX + case MENU_AM_FIX: + #endif #endif #ifdef ENABLE_AUDIO_BAR case MENU_MIC_BAR: @@ -236,6 +238,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_AUTOLK: case MENU_S_ADD1: case MENU_S_ADD2: + case MENU_S_ADD3: case MENU_STE: case MENU_D_ST: #ifdef ENABLE_DTMF_CALLING @@ -291,6 +294,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_SLIST1: case MENU_SLIST2: + case MENU_SLIST3: *pMin = -1; *pMax = MR_CHANNEL_LAST; break; @@ -307,7 +311,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_S_LIST: //*pMin = 0; - *pMax = 2; + *pMax = 5; break; #ifdef ENABLE_DTMF_CALLING @@ -636,6 +640,13 @@ void MENU_AcceptSetting(void) gFlagResetVfos = true; return; + case MENU_S_ADD3: + gTxVfo->SCANLIST3_PARTICIPATION = gSubMenuSelection; + SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, false, true); + gVfoConfigureMode = VFO_CONFIGURE; + gFlagResetVfos = true; + return; + case MENU_STE: gEeprom.TAIL_TONE_ELIMINATION = gSubMenuSelection; break; @@ -748,12 +759,14 @@ void MENU_AcceptSetting(void) gRequestSaveChannel = 1; return; - #ifdef ENABLE_AM_FIX - case MENU_AM_FIX: - gSetting_AM_fix = gSubMenuSelection; - gVfoConfigureMode = VFO_CONFIGURE_RELOAD; - gFlagResetVfos = true; - break; + #ifndef ENABLE_FEAT_F4HWN + #ifdef ENABLE_AM_FIX + case MENU_AM_FIX: + gSetting_AM_fix = gSubMenuSelection; + gVfoConfigureMode = VFO_CONFIGURE_RELOAD; + gFlagResetVfos = true; + break; + #endif #endif #ifdef ENABLE_NOAA @@ -1083,6 +1096,10 @@ void MENU_ShowCurrentSetting(void) gSubMenuSelection = gTxVfo->SCANLIST2_PARTICIPATION; break; + case MENU_S_ADD3: + gSubMenuSelection = gTxVfo->SCANLIST3_PARTICIPATION; + break; + case MENU_STE: gSubMenuSelection = gEeprom.TAIL_TONE_ELIMINATION; break; @@ -1114,11 +1131,15 @@ void MENU_ShowCurrentSetting(void) break; case MENU_SLIST1: - gSubMenuSelection = RADIO_FindNextChannel(0, 1, true, 0); + gSubMenuSelection = RADIO_FindNextChannel(0, 1, true, 1); break; case MENU_SLIST2: - gSubMenuSelection = RADIO_FindNextChannel(0, 1, true, 1); + gSubMenuSelection = RADIO_FindNextChannel(0, 1, true, 2); + break; + + case MENU_SLIST3: + gSubMenuSelection = RADIO_FindNextChannel(0, 1, true, 3); break; #ifdef ENABLE_ALARM @@ -1177,11 +1198,14 @@ void MENU_ShowCurrentSetting(void) gSubMenuSelection = gTxVfo->Modulation; break; -#ifdef ENABLE_AM_FIX - case MENU_AM_FIX: - gSubMenuSelection = gSetting_AM_fix; - break; +#ifndef ENABLE_FEAT_F4HWN + #ifdef ENABLE_AM_FIX + case MENU_AM_FIX: + gSubMenuSelection = gSetting_AM_fix; + break; + #endif #endif + #ifdef ENABLE_NOAA case MENU_NOAA_S: gSubMenuSelection = gEeprom.NOAA_AUTO_SCAN; @@ -1797,10 +1821,16 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction) bCheckScanList = false; break; + case MENU_SLIST3: + bCheckScanList = true; + VFO = 3; + break; case MENU_SLIST2: - VFO = 1; - [[fallthrough]]; + bCheckScanList = true; + VFO = 2; + break; case MENU_SLIST1: + VFO = 1; bCheckScanList = true; break; diff --git a/app/spectrum.c b/app/spectrum.c index 5053a3f..3edecc0 100644 --- a/app/spectrum.c +++ b/app/spectrum.c @@ -66,7 +66,7 @@ static uint16_t blacklistFreqs[15]; static uint8_t blacklistFreqsIdx; #endif -const char *bwOptions[] = {" 25k", "12.5k", "6.25k"}; +const char *bwOptions[] = {"25", "12.5", "6.25"}; const uint8_t modulationTypeTuneSteps[] = {100, 50, 10}; const uint8_t modTypeReg47Values[] = {1, 7, 5}; @@ -671,9 +671,10 @@ static void Blacklist() { #ifdef ENABLE_SCAN_RANGES static bool IsBlacklisted(uint16_t idx) { - for(uint8_t i = 0; i < ARRAY_SIZE(blacklistFreqs); i++) - if(blacklistFreqs[i] == idx) - return true; + if(blacklistFreqs[0]) // cheaper than checking blacklistFreqsIdx + for(uint8_t i = 0; i < ARRAY_SIZE(blacklistFreqs); i++) + if(blacklistFreqs[i] == idx) + return true; return false; } #endif @@ -778,7 +779,7 @@ static void DrawF(uint32_t f) { sprintf(String, "%3s", gModulationStr[settings.modulationType]); GUI_DisplaySmallest(String, 116, 1, false, true); - sprintf(String, "%s", bwOptions[settings.listenBw]); + sprintf(String, "%4sk", bwOptions[settings.listenBw]); GUI_DisplaySmallest(String, 108, 7, false, true); #ifndef ENABLE_FMRADIO diff --git a/archive/f4hwn.bandscope.packed.v3.0.bin b/archive/f4hwn.bandscope.packed.v3.0.bin new file mode 100644 index 0000000..d8843a5 Binary files /dev/null and b/archive/f4hwn.bandscope.packed.v3.0.bin differ diff --git a/archive/f4hwn.broadcast.packed.v3.0.bin b/archive/f4hwn.broadcast.packed.v3.0.bin new file mode 100644 index 0000000..f8fd192 Binary files /dev/null and b/archive/f4hwn.broadcast.packed.v3.0.bin differ diff --git a/bitmaps.c b/bitmaps.c index a84009a..f127623 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -38,19 +38,6 @@ const uint8_t gFontKeyLock[1][9] = {0x7c, 0x46, 0x45, 0x45, 0x45, 0x45, 0x45, 0x46, 0x7c} }; -const uint8_t gFontScanAll[9] = -{ - 0b00111110, - 0b01000001, - 0b01000001, - 0b00100010, - 0b00011100, - 0b00100010, - 0b01000001, - 0b01000001, - 0b00111110 -}; - const uint8_t gFontLight[9] = { 0b00001100, @@ -172,8 +159,53 @@ const uint8_t BITMAP_VFO_NotDefault[8] = 0b00001000 }; +const uint8_t BITMAP_ScanList0[7] = +{ // '0' symbol + 0b01111111, + 0b01111111, + 0b01000011, + 0b01011101, + 0b01100001, + 0b01111111, + 0b01111111 +}; + const uint8_t BITMAP_ScanList1[7] = -{ // 'I' symbol +{ // '1' symbol + 0b01111111, + 0b01111111, + 0b01111011, + 0b01000001, + 0b01111111, + 0b01111111, + 0b01111111 +}; + +const uint8_t BITMAP_ScanList2[7] = +{ // '2' symbol + 0b01111111, + 0b01111111, + 0b01001101, + 0b01010101, + 0b01011011, + 0b01111111, + 0b01111111 +}; + +const uint8_t BITMAP_ScanList3[7] = +{ // '3' symbol + 0b01111111, + 0b01111111, + 0b01011101, + 0b01010101, + 0b01101011, + 0b01111111, + 0b01111111 +}; + +const uint8_t BITMAP_ScanList123[19] = +{ + // 'All' symbol 0b01111111, 0b01111111, 0b01111011, @@ -181,17 +213,42 @@ const uint8_t BITMAP_ScanList1[7] = 0b01111111, 0b01111111, 0b01111111, -}; - -const uint8_t BITMAP_ScanList2[7] = -{ // 'II' symbol - 0b01111111, 0b01111111, 0b01001101, 0b01010101, 0b01011011, 0b01111111, 0b01111111, + 0b01111111, + 0b01011101, + 0b01010101, + 0b01101011, + 0b01111111, + 0b01111111 +}; + +const uint8_t BITMAP_ScanListAll[19] = +{ + // 'All' symbol + 0b01111111, + 0b01111111, + 0b01000011, + 0b01110101, + 0b01000011, + 0b01111111, + 0b01111111, + 0b01111111, + 0b01000001, + 0b01011111, + 0b01011111, + 0b01111111, + 0b01111111, + 0b01111111, + 0b01000001, + 0b01011111, + 0b01011111, + 0b01111111, + 0b01111111 }; const uint8_t BITMAP_compand[6] = diff --git a/bitmaps.h b/bitmaps.h index c8f4181..836c02f 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -11,7 +11,6 @@ extern const uint8_t gFontF[1][8]; extern const uint8_t gFontS[1][6]; extern const uint8_t gFontKeyLock[1][9]; -extern const uint8_t gFontScanAll[9]; extern const uint8_t gFontLight[9]; extern const uint8_t gFontXB[2][6]; @@ -31,8 +30,12 @@ extern const uint8_t BITMAP_Ready[7]; extern const uint8_t BITMAP_Antenna[5]; extern const uint8_t BITMAP_VFO_Default[8]; extern const uint8_t BITMAP_VFO_NotDefault[8]; +extern const uint8_t BITMAP_ScanList0[7]; extern const uint8_t BITMAP_ScanList1[7]; extern const uint8_t BITMAP_ScanList2[7]; +extern const uint8_t BITMAP_ScanList3[7]; +extern const uint8_t BITMAP_ScanList123[19]; +extern const uint8_t BITMAP_ScanListAll[19]; extern const uint8_t BITMAP_compand[6]; #ifndef ENABLE_CUSTOM_MENU_LAYOUT diff --git a/driver/backlight.c b/driver/backlight.c index 31488c5..b6544ed 100644 --- a/driver/backlight.c +++ b/driver/backlight.c @@ -146,8 +146,11 @@ static uint8_t currentBrightness; void BACKLIGHT_SetBrightness(uint8_t brigtness) { + const uint8_t value[] = {0, 3, 6, 9, 15, 24, 38, 62, 100, 159, 255}; + currentBrightness = brigtness; - PWM_PLUS0_CH0_COMP = (1 << brigtness) - 1; + PWM_PLUS0_CH0_COMP = value[brigtness] * 4; + //PWM_PLUS0_CH0_COMP = (1 << brigtness) - 1; //PWM_PLUS0_SWLOAD = 1; } diff --git a/frequencies.c b/frequencies.c index ff8a494..1798cf3 100644 --- a/frequencies.c +++ b/frequencies.c @@ -227,6 +227,29 @@ int32_t TX_freq_check(const uint32_t Frequency) if (Frequency >= 44600625 && Frequency <= 44619375) return 0; break; + + case F_LOCK_GMRS_FRS_MURS: + // https://forums.radioreference.com/threads/the-great-unofficial-radioreference-frs-gmrs-murs-fact-sheet.275370/ + if (Frequency >= 46256250 && Frequency <= 46271250) // FRS/GMRS + return 0; + if (Frequency >= 46756250 && Frequency <= 46771250) // FRS ONLY + return 0; + if (Frequency >= 46255000 && Frequency <= 46272500) // GMRS ONLY + return 0; + if (Frequency == 15182000 || + Frequency == 15188000 || + Frequency == 15194000 || + Frequency == 15457000 || + Frequency == 15460000) // MURS + return 0; + break; + + case F_LOCK_CA: + if (Frequency >= 14400000 && Frequency < 14800000) + return 0; + if (Frequency >= 43000000 && Frequency < 45000000) + return 0; + break; #endif case F_LOCK_ALL: diff --git a/misc.c b/misc.c index 0c2daf8..70c151a 100644 --- a/misc.c +++ b/misc.c @@ -101,7 +101,7 @@ bool gSetting_ScrambleEnable; enum BacklightOnRxTx_t gSetting_backlight_on_tx_rx; #ifdef ENABLE_AM_FIX - bool gSetting_AM_fix; + bool gSetting_AM_fix = true; #endif #ifdef ENABLE_FEAT_F4HWN diff --git a/misc.h b/misc.h index 5d128cb..eab114a 100644 --- a/misc.h +++ b/misc.h @@ -195,10 +195,11 @@ extern uint16_t gEEPROM_1F8C; typedef union { struct { uint8_t - band : 4, + band : 3, compander : 2, + scanlist1 : 1, scanlist2 : 1, - scanlist1 : 1; + scanlist3 : 1; }; uint8_t __val; } ChannelAttributes_t; diff --git a/radio.c b/radio.c index a4c45f8..2b8315a 100644 --- a/radio.c +++ b/radio.c @@ -67,14 +67,46 @@ bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanL if (att.band > BAND7_470MHz) return false; - if (!checkScanList || scanList > 1) + if (!checkScanList || scanList > 4) return true; - if (scanList ? !att.scanlist2 : !att.scanlist1) + /* + if(scanList == 0 && (att.scanlist1 == 1 || att.scanlist2 == 1 || att.scanlist3 == 1)) + { return false; + } + else if(scanList == 1 && att.scanlist1 != 1) + { + return false; + } + else if(scanList == 2 && att.scanlist2 != 1) + { + return false; + } + else if(scanList == 3 && att.scanlist3 != 1) + { + return false; + } + else if(scanList == 4 && (att.scanlist1 == 0 && att.scanlist2 == 0 && att.scanlist3 == 0)) + { + return false; + } + */ - const uint8_t PriorityCh1 = gEeprom.SCANLIST_PRIORITY_CH1[scanList]; - const uint8_t PriorityCh2 = gEeprom.SCANLIST_PRIORITY_CH2[scanList]; + if ((scanList == 0 && (att.scanlist1 == 1 || att.scanlist2 == 1 || att.scanlist3 == 1)) || + (scanList == 1 && att.scanlist1 != 1) || + (scanList == 2 && att.scanlist2 != 1) || + (scanList == 3 && att.scanlist3 != 1) || + (scanList == 4 && (att.scanlist1 == 0 && att.scanlist2 == 0 && att.scanlist3 == 0))) { + return false; + } + + //return true; + + // I don't understand what this code is for... + + const uint8_t PriorityCh1 = gEeprom.SCANLIST_PRIORITY_CH1[scanList - 1]; + const uint8_t PriorityCh2 = gEeprom.SCANLIST_PRIORITY_CH2[scanList - 1]; return PriorityCh1 != channel && PriorityCh2 != channel; } @@ -103,6 +135,7 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t pInfo->Band = FREQUENCY_GetBand(Frequency); pInfo->SCANLIST1_PARTICIPATION = false; pInfo->SCANLIST2_PARTICIPATION = false; + pInfo->SCANLIST3_PARTICIPATION = false; pInfo->STEP_SETTING = STEP_12_5kHz; pInfo->StepFrequency = gStepFrequencyTable[pInfo->STEP_SETTING]; pInfo->CHANNEL_SAVE = ChannelSave; @@ -186,19 +219,24 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure bool bParticipation1; bool bParticipation2; + bool bParticipation3; + if (IS_MR_CHANNEL(channel)) { bParticipation1 = att.scanlist1; bParticipation2 = att.scanlist2; + bParticipation3 = att.scanlist3; } else { band = channel - FREQ_CHANNEL_FIRST; bParticipation1 = true; bParticipation2 = true; + bParticipation3 = true; } pVfo->Band = band; pVfo->SCANLIST1_PARTICIPATION = bParticipation1; pVfo->SCANLIST2_PARTICIPATION = bParticipation2; + pVfo->SCANLIST3_PARTICIPATION = bParticipation3; pVfo->CHANNEL_SAVE = channel; uint16_t base; diff --git a/radio.h b/radio.h index 1e1d94e..12e6594 100644 --- a/radio.h +++ b/radio.h @@ -116,6 +116,7 @@ typedef struct VFO_Info_t uint8_t SCANLIST1_PARTICIPATION; uint8_t SCANLIST2_PARTICIPATION; + uint8_t SCANLIST3_PARTICIPATION; uint8_t Band; #ifdef ENABLE_DTMF_CALLING diff --git a/settings.c b/settings.c index d54bcbe..8173698 100644 --- a/settings.c +++ b/settings.c @@ -225,11 +225,33 @@ void SETTINGS_InitEEPROM(void) // 0F18..0F1F EEPROM_ReadBuffer(0x0F18, Data, 8); - gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 3) ? Data[0] : 0; // we now have 'all' channel scan option - for (unsigned int i = 0; i < 2; i++) + gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 5) ? Data[0] : 0; // we now have 'all' channel scan option + + // Fake data + /* + gEeprom.SCAN_LIST_ENABLED[0] = 0; + gEeprom.SCAN_LIST_ENABLED[1] = 0; + gEeprom.SCAN_LIST_ENABLED[2] = 0; + + gEeprom.SCANLIST_PRIORITY_CH1[0] = 0; + gEeprom.SCANLIST_PRIORITY_CH2[0] = 2; + + gEeprom.SCANLIST_PRIORITY_CH1[1] = 14; + gEeprom.SCANLIST_PRIORITY_CH2[1] = 15; + + gEeprom.SCANLIST_PRIORITY_CH1[2] = 40; + gEeprom.SCANLIST_PRIORITY_CH2[2] = 41; + */ + + // Fix me probably after Chirp update... + for (unsigned int i = 0; i < 3; i++) { - const unsigned int j = 1 + (i * 3); - gEeprom.SCAN_LIST_ENABLED[i] = (Data[j + 0] < 2) ? Data[j] : false; + gEeprom.SCAN_LIST_ENABLED[i] = (Data[1] >> i) & 1; + } + + for (unsigned int i = 0; i < 3; i++) + { + const unsigned int j = 1 + (i * 2); gEeprom.SCANLIST_PRIORITY_CH1[i] = Data[j + 1]; gEeprom.SCANLIST_PRIORITY_CH2[i] = Data[j + 2]; } @@ -257,8 +279,10 @@ void SETTINGS_InitEEPROM(void) #ifdef ENABLE_AUDIO_BAR gSetting_mic_bar = !!(Data[7] & (1u << 4)); #endif - #ifdef ENABLE_AM_FIX - gSetting_AM_fix = !!(Data[7] & (1u << 5)); + #ifndef ENABLE_FEAT_F4HWN + #ifdef ENABLE_AM_FIX + gSetting_AM_fix = !!(Data[7] & (1u << 5)); + #endif #endif gSetting_backlight_on_tx_rx = (Data[7] >> 6) & 3u; @@ -274,7 +298,7 @@ void SETTINGS_InitEEPROM(void) ChannelAttributes_t *att = &gMR_ChannelAttributes[i]; if(att->__val == 0xff){ att->__val = 0; - att->band = 0xf; + att->band = 0x7; } } @@ -504,6 +528,8 @@ void SETTINGS_SaveVfoIndices(void) void SETTINGS_SaveSettings(void) { uint8_t State[8]; + uint8_t tmp = 0; + #ifdef ENABLE_PWRON_PASSWORD uint32_t Password[2]; #endif @@ -615,13 +641,23 @@ void SETTINGS_SaveSettings(void) EEPROM_WriteBuffer(0x0ED8, State); State[0] = gEeprom.SCAN_LIST_DEFAULT; - State[1] = gEeprom.SCAN_LIST_ENABLED[0]; + + tmp = 0; + + if (gEeprom.SCAN_LIST_ENABLED[0] == 1) + tmp = tmp | (1 << 0); + if (gEeprom.SCAN_LIST_ENABLED[1] == 1) + tmp = tmp | (1 << 1); + if (gEeprom.SCAN_LIST_ENABLED[2] == 1) + tmp = tmp | (1 << 2); + + State[1] = tmp; State[2] = gEeprom.SCANLIST_PRIORITY_CH1[0]; State[3] = gEeprom.SCANLIST_PRIORITY_CH2[0]; - State[4] = gEeprom.SCAN_LIST_ENABLED[1]; - State[5] = gEeprom.SCANLIST_PRIORITY_CH1[1]; - State[6] = gEeprom.SCANLIST_PRIORITY_CH2[1]; - State[7] = 0xFF; + State[4] = gEeprom.SCANLIST_PRIORITY_CH1[1]; + State[5] = gEeprom.SCANLIST_PRIORITY_CH2[1]; + State[6] = gEeprom.SCANLIST_PRIORITY_CH1[2]; + State[7] = gEeprom.SCANLIST_PRIORITY_CH2[2]; EEPROM_WriteBuffer(0x0F18, State); memset(State, 0xFF, sizeof(State)); @@ -646,8 +682,10 @@ void SETTINGS_SaveSettings(void) #ifdef ENABLE_AUDIO_BAR if (!gSetting_mic_bar) State[7] &= ~(1u << 4); #endif - #ifdef ENABLE_AM_FIX - if (!gSetting_AM_fix) State[7] &= ~(1u << 5); + #ifndef ENABLE_FEAT_F4HWN + #ifdef ENABLE_AM_FIX + if (!gSetting_AM_fix) State[7] &= ~(1u << 5); + #endif #endif State[7] = (State[7] & ~(3u << 6)) | ((gSetting_backlight_on_tx_rx & 3u) << 6); @@ -656,7 +694,7 @@ void SETTINGS_SaveSettings(void) #ifdef ENABLE_FEAT_F4HWN memset(State, 0xFF, sizeof(State)); - int tmp = 0; + tmp = 0; if(gSetting_set_inv == 1) tmp = tmp | (1 << 0); @@ -766,10 +804,11 @@ void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, { uint8_t state[8]; ChannelAttributes_t att = { - .band = 0xf, + .band = 0x7, .compander = 0, .scanlist1 = 0, .scanlist2 = 0, + .scanlist3 = 0, }; // default attributes uint16_t offset = 0x0D60 + (channel & ~7u); @@ -779,6 +818,7 @@ void SETTINGS_UpdateChannel(uint8_t channel, const VFO_Info_t *pVFO, bool keep, att.band = pVFO->Band; att.scanlist1 = pVFO->SCANLIST1_PARTICIPATION; att.scanlist2 = pVFO->SCANLIST2_PARTICIPATION; + att.scanlist3 = pVFO->SCANLIST3_PARTICIPATION; att.compander = pVFO->Compander; if (check && state[channel & 7u] == att.__val) return; // no change in the attributes @@ -857,6 +897,9 @@ buf[1] = 0 #ifdef ENABLE_AM_FIX | (1 << 4) #endif +#ifdef ENABLE_SPECTRUM + | (1 << 5) +#endif ; EEPROM_WriteBuffer(0x1FF0, buf); } \ No newline at end of file diff --git a/settings.h b/settings.h index 3792af4..acb7fb9 100644 --- a/settings.h +++ b/settings.h @@ -41,12 +41,16 @@ typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t; enum TxLockModes_t { F_LOCK_DEF, //all default frequencies + configurable F_LOCK_FCC, +#ifdef ENABLE_FEAT_F4HWN_PMR + F_LOCK_CA, +#endif F_LOCK_CE, F_LOCK_GB, F_LOCK_430, F_LOCK_438, #ifdef ENABLE_FEAT_F4HWN_PMR F_LOCK_PMR, + F_LOCK_GMRS_FRS_MURS, #endif F_LOCK_ALL, // disable TX on all frequencies F_LOCK_NONE, // enable TX on all frequencies @@ -188,9 +192,9 @@ typedef struct { uint8_t BACKLIGHT_TIME; uint8_t SCAN_RESUME_MODE; uint8_t SCAN_LIST_DEFAULT; - bool SCAN_LIST_ENABLED[2]; - uint8_t SCANLIST_PRIORITY_CH1[2]; - uint8_t SCANLIST_PRIORITY_CH2[2]; + bool SCAN_LIST_ENABLED[3]; + uint8_t SCANLIST_PRIORITY_CH1[3]; + uint8_t SCANLIST_PRIORITY_CH2[3]; uint8_t field29_0x26; uint8_t field30_0x27; diff --git a/ui/main.c b/ui/main.c index 1d4dd02..7482773 100644 --- a/ui/main.c +++ b/ui/main.c @@ -892,12 +892,49 @@ void UI_DisplayMain(void) if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) { // it's a channel + uint8_t countList = 0; + uint8_t shiftList = 0; + // show the scan list assigment symbols const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]]; + if (att.scanlist1) - memcpy(p_line0 + 113, BITMAP_ScanList1, sizeof(BITMAP_ScanList1)); + countList++; if (att.scanlist2) - memcpy(p_line0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2)); + countList++; + if (att.scanlist3) + countList++; + + shiftList = countList; + + if (att.scanlist1) + { + memcpy(p_line0 + 127 - (shiftList * 6), BITMAP_ScanList1, sizeof(BITMAP_ScanList1)); + shiftList--; + } + if (att.scanlist2) + { + memcpy(p_line0 + 127 - (shiftList * 6), BITMAP_ScanList2, sizeof(BITMAP_ScanList2)); + shiftList--; + } + if (att.scanlist3) + { + memcpy(p_line0 + 127 - (shiftList * 6), BITMAP_ScanList3, sizeof(BITMAP_ScanList3)); + } + + if(countList == 0) + { + memcpy(p_line0 + 127 - (1 * 6), BITMAP_ScanList0, sizeof(BITMAP_ScanList0)); + } + + /* + if (att.scanlist1) + memcpy(p_line0 + 107, BITMAP_ScanList1, sizeof(BITMAP_ScanList1)); + if (att.scanlist2) + memcpy(p_line0 + 114, BITMAP_ScanList2, sizeof(BITMAP_ScanList2)); + if (att.scanlist3) + memcpy(p_line0 + 121, BITMAP_ScanList3, sizeof(BITMAP_ScanList3)); + */ // compander symbol #ifndef ENABLE_BIG_FREQ diff --git a/ui/menu.c b/ui/menu.c index 6793992..0d1f179 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -57,6 +57,7 @@ const t_menu_item MenuList[] = {"Mode", MENU_AM }, // was "AM" {"ScAdd1", MENU_S_ADD1 }, {"ScAdd2", MENU_S_ADD2 }, + {"ScAdd3", MENU_S_ADD3 }, {"ChSave", MENU_MEM_CH }, // was "MEM-CH" {"ChDele", MENU_DEL_CH }, // was "DEL-CH" {"ChName", MENU_MEM_NAME }, @@ -64,6 +65,7 @@ const t_menu_item MenuList[] = {"SList", MENU_S_LIST }, {"SList1", MENU_SLIST1 }, {"SList2", MENU_SLIST2 }, + {"SList3", MENU_SLIST3 }, {"ScnRev", MENU_SC_REV }, #ifdef ENABLE_NOAA {"NOAA-S", MENU_NOAA_S }, @@ -116,8 +118,10 @@ const t_menu_item MenuList[] = {"D List", MENU_D_LIST }, #endif {"D Live", MENU_D_LIVE_DEC }, // live DTMF decoder -#ifdef ENABLE_AM_FIX - {"AM Fix", MENU_AM_FIX }, +#ifndef ENABLE_FEAT_F4HWN + #ifdef ENABLE_AM_FIX + {"AM Fix", MENU_AM_FIX }, + #endif #endif #ifdef ENABLE_VOX {"VOX", MENU_VOX }, @@ -286,12 +290,16 @@ const char * const gSubMenu_F_LOCK[] = { "DEFAULT+\n137-174\n400-470", "FCC HAM\n144-148\n420-450", +#ifdef ENABLE_FEAT_F4HWN_PMR + "CA HAM\n144-148\n430-450", +#endif "CE HAM\n144-146\n430-440", "GB HAM\n144-148\n430-440", "137-174\n400-430", "137-174\n400-438", #ifdef ENABLE_FEAT_F4HWN_PMR "PMR 446", + "GMRS\nFRS\nMURS", #endif "DISABLE\nALL", "UNLOCK\nALL", @@ -449,10 +457,10 @@ void UI_DisplayMenu(void) UI_DisplayClear(); #ifdef ENABLE_FEAT_F4HWN - UI_DrawLineBuffer(gFrameBuffer, 50, 0, 50, 55, 1); // Be ware, status zone = 8 lines, the rest = 56 ->total 64 + UI_DrawLineBuffer(gFrameBuffer, 48, 0, 48, 55, 1); // Be ware, status zone = 8 lines, the rest = 56 ->total 64 //UI_DrawLineDottedBuffer(gFrameBuffer, 0, 46, 50, 46, 1); - for (uint8_t i = 0; i < 50; i += 2) + for (uint8_t i = 0; i < 48; i += 2) { gFrameBuffer[5][i] = 0x40; } @@ -684,13 +692,16 @@ void UI_DisplayMenu(void) strcpy(String, gSubMenu_RX_TX[gSubMenuSelection]); break; - #ifdef ENABLE_AM_FIX - case MENU_AM_FIX: + #ifndef ENABLE_FEAT_F4HWN + #ifdef ENABLE_AM_FIX + case MENU_AM_FIX: + #endif #endif case MENU_BCL: case MENU_BEEP: case MENU_S_ADD1: case MENU_S_ADD2: + case MENU_S_ADD3: case MENU_STE: case MENU_D_ST: #ifdef ENABLE_DTMF_CALLING @@ -743,7 +754,10 @@ void UI_DisplayMenu(void) { const uint32_t frequency = SETTINGS_FetchChannelFrequency(gSubMenuSelection); - if (!gIsInSubMenu || edit_index < 0) + //if (!gIsInSubMenu || edit_index < 0) + if (!gIsInSubMenu) + edit_index = -1; + if (edit_index < 0) { // show the channel name SETTINGS_FetchChannelName(String, gSubMenuSelection); char *pPrintStr = String[0] ? String : "--"; @@ -751,9 +765,11 @@ void UI_DisplayMenu(void) } else { // show the channel name being edited - UI_PrintString(edit, menu_item_x1, 0, 2, 8); + //UI_PrintString(edit, menu_item_x1, 0, 2, 8); + UI_PrintString(edit, menu_item_x1, menu_item_x2, 2, 8); if (edit_index < 10) - UI_PrintString("^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor + //UI_PrintString("^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor + UI_PrintString("^", menu_item_x1 - 1 + (8 * edit_index),0, 4, 8); // show the cursor } if (!gAskForConfirmation) @@ -801,9 +817,13 @@ void UI_DisplayMenu(void) break; case MENU_S_LIST: - if (gSubMenuSelection < 2) - sprintf(String, "LIST%u", 1 + gSubMenuSelection); - else + if (gSubMenuSelection == 0) + strcpy(String, "LIST [0]\nNO LIST"); + else if (gSubMenuSelection < 4) + sprintf(String, "LIST [%u]", gSubMenuSelection); + else if (gSubMenuSelection == 4) + strcpy(String, "LISTS\n[1, 2, 3]"); + else if (gSubMenuSelection == 5) strcpy(String, "ALL"); break; @@ -867,12 +887,10 @@ void UI_DisplayMenu(void) case MENU_VOL: #ifdef ENABLE_FEAT_F4HWN - sprintf(String, "%u.%02uV %u%%\n%s\n%s", - gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, - BATTERY_VoltsToPercent(gBatteryVoltageAverage), + sprintf(String, "%s\n%s", AUTHOR_STRING_2, VERSION_STRING_2 - ); + ); #else sprintf(String, "%u.%02uV\n%u%%", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, @@ -996,6 +1014,27 @@ void UI_DisplayMenu(void) else y = 2 - ((lines + 0) / 2); + // only for SysInf + if(UI_MENU_GetCurrentMenuId() == MENU_VOL) + { + sprintf(edit, "%u.%02uV %u%%", + gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, + BATTERY_VoltsToPercent(gBatteryVoltageAverage) + ); + + UI_PrintStringSmallNormal(edit, 54, 127, 1); + + #ifdef ENABLE_SPECTRUM + #ifndef ENABLE_FMRADIO + UI_PrintStringSmallNormal("Bandscope", 54, 127, 6); + #endif + #else + UI_PrintStringSmallNormal("Broadcast", 54, 127, 6); + #endif + + y = 2; + } + // draw the text lines for (i = 0; i < len && lines > 0; lines--) { @@ -1017,9 +1056,15 @@ void UI_DisplayMenu(void) } } - if (UI_MENU_GetCurrentMenuId() == MENU_SLIST1 || UI_MENU_GetCurrentMenuId() == MENU_SLIST2) + if (UI_MENU_GetCurrentMenuId() == MENU_SLIST1 || UI_MENU_GetCurrentMenuId() == MENU_SLIST2 || UI_MENU_GetCurrentMenuId() == MENU_SLIST3) { - i = (UI_MENU_GetCurrentMenuId() == MENU_SLIST1) ? 0 : 1; + if(UI_MENU_GetCurrentMenuId() == MENU_SLIST1) + i = 0; + else if(UI_MENU_GetCurrentMenuId() == MENU_SLIST2) + i = 1; + else if(UI_MENU_GetCurrentMenuId() == MENU_SLIST3) + i = 2; + char *pPrintStr = String; if (gSubMenuSelection < 0) { diff --git a/ui/menu.h b/ui/menu.h index 902c9e4..5559dcb 100644 --- a/ui/menu.h +++ b/ui/menu.h @@ -66,6 +66,7 @@ enum MENU_AUTOLK, MENU_S_ADD1, MENU_S_ADD2, + MENU_S_ADD3, MENU_STE, MENU_RP_STE, MENU_MIC, @@ -77,6 +78,7 @@ enum MENU_S_LIST, MENU_SLIST1, MENU_SLIST2, + MENU_SLIST3, #ifdef ENABLE_ALARM MENU_AL_MOD, #endif diff --git a/ui/status.c b/ui/status.c index 89c9d88..fa55a15 100644 --- a/ui/status.c +++ b/ui/status.c @@ -50,7 +50,9 @@ static void convertTime(uint8_t *line, uint8_t type) m = t / 60; s = t - (m * 60); - gStatusLine[14] = 0x00; // Quick fix on display (on scanning I, II, etc.) + gStatusLine[0] = 0x00; // Quick fix on display (on scanning I, II, etc.) + gStatusLine[7] = 0x00; // Quick fix on display (on scanning I, II, etc.) + gStatusLine[14] = 0x00; // Quick fix on display (on scanning I, II, etc.) sprintf(str, "%02d:%02d", m, s); UI_PrintStringSmallBufferNormal(str, line + 0); @@ -95,14 +97,23 @@ void UI_DisplayStatus() if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning()) { if (IS_MR_CHANNEL(gNextMrChannel) && !SCANNER_IsScanning()) { // channel mode switch(gEeprom.SCAN_LIST_DEFAULT) { - case 0: - memcpy(line + x + 2, BITMAP_ScanList1, sizeof(BITMAP_ScanList1)); + case 0: + memcpy(line + 0, BITMAP_ScanList0, sizeof(BITMAP_ScanList0)); break; - case 1: - memcpy(line + x + 2, BITMAP_ScanList2, sizeof(BITMAP_ScanList2)); + case 1: + memcpy(line + 0, BITMAP_ScanList1, sizeof(BITMAP_ScanList1)); break; case 2: - memcpy(line + x, gFontScanAll, sizeof(gFontScanAll)); + memcpy(line + 0, BITMAP_ScanList2, sizeof(BITMAP_ScanList2)); + break; + case 3: + memcpy(line + 0, BITMAP_ScanList3, sizeof(BITMAP_ScanList3)); + break; + case 4: + memcpy(line + 0, BITMAP_ScanList123, sizeof(BITMAP_ScanList123)); + break; + case 5: + memcpy(line + 0, BITMAP_ScanListAll, sizeof(BITMAP_ScanListAll)); break; } } @@ -212,12 +223,10 @@ void UI_DisplayStatus() { memcpy(line + x + 1, gFontLight, sizeof(gFontLight)); } - /* else if (gChargingWithTypeC) { memcpy(line + x + 1, BITMAP_USB_C, sizeof(BITMAP_USB_C)); } - */ // Battery unsigned int x2 = LCD_WIDTH - sizeof(BITMAP_BatteryLevel1) - 0; diff --git a/version.c b/version.c index 4cff3ab..30cf86a 100644 --- a/version.c +++ b/version.c @@ -13,4 +13,4 @@ const char Version[] = AUTHOR_STRING VER; #endif -const char UART_Version[] = "UV-K5 Firmware, Open Edition, " AUTHOR_STRING VER "\r\n"; +const char UART_Version[] = "UV-K5 Firmware, " AUTHOR_STRING VER "\r\n";