0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-05-19 08:21:18 +03:00

Scanlist now 1, 2 or all channels

This commit is contained in:
OneOfEleven 2023-10-04 22:08:13 +01:00
parent fe949d2ae3
commit 1cfb59fa38
11 changed files with 94 additions and 43 deletions

View File

@ -186,7 +186,7 @@ void ACTION_Scan(bool bRestart)
{ {
#if 1 #if 1
// keep scanning but toggle between scan lists // keep scanning but toggle between scan lists
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) & 1u; gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
gUpdateStatus = true; gUpdateStatus = true;
#else #else
SCANNER_Stop(); SCANNER_Stop();
@ -217,7 +217,7 @@ void ACTION_Scan(bool bRestart)
else else
if (!bRestart) if (!bRestart)
{ // keep scanning but toggle between scan lists { // keep scanning but toggle between scan lists
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) & 1u; gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
gUpdateStatus = true; gUpdateStatus = true;
} }
else else

View File

@ -639,12 +639,12 @@ static void FREQ_NextChannel(void)
static void MR_NextChannel(void) static void MR_NextChannel(void)
{ {
static unsigned int prev_mr_chan = 0; static int prev_mr_chan = 0;
const bool enabled = gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT]; const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true;
const unsigned int chan1 = gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT]; const int chan1 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT] : -1;
const unsigned int chan2 = gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT]; const int chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1;
const unsigned int prev_chan = gNextMrChannel; const int prev_chan = gNextMrChannel;
unsigned int chan = 0; int chan = 0;
if (enabled) if (enabled)
{ {
@ -652,19 +652,26 @@ static void MR_NextChannel(void)
{ {
case SCAN_NEXT_CHAN_SCANLIST1: case SCAN_NEXT_CHAN_SCANLIST1:
prev_mr_chan = gNextMrChannel; prev_mr_chan = gNextMrChannel;
if (RADIO_CheckValidChannel(chan1, false, 0))
if (chan1 >= 0)
{ {
//gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; if (RADIO_CheckValidChannel(chan1, false, 0))
gNextMrChannel = chan1; {
break; //gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
gNextMrChannel = chan1;
break;
}
} }
case SCAN_NEXT_CHAN_SCANLIST2: case SCAN_NEXT_CHAN_SCANLIST2:
if (RADIO_CheckValidChannel(chan2, false, 0)) if (chan2 >= 0)
{ {
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST2; if (RADIO_CheckValidChannel(chan2, false, 0))
gNextMrChannel = chan2; {
break; gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST2;
gNextMrChannel = chan2;
break;
}
} }
// this bit doesn't work at all - yet :( // this bit doesn't work at all - yet :(
@ -693,7 +700,7 @@ static void MR_NextChannel(void)
if (!enabled || chan == 0xffffffff) if (!enabled || chan == 0xffffffff)
{ {
chan = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, true, gEeprom.SCAN_LIST_DEFAULT); chan = RADIO_FindNextChannel(gNextMrChannel + gScanState, gScanState, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
if (chan == 0xFF) if (chan == 0xFF)
return; return;

View File

@ -555,19 +555,29 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
int channel = -1; int channel = -1;
int vfo = -1; int vfo = -1;
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[0]) && #if 0
IS_MR_CHANNEL(gEeprom.ScreenChannel[1])) // copy channel to opposite VFO
{ if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[0]) &&
channel = gEeprom.ScreenChannel[1]; IS_MR_CHANNEL(gEeprom.ScreenChannel[1]))
vfo = 0; {
} channel = gEeprom.ScreenChannel[1];
else vfo = 0;
if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[1]) && }
IS_MR_CHANNEL(gEeprom.ScreenChannel[0])) else
{ if (IS_FREQ_CHANNEL(gEeprom.ScreenChannel[1]) &&
channel = gEeprom.ScreenChannel[0]; IS_MR_CHANNEL(gEeprom.ScreenChannel[0]))
vfo = 1; {
} channel = gEeprom.ScreenChannel[0];
vfo = 1;
}
#else
// copy channel to same VFO
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[gEeprom.RX_CHANNEL]))
{
channel = gEeprom.ScreenChannel[gEeprom.RX_CHANNEL];
vfo = gEeprom.RX_CHANNEL;
}
#endif
if (channel >= 0 && vfo >= 0) if (channel >= 0 && vfo >= 0)
{ // copy the channel into the VFO { // copy the channel into the VFO

View File

@ -284,7 +284,8 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
break; break;
case MENU_S_LIST: case MENU_S_LIST:
*pMin = 1; *pMin = 0;
// *pMax = 1;
*pMax = 2; *pMax = 2;
break; break;
@ -612,7 +613,7 @@ void MENU_AcceptSetting(void)
break; break;
case MENU_S_LIST: case MENU_S_LIST:
gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection - 1; gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection;
break; break;
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM
@ -1018,7 +1019,7 @@ void MENU_ShowCurrentSetting(void)
break; break;
case MENU_S_LIST: case MENU_S_LIST:
gSubMenuSelection = gEeprom.SCAN_LIST_DEFAULT + 1; gSubMenuSelection = gEeprom.SCAN_LIST_DEFAULT;
break; break;
case MENU_SLIST1: case MENU_SLIST1:

View File

@ -624,7 +624,7 @@ void BOARD_EEPROM_Init(void)
gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*'; gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*';
gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#'; gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#';
gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0; gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0;
gEeprom.DTMF_auto_reset_time = (Data[4] < 61) ? Data[4] : (Data[4] >= 10) ? Data[4] : 10; gEeprom.DTMF_auto_reset_time = (Data[4] < 61) ? Data[4] : (Data[4] >= 5) ? Data[4] : 10;
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300; gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100; gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100; gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;

View File

@ -913,7 +913,7 @@ void BK4819_EnableDTMF(void)
// REG_24 <3:0> 14 Max symbol number for SelCall detection // REG_24 <3:0> 14 Max symbol number for SelCall detection
// const uint16_t threshold = 24; // doesn't decode non-QS radios // const uint16_t threshold = 24; // doesn't decode non-QS radios
const uint16_t threshold = 200; // but 128 ~ 247 does const uint16_t threshold = 160; // but 128 ~ 247 does
BK4819_WriteRegister(BK4819_REG_24, // 1 00011000 1 1 1 1110 BK4819_WriteRegister(BK4819_REG_24, // 1 00011000 1 1 1 1110
(1u << BK4819_REG_24_SHIFT_UNKNOWN_15) (1u << BK4819_REG_24_SHIFT_UNKNOWN_15)
| (threshold << BK4819_REG_24_SHIFT_THRESHOLD) // 0 ~ 255 | (threshold << BK4819_REG_24_SHIFT_THRESHOLD) // 0 ~ 255

Binary file not shown.

Binary file not shown.

View File

@ -91,8 +91,10 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
#if 1 #if 1
// TX audio level // TX audio level
if (gCurrentFunction != FUNCTION_TRANSMIT) if (gCurrentFunction != FUNCTION_TRANSMIT ||
return; gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
return; // screen is in use
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
if (gAlarmState != ALARM_STATE_OFF) if (gAlarmState != ALARM_STATE_OFF)
@ -170,7 +172,9 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
if (gEeprom.KEY_LOCK && gKeypadLocked > 0) if (gEeprom.KEY_LOCK && gKeypadLocked > 0)
return; // display is in use return; // display is in use
if (gCurrentFunction == FUNCTION_TRANSMIT || gScreenToDisplay != DISPLAY_MAIN) if (gCurrentFunction == FUNCTION_TRANSMIT ||
gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
return; // display is in use return; // display is in use
if (now) if (now)
@ -719,6 +723,10 @@ void UI_DisplayMain(void)
#if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA) #if defined(ENABLE_AM_FIX) && defined(ENABLE_AM_FIX_SHOW_DATA)
if (rx && gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix) if (rx && gEeprom.VfoInfo[gEeprom.RX_CHANNEL].AM_mode && gSetting_AM_fix)
{ {
if (gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
return;
center_line = CENTER_LINE_AM_FIX_DATA; center_line = CENTER_LINE_AM_FIX_DATA;
AM_fix_print_data(gEeprom.RX_CHANNEL, String); AM_fix_print_data(gEeprom.RX_CHANNEL, String);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
@ -742,7 +750,13 @@ void UI_DisplayMain(void)
{ // show live DTMF decode { // show live DTMF decode
const unsigned int len = strlen(gDTMF_RX_live); const unsigned int len = strlen(gDTMF_RX_live);
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
if (gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
return;
center_line = CENTER_LINE_DTMF_DEC; center_line = CENTER_LINE_DTMF_DEC;
strcpy(String, "DTMF "); strcpy(String, "DTMF ");
strcat(String, gDTMF_RX_live + idx); strcat(String, gDTMF_RX_live + idx);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
@ -752,7 +766,13 @@ void UI_DisplayMain(void)
{ // show live DTMF decode { // show live DTMF decode
const unsigned int len = gDTMF_RX_index; const unsigned int len = gDTMF_RX_index;
const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars const unsigned int idx = (len > (17 - 5)) ? len - (17 - 5) : 0; // limit to last 'n' chars
if (gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
return;
center_line = CENTER_LINE_DTMF_DEC; center_line = CENTER_LINE_DTMF_DEC;
strcpy(String, "DTMF "); strcpy(String, "DTMF ");
strcat(String, gDTMF_RX + idx); strcat(String, gDTMF_RX + idx);
UI_PrintStringSmall(String, 2, 0, 3); UI_PrintStringSmall(String, 2, 0, 3);
@ -763,7 +783,12 @@ void UI_DisplayMain(void)
else else
if (gChargingWithTypeC) if (gChargingWithTypeC)
{ // charging .. show the battery state { // charging .. show the battery state
if (gScreenToDisplay != DISPLAY_MAIN ||
gDTMF_CallState != DTMF_CALL_STATE_NONE)
return;
center_line = CENTER_LINE_CHARGE_DATA; center_line = CENTER_LINE_CHARGE_DATA;
sprintf(String, "Charge %u.%02uV %u%%", sprintf(String, "Charge %u.%02uV %u%%",
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100, gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
BATTERY_VoltsToPercent(gBatteryVoltageAverage)); BATTERY_VoltsToPercent(gBatteryVoltageAverage));

View File

@ -709,7 +709,10 @@ void UI_DisplayMenu(void)
break; break;
case MENU_S_LIST: case MENU_S_LIST:
sprintf(String, "LIST%u", gSubMenuSelection); if (gSubMenuSelection < 2)
sprintf(String, "LIST%u", 1 + gSubMenuSelection);
else
strcpy(String, "ALL");
break; break;
#ifdef ENABLE_ALARM #ifdef ENABLE_ALARM

View File

@ -100,8 +100,13 @@ void UI_DisplayStatus(const bool test_display)
// memmove(line + x, BITMAP_SC1, sizeof(BITMAP_SC1)); // memmove(line + x, BITMAP_SC1, sizeof(BITMAP_SC1));
UI_PrintStringSmallBuffer("1", line + x); UI_PrintStringSmallBuffer("1", line + x);
else else
if (gEeprom.SCAN_LIST_DEFAULT == 1)
// memmove(line + x, BITMAP_SC2, sizeof(BITMAP_SC2)); // memmove(line + x, BITMAP_SC2, sizeof(BITMAP_SC2));
UI_PrintStringSmallBuffer("2", line + x); UI_PrintStringSmallBuffer("2", line + x);
else
if (gEeprom.SCAN_LIST_DEFAULT == 2)
// memmove(line + x, BITMAP_SCA, sizeof(BITMAP_SCA));
UI_PrintStringSmallBuffer("*", line + x);
// x1 = x + sizeof(BITMAP_SC1); // x1 = x + sizeof(BITMAP_SC1);
x1 = x + 7; x1 = x + 7;
} }