mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
Refactoring ScList, ScPri, 1 Call, etc.
This commit is contained in:
1 parent
b774f9d2ec
commit
179a0ea8b8
6 files changed
+30
-55
No files matched your search
@@ -250,7 +250,7 @@ static void NextFreqChannel(void)
|
||||
static void NextMemChannel(void)
|
||||
{
|
||||
static uint16_t prev_mr_chan = 0;
|
||||
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT > 0 && gEeprom.SCAN_LIST_DEFAULT <= MR_CHANNELS_LIST + 1) ? gEeprom.SCAN_LIST_ENABLED[0] : true;
|
||||
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT > 0 && gEeprom.SCAN_LIST_DEFAULT <= MR_CHANNELS_LIST + 1) ? gEeprom.SCAN_LIST_ENABLED : true;
|
||||
const int16_t chan1 = (gEeprom.SCAN_LIST_DEFAULT > 0 && gEeprom.SCAN_LIST_DEFAULT <= MR_CHANNELS_LIST + 1 && gEeprom.SCANLIST_PRIORITY_CH[0] != MR_CHANNELS_MAX) ? gEeprom.SCANLIST_PRIORITY_CH[0] : -1;
|
||||
const int16_t chan2 = (gEeprom.SCAN_LIST_DEFAULT > 0 && gEeprom.SCAN_LIST_DEFAULT <= MR_CHANNELS_LIST + 1 && gEeprom.SCANLIST_PRIORITY_CH[1] != MR_CHANNELS_MAX) ? gEeprom.SCANLIST_PRIORITY_CH[1] : -1;
|
||||
const uint16_t prev_chan = gNextMrChannel;
|
||||
|
||||
+2
-2
@@ -721,7 +721,7 @@ void MENU_AcceptSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_S_PRI:
|
||||
gEeprom.SCAN_LIST_ENABLED[0] = gSubMenuSelection;
|
||||
gEeprom.SCAN_LIST_ENABLED = gSubMenuSelection;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
@@ -1208,7 +1208,7 @@ void MENU_ShowCurrentSetting(void)
|
||||
break;
|
||||
|
||||
case MENU_S_PRI:
|
||||
gSubMenuSelection = gEeprom.SCAN_LIST_ENABLED[0];
|
||||
gSubMenuSelection = gEeprom.SCAN_LIST_ENABLED;
|
||||
break;
|
||||
|
||||
case MENU_S_PRI_CH_1:
|
||||
|
||||
+2
-2
@@ -70,9 +70,9 @@ bool RADIO_CheckValidChannel(uint16_t channel, bool checkScanList, uint8_t scanL
|
||||
return false;
|
||||
}
|
||||
|
||||
// Exclude priority channels ONLY if SCAN_LIST_ENABLED[0] is active
|
||||
// Exclude priority channels ONLY if SCAN_LIST_ENABLED is active
|
||||
// Otherwise, treat them as normal channels in the list
|
||||
if (gEeprom.SCAN_LIST_ENABLED[0])
|
||||
if (gEeprom.SCAN_LIST_ENABLED)
|
||||
{
|
||||
const uint16_t PriorityCh1 = gEeprom.SCANLIST_PRIORITY_CH[0];
|
||||
const uint16_t PriorityCh2 = gEeprom.SCANLIST_PRIORITY_CH[1];
|
||||
|
||||
+21
-46
@@ -35,7 +35,6 @@ void SETTINGS_InitEEPROM(void)
|
||||
uint8_t Data[16] = {0};
|
||||
// 0E70..0E77
|
||||
PY25Q16_ReadBuffer(0x00A000, Data, 8);
|
||||
gEeprom.CHAN_1_CALL = IS_MR_CHANNEL(Data[0]) ? Data[0] : MR_CHANNEL_FIRST;
|
||||
gEeprom.SQUELCH_LEVEL = (Data[1] < 10) ? Data[1] : 1;
|
||||
gEeprom.TX_TIMEOUT_TIMER = (Data[2] > 4 && Data[2] < 180) ? Data[2] : 11;
|
||||
#ifdef ENABLE_NOAA
|
||||
@@ -255,36 +254,21 @@ gEeprom.FreqChannel[1] = IS_FREQ_CHANNEL(Data16[5]) ? Data16[5] : (FREQ_CHANNE
|
||||
|
||||
// 0F18..0F1F
|
||||
PY25Q16_ReadBuffer(0x00A130, Data, 8);
|
||||
gEeprom.SCAN_LIST_DEFAULT = (Data[0] <= (MR_CHANNELS_LIST + 1)) ? 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.SCAN_LIST_DEFAULT = ((Data[0] & 0x7F) <= (MR_CHANNELS_LIST + 1)) ? (Data[0] & 0x7F) : 0;
|
||||
gEeprom.SCAN_LIST_ENABLED = (Data[0] >> 7) & 0x01;
|
||||
|
||||
gEeprom.SCANLIST_PRIORITY_CH[0] = 0;
|
||||
gEeprom.SCANLIST_PRIORITY_CH[1] = 2;
|
||||
gEeprom.SCANLIST_PRIORITY_CH[0] =
|
||||
(uint16_t)Data[1] |
|
||||
((uint16_t)Data[2] << 8);
|
||||
|
||||
gEeprom.SCANLIST_PRIORITY_CH[2] = 14;
|
||||
gEeprom.SCANLIST_PRIORITY_CH[3] = 15;
|
||||
gEeprom.SCANLIST_PRIORITY_CH[1] =
|
||||
(uint16_t)Data[3] |
|
||||
((uint16_t)Data[4] << 8);
|
||||
|
||||
gEeprom.SCANLIST_PRIORITY_CH[4] = 40;
|
||||
gEeprom.SCANLIST_PRIORITY_CH[5] = 41;
|
||||
*/
|
||||
|
||||
// Fix me probably after Chirp update...
|
||||
for (unsigned int i = 0; i < 3; i++)
|
||||
{
|
||||
gEeprom.SCAN_LIST_ENABLED[i] = (Data[1] >> i) & 1;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < 6; i++)
|
||||
{
|
||||
gEeprom.SCANLIST_PRIORITY_CH[i] =
|
||||
(uint16_t)Data[2 + (i * 2)] |
|
||||
((uint16_t)Data[2 + (i * 2) + 1] << 8);
|
||||
}
|
||||
gEeprom.CHAN_1_CALL =
|
||||
(uint16_t)Data[5] |
|
||||
((uint16_t)Data[6] << 8);
|
||||
|
||||
// 0F40..0F47
|
||||
PY25Q16_ReadBuffer(0x00A150, Data, 8);
|
||||
@@ -637,7 +621,6 @@ void SETTINGS_SaveSettings(void)
|
||||
|
||||
// 0x0E70
|
||||
State = SecBuf;
|
||||
State[0] = gEeprom.CHAN_1_CALL;
|
||||
State[1] = gEeprom.SQUELCH_LEVEL;
|
||||
State[2] = gEeprom.TX_TIMEOUT_TIMER;
|
||||
#ifdef ENABLE_NOAA
|
||||
@@ -777,32 +760,24 @@ void SETTINGS_SaveSettings(void)
|
||||
// -------------------------
|
||||
// 0f18 - 0f20
|
||||
|
||||
memset(SecBuf, 0xff, 0x10);
|
||||
memset(SecBuf, 0xff, 0x08);
|
||||
|
||||
// 0x0F18
|
||||
State = SecBuf;
|
||||
State[0] = gEeprom.SCAN_LIST_DEFAULT;
|
||||
|
||||
tmp = 0;
|
||||
State[0] = (gEeprom.SCAN_LIST_DEFAULT & 0x7F)
|
||||
| ((gEeprom.SCAN_LIST_ENABLED & 0x01) << 7);
|
||||
|
||||
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] = (uint8_t)(gEeprom.SCANLIST_PRIORITY_CH[0] & 0xFF);
|
||||
State[2] = (uint8_t)(gEeprom.SCANLIST_PRIORITY_CH[0] >> 8);
|
||||
|
||||
State[1] = tmp;
|
||||
State[3] = (uint8_t)(gEeprom.SCANLIST_PRIORITY_CH[1] & 0xFF);
|
||||
State[4] = (uint8_t)(gEeprom.SCANLIST_PRIORITY_CH[1] >> 8);
|
||||
|
||||
for (uint8_t i = 0; i < 6; i++)
|
||||
{
|
||||
uint16_t v = gEeprom.SCANLIST_PRIORITY_CH[i];
|
||||
State[5] = (uint8_t)(gEeprom.CHAN_1_CALL & 0xFF);
|
||||
State[6] = (uint8_t)(gEeprom.CHAN_1_CALL >> 8);
|
||||
|
||||
State[2 + (i * 2) + 0] = (uint8_t)(v & 0xFF);
|
||||
State[2 + (i * 2) + 1] = (uint8_t)(v >> 8);
|
||||
}
|
||||
|
||||
PY25Q16_WriteBuffer(0x00A130, SecBuf, 0x10, false);
|
||||
PY25Q16_WriteBuffer(0x00A130, SecBuf, 0x08, false);
|
||||
|
||||
// ---------------------
|
||||
// 0f40 - 0f48
|
||||
|
||||
+2
-2
@@ -215,7 +215,7 @@ typedef struct {
|
||||
uint8_t BACKLIGHT_TIME;
|
||||
uint8_t SCAN_RESUME_MODE;
|
||||
uint8_t SCAN_LIST_DEFAULT;
|
||||
bool SCAN_LIST_ENABLED[3];
|
||||
bool SCAN_LIST_ENABLED;
|
||||
uint16_t SCANLIST_PRIORITY_CH[6];
|
||||
//#ifdef ENABLE_FEAT_F4HWN_RESUME_STATE // Fix me !!! What the hell is this?
|
||||
uint8_t CURRENT_STATE;
|
||||
@@ -241,7 +241,7 @@ typedef struct {
|
||||
uint8_t KEY_2_LONG_PRESS_ACTION;
|
||||
uint8_t MIC_SENSITIVITY;
|
||||
uint8_t MIC_SENSITIVITY_TUNING;
|
||||
uint8_t CHAN_1_CALL;
|
||||
uint16_t CHAN_1_CALL;
|
||||
#ifdef ENABLE_DTMF_CALLING
|
||||
char ANI_DTMF_ID[8];
|
||||
char KILL_CODE[8];
|
||||
|
||||
+2
-2
@@ -99,7 +99,7 @@ void UI_DisplayStatus()
|
||||
|
||||
if(gEeprom.SCAN_LIST_DEFAULT == MR_CHANNELS_LIST + 1)
|
||||
{
|
||||
if(gEeprom.SCAN_LIST_ENABLED[0]==1) {
|
||||
if(gEeprom.SCAN_LIST_ENABLED==1) {
|
||||
sprintf(str, "%s+", "ALL");
|
||||
end = 19;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ void UI_DisplayStatus()
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gEeprom.SCAN_LIST_ENABLED[0]==1) {
|
||||
if(gEeprom.SCAN_LIST_ENABLED==1) {
|
||||
sprintf(str, "%02d+", gEeprom.SCAN_LIST_DEFAULT);
|
||||
end = 15;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user