From 4c261c72a21999b569fc35ae8c0b0c9bd3d080e8 Mon Sep 17 00:00:00 2001 From: prokrypt Date: Wed, 10 Jul 2024 12:41:00 -0700 Subject: [PATCH] fix scanlist ordering for chirp driver compatibility --- app/main.c | 2 +- app/menu.c | 8 ++++---- radio.c | 2 +- ui/main.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/main.c b/app/main.c index 3f8d0a2ed..b5b38ceb6 100644 --- a/app/main.c +++ b/app/main.c @@ -76,7 +76,7 @@ static void toggle_chan_scanlist(uint8_t num) gTxVfo->SCANLIST_PARTICIPATION = (gTxVfo->SCANLIST_PARTICIPATION++ < 7) ? gTxVfo->SCANLIST_PARTICIPATION : 0; } else { num-=1; - gTxVfo->SCANLIST_PARTICIPATION ^= (1 << (2-num)); + gTxVfo->SCANLIST_PARTICIPATION ^= (1 << (num)); /* switch(num){ case 1: diff --git a/app/menu.c b/app/menu.c index 5dbb84056..ecaeb9fe3 100644 --- a/app/menu.c +++ b/app/menu.c @@ -625,7 +625,7 @@ void MENU_AcceptSetting(void) break; case MENU_S_ADD1: - gTxVfo->SCANLIST_PARTICIPATION = (gTxVfo->SCANLIST_PARTICIPATION & ~(1 << 2)) | (gSubMenuSelection << 2); + gTxVfo->SCANLIST_PARTICIPATION = (gTxVfo->SCANLIST_PARTICIPATION & ~(1 << 0)) | (gSubMenuSelection << 0); SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, false, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; @@ -639,7 +639,7 @@ void MENU_AcceptSetting(void) return; case MENU_S_ADD3: - gTxVfo->SCANLIST_PARTICIPATION = (gTxVfo->SCANLIST_PARTICIPATION & ~(1 << 0)) | (gSubMenuSelection << 0); + gTxVfo->SCANLIST_PARTICIPATION = (gTxVfo->SCANLIST_PARTICIPATION & ~(1 << 2)) | (gSubMenuSelection << 2); SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true, false, true); gVfoConfigureMode = VFO_CONFIGURE; gFlagResetVfos = true; @@ -1088,7 +1088,7 @@ void MENU_ShowCurrentSetting(void) break; case MENU_S_ADD1: - gSubMenuSelection = gTxVfo->SCANLIST_PARTICIPATION >> 2 & 1; + gSubMenuSelection = gTxVfo->SCANLIST_PARTICIPATION >> 0 & 1; break; case MENU_S_ADD2: @@ -1096,7 +1096,7 @@ void MENU_ShowCurrentSetting(void) break; case MENU_S_ADD3: - gSubMenuSelection = gTxVfo->SCANLIST_PARTICIPATION >> 0 & 1; + gSubMenuSelection = gTxVfo->SCANLIST_PARTICIPATION >> 2 & 1; break; case MENU_STE: diff --git a/radio.c b/radio.c index cc3394e96..bd15ebb65 100644 --- a/radio.c +++ b/radio.c @@ -74,7 +74,7 @@ bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanL // return false; if(scanList<3){ - if(!((att.scanlists >> (2-scanList)) & 1)) + if(!((att.scanlists >> scanList) & 1)) return false; } else if(scanList==3 && att.scanlists) diff --git a/ui/main.c b/ui/main.c index 4a4d2ce86..6b6fee089 100644 --- a/ui/main.c +++ b/ui/main.c @@ -923,11 +923,11 @@ void UI_DisplayMain(void) memcpy(((shiftList%2==1)?p_line0:p_line1) + 128 - ((shiftList>2?2:shiftList) * 8), BITMAP_ScanList3, sizeof(BITMAP_ScanList3)); } */ - if (att.scanlists & 0b100) + if (att.scanlists & 0b001) memcpy(p_line0 + 129 - (2 * 8), BITMAP_ScanList1, sizeof(BITMAP_ScanList1)); if (att.scanlists & 0b010) memcpy(p_line0 + 129 - (1 * 8), BITMAP_ScanList2, sizeof(BITMAP_ScanList2)); - if (att.scanlists & 0b001) + if (att.scanlists & 0b100) memcpy(p_line1 + 129 - (2 * 8), BITMAP_ScanList3, sizeof(BITMAP_ScanList3));