From ee59118fce6ff832347a61fddcc2bfe382191330 Mon Sep 17 00:00:00 2001 From: Armel FAUVEAU Date: Mon, 24 Jun 2024 05:41:21 +0200 Subject: [PATCH] Add Not In List and All In List --- Makefile | 2 +- app/action.c | 2 +- app/chFrScanner.c | 4 ++-- app/main.c | 2 +- app/menu.c | 2 +- bitmaps.c | 56 ++++++++++++++++++++++++++++++++++++----------- bitmaps.h | 4 +++- radio.c | 10 ++++++++- settings.c | 4 ++-- ui/menu.c | 6 ++++- ui/status.c | 8 ++++++- 11 files changed, 75 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 7a3a8af..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 diff --git a/app/action.c b/app/action.c index 928e3f4..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) % 4; + gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 6; // jump to the next channel CHFRSCANNER_Start(false, gScanStateDir); diff --git a/app/chFrScanner.c b/app/chFrScanner.c index 0d404c7..c18168a 100644 --- a/app/chFrScanner.c +++ b/app/chFrScanner.c @@ -195,7 +195,7 @@ static void NextFreqChannel(void) static void NextMemChannel(void) { static unsigned int prev_mr_chan = 0; - const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 3) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true; + const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 5) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true; const int chan1 = -1; const int chan2 = -1; const int chan3 = -1; @@ -267,7 +267,7 @@ static void NextMemChannel(void) if (!enabled || chan == 0xff) { - chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 3) ? 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; diff --git a/app/main.c b/app/main.c index 2e9bb38..630300f 100644 --- a/app/main.c +++ b/app/main.c @@ -568,7 +568,7 @@ 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 < 3) + if(gScanStateDir != SCAN_OFF && gEeprom.SCAN_LIST_DEFAULT < 5) { if(FUNCTION_IsRx()) { diff --git a/app/menu.c b/app/menu.c index 8bb6823..f3d44f5 100644 --- a/app/menu.c +++ b/app/menu.c @@ -311,7 +311,7 @@ int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax) case MENU_S_LIST: //*pMin = 0; - *pMax = 3; + *pMax = 5; break; #ifdef ENABLE_DTMF_CALLING diff --git a/bitmaps.c b/bitmaps.c index bbabe3f..4d8f034 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, @@ -205,6 +192,49 @@ const uint8_t BITMAP_ScanList3[7] = 0b01111111, }; +const uint8_t BITMAP_ScanList4[7] = +{ // '0' symbol + 0b01111111, + 0b01111111, + 0b01000011, + 0b01011101, + 0b01100001, + 0b01111111, + 0b01111111, +}; + +const uint8_t BITMAP_ScanList5[11] = +{ + // 'All List' symbol + 0b11111111, + 0b11000011, + 0b10111101, + 0b10111101, + 0b11011011, + 0b11100111, + 0b11011011, + 0b10111101, + 0b10111101, + 0b11000011, + 0b11111111 +}; + +const uint8_t BITMAP_ScanList6[11] = +{ + // 'All' symbol + 0b00000000, + 0b00111100, + 0b01000010, + 0b01000010, + 0b00100100, + 0b00011000, + 0b00100100, + 0b01000010, + 0b01000010, + 0b00111100, + 0b00000000 +}; + const uint8_t BITMAP_compand[6] = { 0b00000000, diff --git a/bitmaps.h b/bitmaps.h index 1e8b569..b62ec54 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]; @@ -34,6 +33,9 @@ extern const uint8_t BITMAP_VFO_NotDefault[8]; 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_ScanList4[7]; +extern const uint8_t BITMAP_ScanList5[11]; +extern const uint8_t BITMAP_ScanList6[11]; extern const uint8_t BITMAP_compand[6]; #ifndef ENABLE_CUSTOM_MENU_LAYOUT diff --git a/radio.c b/radio.c index abf0152..fa3515e 100644 --- a/radio.c +++ b/radio.c @@ -73,7 +73,7 @@ bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanL if (att.band > BAND7_470MHz) return false; - if (!checkScanList || scanList > 2) + if (!checkScanList || scanList > 4) return true; //sprintf(str, "scanList %d / att.scanlist1 %d / att.scanlist2 %d / att.scanlist3 %d\n", scanList, att.scanlist1, att.scanlist2, att.scanlist3); @@ -92,6 +92,14 @@ bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanL { return false; } + else if(scanList == 3 && (att.scanlist1 == 1 || att.scanlist2 == 1 || att.scanlist3 == 1)) + { + return false; + } + else if(scanList == 4 && (att.scanlist1 == 0 && att.scanlist2 == 0 && att.scanlist3 == 0)) + { + return false; + } //sprintf(str, ">>> %d\n", scanList); //LogUart(str); diff --git a/settings.c b/settings.c index 9bb6ec4..1359ad2 100644 --- a/settings.c +++ b/settings.c @@ -225,11 +225,11 @@ 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 + gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 5) ? Data[0] : 0; // we now have 'all' channel scan option for (unsigned int i = 0; i < 2; 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[j + 0] < 5) ? Data[j] : false; gEeprom.SCANLIST_PRIORITY_CH1[i] = Data[j + 1]; gEeprom.SCANLIST_PRIORITY_CH2[i] = Data[j + 2]; } diff --git a/ui/menu.c b/ui/menu.c index 9d9386c..1bbb450 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -810,7 +810,11 @@ void UI_DisplayMenu(void) case MENU_S_LIST: if (gSubMenuSelection < 3) sprintf(String, "LIST%u", 1 + gSubMenuSelection); - else + else if (gSubMenuSelection == 3) + strcpy(String, "NOT\nIN LISTS"); + else if (gSubMenuSelection == 4) + strcpy(String, "ALL\nIN LISTS"); + else if (gSubMenuSelection == 5) strcpy(String, "ALL"); break; diff --git a/ui/status.c b/ui/status.c index aac7ca6..90ca90e 100644 --- a/ui/status.c +++ b/ui/status.c @@ -105,7 +105,13 @@ void UI_DisplayStatus() memcpy(line + x + 2, BITMAP_ScanList3, sizeof(BITMAP_ScanList3)); break; case 3: - memcpy(line + x, gFontScanAll, sizeof(gFontScanAll)); + memcpy(line + x + 2, BITMAP_ScanList4, sizeof(BITMAP_ScanList4)); + break; + case 4: + memcpy(line + x, BITMAP_ScanList5, sizeof(BITMAP_ScanList5)); + break; + case 5: + memcpy(line + x, BITMAP_ScanList6, sizeof(BITMAP_ScanList6)); break; } }