Scanlist refactoring

This commit is contained in:
Armel FAUVEAU
2024-06-28 05:13:24 +02:00
parent 1a97a076e1
commit ae6fb50e10
7 changed files with 70 additions and 93 deletions

View File

@@ -558,7 +558,7 @@ static void MAIN_Key_MENU(bool bKeyPressed, bool bKeyHeld)
#ifdef ENABLE_FEAT_F4HWN #ifdef ENABLE_FEAT_F4HWN
// Exclude work with list 1, 2, 3 or all list // Exclude work with list 1, 2, 3 or all list
if(gScanStateDir != SCAN_OFF && (gEeprom.SCAN_LIST_DEFAULT < 3 || gEeprom.SCAN_LIST_DEFAULT == 4)) if(gScanStateDir != SCAN_OFF && (gEeprom.SCAN_LIST_DEFAULT > 0 || gEeprom.SCAN_LIST_DEFAULT < 5))
{ {
if(FUNCTION_IsRx()) if(FUNCTION_IsRx())
{ {

View File

@@ -159,78 +159,60 @@ const uint8_t BITMAP_VFO_NotDefault[8] =
0b00001000 0b00001000
}; };
const uint8_t BITMAP_ScanList1[7] = const uint8_t BITMAP_ScanList0[5] =
{ // '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_ScanList4[7] =
{ // '0' symbol { // '0' symbol
0b01111111,
0b01111111, 0b01111111,
0b01000011, 0b01000011,
0b01011101, 0b01011101,
0b01100001, 0b01100001,
0b01111111, 0b01111111,
};
const uint8_t BITMAP_ScanList1[5] =
{ // '1' symbol
0b01111111,
0b01111011,
0b01000001,
0b01111111,
0b01111111, 0b01111111,
}; };
const uint8_t BITMAP_ScanList5[11] = const uint8_t BITMAP_ScanList2[5] =
{ { // '2' symbol
// 'All List' symbol 0b01111111,
0b01001101,
0b01010101,
0b01011011,
0b01111111, 0b01111111,
0b01100011,
0b01011101,
0b01011101,
0b01101011,
0b01110111,
0b01101011,
0b01011101,
0b01011101,
0b01100011,
0b01111111
}; };
const uint8_t BITMAP_ScanList6[9] = const uint8_t BITMAP_ScanList3[5] =
{ // '3' symbol
0b01111111,
0b01011101,
0b01010101,
0b01101011,
0b01111111,
};
const uint8_t BITMAP_ScanListAll[15] =
{ {
// 'All' symbol // 'All' symbol
0b00011100, 0b01111111,
0b00100010, 0b01000011,
0b00100010, 0b01110101,
0b00010100, 0b01000011,
0b00001000, 0b01111111,
0b00010100, 0b01111111,
0b00100010, 0b01000001,
0b00100010, 0b01011111,
0b00011100 0b01011111,
0b01111111,
0b01111111,
0b01000001,
0b01011111,
0b01011111,
0b01111111,
}; };
const uint8_t BITMAP_compand[6] = const uint8_t BITMAP_compand[6] =

View File

@@ -30,12 +30,11 @@ extern const uint8_t BITMAP_Ready[7];
extern const uint8_t BITMAP_Antenna[5]; extern const uint8_t BITMAP_Antenna[5];
extern const uint8_t BITMAP_VFO_Default[8]; extern const uint8_t BITMAP_VFO_Default[8];
extern const uint8_t BITMAP_VFO_NotDefault[8]; extern const uint8_t BITMAP_VFO_NotDefault[8];
extern const uint8_t BITMAP_ScanList1[7]; extern const uint8_t BITMAP_ScanList0[5];
extern const uint8_t BITMAP_ScanList2[7]; extern const uint8_t BITMAP_ScanList1[5];
extern const uint8_t BITMAP_ScanList3[7]; extern const uint8_t BITMAP_ScanList2[5];
extern const uint8_t BITMAP_ScanList4[7]; extern const uint8_t BITMAP_ScanList3[5];
extern const uint8_t BITMAP_ScanList5[11]; extern const uint8_t BITMAP_ScanListAll[15];
extern const uint8_t BITMAP_ScanList6[9];
extern const uint8_t BITMAP_compand[6]; extern const uint8_t BITMAP_compand[6];
#ifndef ENABLE_CUSTOM_MENU_LAYOUT #ifndef ENABLE_CUSTOM_MENU_LAYOUT

View File

@@ -80,19 +80,19 @@ bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanL
//LogUart(str); //LogUart(str);
if(scanList == 0 && att.scanlist1 != 1) if(scanList == 0 && (att.scanlist1 == 1 || att.scanlist2 == 1 || att.scanlist3 == 1))
{ {
return false; return false;
} }
else if(scanList == 1 && att.scanlist2 != 1) else if(scanList == 1 && att.scanlist1 != 1)
{ {
return false; return false;
} }
else if(scanList == 2 && att.scanlist3 != 1) else if(scanList == 2 && att.scanlist2 != 1)
{ {
return false; return false;
} }
else if(scanList == 3 && (att.scanlist1 == 1 || att.scanlist2 == 1 || att.scanlist3 == 1)) else if(scanList == 3 && att.scanlist3 != 1)
{ {
return false; return false;
} }

View File

@@ -909,22 +909,22 @@ void UI_DisplayMain(void)
if (att.scanlist1) if (att.scanlist1)
{ {
memcpy(p_line0 + 128 - (shiftList * 7), BITMAP_ScanList1, sizeof(BITMAP_ScanList1)); memcpy(p_line0 + 128 - (shiftList * 5), BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
shiftList--; shiftList--;
} }
if (att.scanlist2) if (att.scanlist2)
{ {
memcpy(p_line0 + 128 - (shiftList * 7), BITMAP_ScanList2, sizeof(BITMAP_ScanList2)); memcpy(p_line0 + 128 - (shiftList * 5), BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
shiftList--; shiftList--;
} }
if (att.scanlist3) if (att.scanlist3)
{ {
memcpy(p_line0 + 128 - (shiftList * 7), BITMAP_ScanList3, sizeof(BITMAP_ScanList3)); memcpy(p_line0 + 128 - (shiftList * 5), BITMAP_ScanList3, sizeof(BITMAP_ScanList3));
} }
if(countList == 0) if(countList == 0)
{ {
memcpy(p_line0 + 128 - (1 * 7), BITMAP_ScanList4, sizeof(BITMAP_ScanList4)); memcpy(p_line0 + 128 - (1 * 5), BITMAP_ScanList0, sizeof(BITMAP_ScanList0));
} }
/* /*
@@ -978,14 +978,6 @@ void UI_DisplayMain(void)
{ // no channel name, show the channel number instead { // no channel name, show the channel number instead
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1); sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
} }
else
{
// Too many list, so remove last character name
if(String[9] != 0 && countList == 3)
{
String[9] = 0;
}
}
if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME) { if (gEeprom.CHANNEL_DISPLAY_MODE == MDF_NAME) {
UI_PrintString(String, 32, 0, line, 8); UI_PrintString(String, 32, 0, line, 8);

View File

@@ -811,10 +811,10 @@ void UI_DisplayMenu(void)
break; break;
case MENU_S_LIST: case MENU_S_LIST:
if (gSubMenuSelection < 3) if (gSubMenuSelection == 0)
sprintf(String, "LIST [%u]", 1 + gSubMenuSelection);
else if (gSubMenuSelection == 3)
strcpy(String, "LIST [0]\nNO LIST"); strcpy(String, "LIST [0]\nNO LIST");
else if (gSubMenuSelection < 4)
sprintf(String, "LIST [%u]", gSubMenuSelection);
else if (gSubMenuSelection == 4) else if (gSubMenuSelection == 4)
strcpy(String, "LISTS\n[1, 2, 3]"); strcpy(String, "LISTS\n[1, 2, 3]");
else if (gSubMenuSelection == 5) else if (gSubMenuSelection == 5)

View File

@@ -50,7 +50,9 @@ static void convertTime(uint8_t *line, uint8_t type)
m = t / 60; m = t / 60;
s = t - (m * 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); sprintf(str, "%02d:%02d", m, s);
UI_PrintStringSmallBufferNormal(str, line + 0); UI_PrintStringSmallBufferNormal(str, line + 0);
@@ -95,23 +97,25 @@ void UI_DisplayStatus()
if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning()) { if (gScanStateDir != SCAN_OFF || SCANNER_IsScanning()) {
if (IS_MR_CHANNEL(gNextMrChannel) && !SCANNER_IsScanning()) { // channel mode if (IS_MR_CHANNEL(gNextMrChannel) && !SCANNER_IsScanning()) { // channel mode
switch(gEeprom.SCAN_LIST_DEFAULT) { switch(gEeprom.SCAN_LIST_DEFAULT) {
case 0: case 0:
memcpy(line + x + 2, BITMAP_ScanList1, sizeof(BITMAP_ScanList1)); memcpy(line + 0, BITMAP_ScanList0, sizeof(BITMAP_ScanList0));
break; break;
case 1: case 1:
memcpy(line + x + 2, BITMAP_ScanList2, sizeof(BITMAP_ScanList2)); memcpy(line + 0, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
break; break;
case 2: case 2:
memcpy(line + x + 2, BITMAP_ScanList3, sizeof(BITMAP_ScanList3)); memcpy(line + 0, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
break; break;
case 3: case 3:
memcpy(line + x + 2, BITMAP_ScanList4, sizeof(BITMAP_ScanList4)); memcpy(line + 0, BITMAP_ScanList3, sizeof(BITMAP_ScanList3));
break; break;
case 4: case 4:
memcpy(line + x + 0, BITMAP_ScanList5, sizeof(BITMAP_ScanList5)); memcpy(line + 0, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
memcpy(line + 5, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
memcpy(line + 10, BITMAP_ScanList3, sizeof(BITMAP_ScanList3));
break; break;
case 5: case 5:
memcpy(line + x + 1, BITMAP_ScanList6, sizeof(BITMAP_ScanList6)); memcpy(line + 0, BITMAP_ScanListAll, sizeof(BITMAP_ScanListAll));
break; break;
} }
} }