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

@@ -594,20 +594,18 @@ 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))
return;
#endif #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];
@@ -648,7 +646,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
#endif #endif
} }
} }
}
} }
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration) void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration)