forked from mirror/uv-k5-firmware
More improved channel checks.
This commit is contained in:
parent
f05df4f802
commit
5c0a732d88
@ -250,7 +250,7 @@ void FUN_0000773c(void)
|
|||||||
gStepDirection = 0;
|
gStepDirection = 0;
|
||||||
|
|
||||||
if (g_20000413 != 1) {
|
if (g_20000413 != 1) {
|
||||||
if (g_20000410 < 200) {
|
if (IS_MR_CHANNEL(g_20000410)) {
|
||||||
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = g_20000414;
|
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = g_20000414;
|
||||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = Previous;
|
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = Previous;
|
||||||
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, 2);
|
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, 2);
|
||||||
@ -264,7 +264,7 @@ void FUN_0000773c(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gInfoCHAN_A->CHANNEL_SAVE >= 200) {
|
if (!IS_MR_CHANNEL(gInfoCHAN_A->CHANNEL_SAVE)) {
|
||||||
RADIO_ApplyOffset(gInfoCHAN_A);
|
RADIO_ApplyOffset(gInfoCHAN_A);
|
||||||
RADIO_ConfigureSquelchAndOutputPower(gInfoCHAN_A);
|
RADIO_ConfigureSquelchAndOutputPower(gInfoCHAN_A);
|
||||||
SETTINGS_SaveChannel(gInfoCHAN_A->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gInfoCHAN_A, 1);
|
SETTINGS_SaveChannel(gInfoCHAN_A->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gInfoCHAN_A, 1);
|
||||||
@ -1451,8 +1451,8 @@ void APP_ChangeStepDirectionMaybe(bool bFlag, int8_t Direction)
|
|||||||
g_20000410 = gInfoCHAN_A->CHANNEL_SAVE;
|
g_20000410 = gInfoCHAN_A->CHANNEL_SAVE;
|
||||||
g_20000415 = 0;
|
g_20000415 = 0;
|
||||||
gStepDirection = Direction;
|
gStepDirection = Direction;
|
||||||
if (g_20000410 < 200) {
|
if (IS_MR_CHANNEL(g_20000410)) {
|
||||||
if (bFlag == 1) {
|
if (bFlag) {
|
||||||
g_20000414 = g_20000410;
|
g_20000414 = g_20000410;
|
||||||
}
|
}
|
||||||
FUN_00007dd4();
|
FUN_00007dd4();
|
||||||
|
@ -874,7 +874,7 @@ void MENU_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||||
if (Value < 200) {
|
if (IS_MR_CHANNEL(Value)) {
|
||||||
gAnotherVoiceID = Key;
|
gAnotherVoiceID = Key;
|
||||||
gSubMenuSelection = Value;
|
gSubMenuSelection = Value;
|
||||||
return;
|
return;
|
||||||
|
2
board.c
2
board.c
@ -348,7 +348,7 @@ void BOARD_EEPROM_Init(void)
|
|||||||
|
|
||||||
// 0E70..0E77
|
// 0E70..0E77
|
||||||
EEPROM_ReadBuffer(0x0E70, Data, 8);
|
EEPROM_ReadBuffer(0x0E70, Data, 8);
|
||||||
if (Data[0] < 200) {
|
if (IS_MR_CHANNEL(Data[0])) {
|
||||||
gEeprom.CHAN_1_CALL = Data[0];
|
gEeprom.CHAN_1_CALL = Data[0];
|
||||||
} else {
|
} else {
|
||||||
gEeprom.CHAN_1_CALL = 0;
|
gEeprom.CHAN_1_CALL = 0;
|
||||||
|
12
radio.c
12
radio.c
@ -44,7 +44,7 @@ bool RADIO_CheckValidChannel(uint16_t Channel, bool bCheckScanList, uint8_t VFO)
|
|||||||
uint8_t PriorityCh1;
|
uint8_t PriorityCh1;
|
||||||
uint8_t PriorityCh2;
|
uint8_t PriorityCh2;
|
||||||
|
|
||||||
if (Channel >= 200) {
|
if (!IS_MR_CHANNEL(Channel)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,9 +90,9 @@ uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScan
|
|||||||
|
|
||||||
for (i = 0; i < 200; i++) {
|
for (i = 0; i < 200; i++) {
|
||||||
if (Channel == 0xFF) {
|
if (Channel == 0xFF) {
|
||||||
Channel = 199;
|
Channel = MR_CHANNEL_LAST;
|
||||||
} else if (Channel >= 200) {
|
} else if (Channel > MR_CHANNEL_LAST) {
|
||||||
Channel = 0;
|
Channel = MR_CHANNEL_FIRST;
|
||||||
}
|
}
|
||||||
if (RADIO_CheckValidChannel(Channel, bCheckScanList, VFO)) {
|
if (RADIO_CheckValidChannel(Channel, bCheckScanList, VFO)) {
|
||||||
return Channel;
|
return Channel;
|
||||||
@ -315,13 +315,13 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg)
|
|||||||
|
|
||||||
if (Frequency - 10800000 < 2799991) {
|
if (Frequency - 10800000 < 2799991) {
|
||||||
gEeprom.VfoInfo[VFO].FREQUENCY_DEVIATION_SETTING = FREQUENCY_DEVIATION_OFF;
|
gEeprom.VfoInfo[VFO].FREQUENCY_DEVIATION_SETTING = FREQUENCY_DEVIATION_OFF;
|
||||||
} else if (Channel >= 200) {
|
} else if (!IS_MR_CHANNEL(Channel)) {
|
||||||
Frequency = FREQUENCY_FloorToStep(gEeprom.VfoInfo[VFO].FREQUENCY_OF_DEVIATION, gEeprom.VfoInfo[VFO].StepFrequency, 0);
|
Frequency = FREQUENCY_FloorToStep(gEeprom.VfoInfo[VFO].FREQUENCY_OF_DEVIATION, gEeprom.VfoInfo[VFO].StepFrequency, 0);
|
||||||
gEeprom.VfoInfo[VFO].FREQUENCY_OF_DEVIATION = Frequency;
|
gEeprom.VfoInfo[VFO].FREQUENCY_OF_DEVIATION = Frequency;
|
||||||
}
|
}
|
||||||
RADIO_ApplyOffset(pRadio);
|
RADIO_ApplyOffset(pRadio);
|
||||||
memset(gEeprom.VfoInfo[VFO].Name, 0, sizeof(gEeprom.VfoInfo[VFO].Name));
|
memset(gEeprom.VfoInfo[VFO].Name, 0, sizeof(gEeprom.VfoInfo[VFO].Name));
|
||||||
if (Channel < 200) {
|
if (IS_MR_CHANNEL(Channel)) {
|
||||||
// 16 bytes allocated but only 12 used
|
// 16 bytes allocated but only 12 used
|
||||||
EEPROM_ReadBuffer(0x0F50 + (Channel * 0x10), gEeprom.VfoInfo[VFO].Name + 0, 8);
|
EEPROM_ReadBuffer(0x0F50 + (Channel * 0x10), gEeprom.VfoInfo[VFO].Name + 0, 8);
|
||||||
EEPROM_ReadBuffer(0x0F58 + (Channel * 0x10), gEeprom.VfoInfo[VFO].Name + 8, 2);
|
EEPROM_ReadBuffer(0x0F58 + (Channel * 0x10), gEeprom.VfoInfo[VFO].Name + 8, 2);
|
||||||
|
@ -176,15 +176,15 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
|
|
||||||
OffsetMR = 0x0000 + (Channel * 16);
|
OffsetMR = 0x0000 + (Channel * 16);
|
||||||
OffsetVFO = OffsetMR;
|
OffsetVFO = OffsetMR;
|
||||||
if (Channel >= 200) {
|
if (!IS_MR_CHANNEL(Channel)) {
|
||||||
if (VFO == 0) {
|
if (VFO == 0) {
|
||||||
OffsetVFO = 0x0C80 + ((Channel - 200) * 32);
|
OffsetVFO = 0x0C80 + ((Channel - FREQ_CHANNEL_FIRST) * 32);
|
||||||
} else {
|
} else {
|
||||||
OffsetVFO = 0x0C90 + ((Channel - 200) * 32);
|
OffsetVFO = 0x0C90 + ((Channel - FREQ_CHANNEL_FIRST) * 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Mode 2 == Delete
|
// Mode 2 == Delete
|
||||||
if (Mode == 2 || Channel >= 200) {
|
if (Mode == 2 || !IS_MR_CHANNEL(Channel)) {
|
||||||
uint32_t State32[2];
|
uint32_t State32[2];
|
||||||
uint8_t State8[8];
|
uint8_t State8[8];
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ void UI_DisplayMain(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 0x8F3C
|
// 0x8F3C
|
||||||
if (gEeprom.ScreenChannel[i] < 200) {
|
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) {
|
||||||
memcpy(pLine1 + 2, BITMAP_M, sizeof(BITMAP_M));
|
memcpy(pLine1 + 2, BITMAP_M, sizeof(BITMAP_M));
|
||||||
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != i) {
|
if (gInputBoxIndex == 0 || gEeprom.TX_CHANNEL != i) {
|
||||||
NUMBER_ToDigits(gEeprom.ScreenChannel[i] + 1, String);
|
NUMBER_ToDigits(gEeprom.ScreenChannel[i] + 1, String);
|
||||||
@ -217,7 +217,7 @@ void UI_DisplayMain(void)
|
|||||||
if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[i]) && gEeprom.TX_CHANNEL == i) {
|
if (gInputBoxIndex && IS_FREQ_CHANNEL(gEeprom.ScreenChannel[i]) && gEeprom.TX_CHANNEL == i) {
|
||||||
UI_DisplayFrequency(gInputBox, 31, i * 4, true, false);
|
UI_DisplayFrequency(gInputBox, 31, i * 4, true, false);
|
||||||
} else {
|
} else {
|
||||||
if (gEeprom.ScreenChannel[i] < 200) {
|
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) {
|
||||||
if (gEeprom.CHANNEL_DISPLAY_MODE == 2 && (gEeprom.VfoInfo[i].Name[0] == 0 || gEeprom.VfoInfo[i].Name[0] == 0xFF)) {
|
if (gEeprom.CHANNEL_DISPLAY_MODE == 2 && (gEeprom.VfoInfo[i].Name[0] == 0 || gEeprom.VfoInfo[i].Name[0] == 0xFF)) {
|
||||||
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
|
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1);
|
||||||
UI_PrintString(String, 31, 112, i * 4, 8, true);
|
UI_PrintString(String, 31, 112, i * 4, 8, true);
|
||||||
@ -239,7 +239,7 @@ void UI_DisplayMain(void)
|
|||||||
NUMBER_ToDigits(gEeprom.VfoInfo[i].pDCS_Current->Frequency, String);
|
NUMBER_ToDigits(gEeprom.VfoInfo[i].pDCS_Current->Frequency, String);
|
||||||
}
|
}
|
||||||
UI_DisplayFrequency(String, 31, i * 4, false, false);
|
UI_DisplayFrequency(String, 31, i * 4, false, false);
|
||||||
if (gEeprom.ScreenChannel[i] < 200) {
|
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) {
|
||||||
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[i]];
|
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[i]];
|
||||||
if (Attributes & MR_CH_SCANLIST1) {
|
if (Attributes & MR_CH_SCANLIST1) {
|
||||||
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
|
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
|
||||||
@ -275,7 +275,7 @@ void UI_DisplayMain(void)
|
|||||||
NUMBER_ToDigits(gEeprom.VfoInfo[i].pDCS_Current->Frequency, String);
|
NUMBER_ToDigits(gEeprom.VfoInfo[i].pDCS_Current->Frequency, String);
|
||||||
}
|
}
|
||||||
UI_DisplayFrequency(String, 31, i * 4, false, false);
|
UI_DisplayFrequency(String, 31, i * 4, false, false);
|
||||||
if (gEeprom.ScreenChannel[i] < 200) {
|
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[i])) {
|
||||||
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[i]];
|
const uint8_t Attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[i]];
|
||||||
if (Attributes & MR_CH_SCANLIST1) {
|
if (Attributes & MR_CH_SCANLIST1) {
|
||||||
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
|
memcpy(pLine0 + 113, BITMAP_ScanList, sizeof(BITMAP_ScanList));
|
||||||
|
@ -469,11 +469,11 @@ void UI_DisplayMenu(void)
|
|||||||
UI_PrintString(String, 50, 127, 2, 8, 1);
|
UI_PrintString(String, 50, 127, 2, 8, 1);
|
||||||
} else {
|
} else {
|
||||||
UI_PrintString(String, 50, 127, 0, 8, 1);
|
UI_PrintString(String, 50, 127, 0, 8, 1);
|
||||||
if (gEeprom.SCANLIST_PRIORITY_CH1[i] < 200) {
|
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i])) {
|
||||||
sprintf(String, "PRI1:%d", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
|
sprintf(String, "PRI1:%d", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
|
||||||
UI_PrintString(String, 50, 127, 2, 8, 1);
|
UI_PrintString(String, 50, 127, 2, 8, 1);
|
||||||
}
|
}
|
||||||
if (gEeprom.SCANLIST_PRIORITY_CH2[i] < 200) {
|
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i])) {
|
||||||
sprintf(String, "PRI2:%d", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
|
sprintf(String, "PRI2:%d", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
|
||||||
UI_PrintString(String, 50, 127, 4, 8, 1);
|
UI_PrintString(String, 50, 127, 4, 8, 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user