This commit is contained in:
Krzysiek Egzmont
2023-12-26 01:29:17 +01:00
parent 995045006f
commit 1882ab0cc1
4 changed files with 56 additions and 58 deletions

View File

@@ -124,7 +124,7 @@ void ACTION_Monitor(void)
if (gCurrentFunction != FUNCTION_MONITOR) { // enable the monitor if (gCurrentFunction != FUNCTION_MONITOR) { // enable the monitor
RADIO_SelectVfos(); RADIO_SelectVfos();
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (gRxVfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST && gIsNoaaMode) if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gIsNoaaMode)
gNoaaChannel = gRxVfo->CHANNEL_SAVE - NOAA_CHANNEL_FIRST; gNoaaChannel = gRxVfo->CHANNEL_SAVE - NOAA_CHANNEL_FIRST;
#endif #endif
RADIO_SetupRegisters(true); RADIO_SetupRegisters(true);

View File

@@ -553,7 +553,7 @@ static void DualwatchAlternate(void)
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO]; gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
if (gEeprom.VfoInfo[0].CHANNEL_SAVE >= NOAA_CHANNEL_FIRST) if (IS_NOAA_CHANNEL(gEeprom.VfoInfo[0].CHANNEL_SAVE))
NOAA_IncreaseChannel(); NOAA_IncreaseChannel();
} }
else else

View File

@@ -166,7 +166,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (IS_VALID_CHANNEL(channel)) { if (IS_VALID_CHANNEL(channel)) {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (channel >= NOAA_CHANNEL_FIRST) if (IS_NOAA_CHANNEL(channel))
{ {
RADIO_InitInfo(pVfo, gEeprom.ScreenChannel[VFO], NoaaFrequencyTable[channel - NOAA_CHANNEL_FIRST]); RADIO_InitInfo(pVfo, gEeprom.ScreenChannel[VFO], NoaaFrequencyTable[channel - NOAA_CHANNEL_FIRST]);
@@ -805,7 +805,7 @@ void RADIO_SetupRegisters(bool switchToForeground)
return; return;
} }
if (gRxVfo->CHANNEL_SAVE >= NOAA_CHANNEL_FIRST) if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
{ {
gIsNoaaMode = true; gIsNoaaMode = true;
gNoaaChannel = gRxVfo->CHANNEL_SAVE - NOAA_CHANNEL_FIRST; gNoaaChannel = gRxVfo->CHANNEL_SAVE - NOAA_CHANNEL_FIRST;

View File

@@ -78,10 +78,10 @@ void SETTINGS_InitEEPROM(void)
gEeprom.MrChannel[1] = IS_MR_CHANNEL(Data[4]) ? Data[4] : MR_CHANNEL_FIRST; gEeprom.MrChannel[1] = IS_MR_CHANNEL(Data[4]) ? Data[4] : MR_CHANNEL_FIRST;
gEeprom.FreqChannel[0] = IS_FREQ_CHANNEL(Data[2]) ? Data[2] : (FREQ_CHANNEL_FIRST + BAND6_400MHz); gEeprom.FreqChannel[0] = IS_FREQ_CHANNEL(Data[2]) ? Data[2] : (FREQ_CHANNEL_FIRST + BAND6_400MHz);
gEeprom.FreqChannel[1] = IS_FREQ_CHANNEL(Data[5]) ? Data[5] : (FREQ_CHANNEL_FIRST + BAND6_400MHz); gEeprom.FreqChannel[1] = IS_FREQ_CHANNEL(Data[5]) ? Data[5] : (FREQ_CHANNEL_FIRST + BAND6_400MHz);
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
gEeprom.NoaaChannel[0] = IS_NOAA_CHANNEL(Data[6]) ? Data[6] : NOAA_CHANNEL_FIRST; gEeprom.NoaaChannel[0] = IS_NOAA_CHANNEL(Data[6]) ? Data[6] : NOAA_CHANNEL_FIRST;
gEeprom.NoaaChannel[1] = IS_NOAA_CHANNEL(Data[7]) ? Data[7] : NOAA_CHANNEL_FIRST; gEeprom.NoaaChannel[1] = IS_NOAA_CHANNEL(Data[7]) ? Data[7] : NOAA_CHANNEL_FIRST;
#endif #endif
#ifdef ENABLE_FMRADIO #ifdef ENABLE_FMRADIO
{ // 0E88..0E8F { // 0E88..0E8F
@@ -593,21 +593,19 @@ void SETTINGS_SaveSettings(void)
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode) void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode)
{ {
#ifdef ENABLE_NOAA #ifdef ENABLE_NOAA
if (!IS_NOAA_CHANNEL(Channel)) if (IS_NOAA_CHANNEL(Channel))
#endif return;
{ #endif
uint16_t OffsetVFO = Channel * 16; uint16_t OffsetVFO = Channel * 16;
if (!IS_MR_CHANNEL(Channel)) if (IS_FREQ_CHANNEL(Channel)) { // it's a VFO, not a channel
{ // it's a VFO, not a channel
OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90; OffsetVFO = (VFO == 0) ? 0x0C80 : 0x0C90;
OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32; OffsetVFO += (Channel - FREQ_CHANNEL_FIRST) * 32;
} }
if (Mode >= 2 || !IS_MR_CHANNEL(Channel)) if (Mode >= 2 || IS_FREQ_CHANNEL(Channel)) { // copy VFO to a channel
{ // copy VFO to a channel
union { union {
uint8_t _8[8]; uint8_t _8[8];
uint32_t _32[2]; uint32_t _32[2];
@@ -638,17 +636,17 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
SETTINGS_UpdateChannel(Channel, pVFO, true); SETTINGS_UpdateChannel(Channel, pVFO, true);
if (IS_MR_CHANNEL(Channel)) { if (IS_MR_CHANNEL(Channel)) {
#ifndef ENABLE_KEEP_MEM_NAME #ifndef ENABLE_KEEP_MEM_NAME
// clear/reset the channel name // clear/reset the channel name
SETTINGS_SaveChannelName(Channel, ""); SETTINGS_SaveChannelName(Channel, "");
#else #else
if (Mode >= 3) { if (Mode >= 3) {
SETTINGS_SaveChannelName(Channel, pVFO->Name); SETTINGS_SaveChannelName(Channel, pVFO->Name);
} }
#endif #endif
}
} }
} }
} }
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration) void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration)