Make all warnings vanish over to bricky's house !

This commit is contained in:
OneOfEleven 2023-10-05 15:26:08 +01:00
parent cb05a5881f
commit bd9f337a5b
19 changed files with 116 additions and 58 deletions

View File

@ -200,6 +200,7 @@ endif
# May cause unhelpful build failures # May cause unhelpful build failures
#CFLAGS += -Wpadded #CFLAGS += -Wpadded
CFLAGS += -Wextra
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\" CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"

View File

@ -475,7 +475,7 @@
void AM_fix_print_data(const int vfo, char *s) void AM_fix_print_data(const int vfo, char *s)
{ {
if (s != NULL && vfo >= 0 && vfo < ARRAY_SIZE(gain_table_index)) if (s != NULL && vfo >= 0 && vfo < (int)ARRAY_SIZE(gain_table_index))
{ {
const unsigned int index = gain_table_index[vfo]; const unsigned int index = gain_table_index[vfo];
// sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_table[index].gain_dB, prev_rssi[vfo]); // sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_table[index].gain_dB, prev_rssi[vfo]);

View File

@ -647,6 +647,9 @@ static void MR_NextChannel(void)
if (enabled) if (enabled)
{ {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gCurrentScanList) switch (gCurrentScanList)
{ {
case SCAN_NEXT_CHAN_SCANLIST1: case SCAN_NEXT_CHAN_SCANLIST1:
@ -680,7 +683,7 @@ static void MR_NextChannel(void)
// { // {
// chan = (gEeprom.RX_VFO + 1) & 1u; // chan = (gEeprom.RX_VFO + 1) & 1u;
// chan = gEeprom.ScreenChannel[chan]; // chan = gEeprom.ScreenChannel[chan];
// if (IS_MR_CHANNEL(chan)) // if (chan <= MR_CHANNEL_LAST)
// { // {
// gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH; // gCurrentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
// gNextMrChannel = chan; // gNextMrChannel = chan;
@ -695,6 +698,8 @@ static void MR_NextChannel(void)
chan = 0xff; chan = 0xff;
break; break;
} }
#pragma GCC diagnostic pop
} }
if (!enabled || chan == 0xff) if (!enabled || chan == 0xff)
@ -2042,7 +2047,7 @@ void CHANNEL_Next(bool bFlag, int8_t Direction)
gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1; gCurrentScanList = SCAN_NEXT_CHAN_SCANLIST1;
gScanState = Direction; gScanState = Direction;
if (IS_MR_CHANNEL(gNextMrChannel)) if (gNextMrChannel <= MR_CHANNEL_LAST)
{ {
if (bFlag) if (bFlag)
gRestoreMrChannel = gNextMrChannel; gRestoreMrChannel = gNextMrChannel;

View File

@ -331,6 +331,9 @@ void DTMF_HandleRequest(void)
gUpdateDisplay = true; gUpdateDisplay = true;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gEeprom.DTMF_DECODE_RESPONSE) switch (gEeprom.DTMF_DECODE_RESPONSE)
{ {
case DTMF_DEC_RESPONSE_BOTH: case DTMF_DEC_RESPONSE_BOTH:
@ -348,6 +351,8 @@ void DTMF_HandleRequest(void)
break; break;
} }
#pragma GCC diagnostic pop
if (gDTMF_IsGroupCall) if (gDTMF_IsGroupCall)
gDTMF_ReplyState = DTMF_REPLY_NONE; gDTMF_ReplyState = DTMF_REPLY_NONE;
} }

View File

@ -408,6 +408,9 @@ void MENU_AcceptSetting(void)
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
return; return;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
case MENU_T_CTCS: case MENU_T_CTCS:
pConfig = &gTxVfo->freq_config_TX; pConfig = &gTxVfo->freq_config_TX;
case MENU_R_CTCS: case MENU_R_CTCS:
@ -436,6 +439,8 @@ void MENU_AcceptSetting(void)
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
return; return;
#pragma GCC diagnostic pop
case MENU_SFT_D: case MENU_SFT_D:
gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION = gSubMenuSelection; gTxVfo->TX_OFFSET_FREQUENCY_DIRECTION = gSubMenuSelection;
gRequestSaveChannel = 1; gRequestSaveChannel = 1;
@ -1170,7 +1175,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (edit_index < 10) if (edit_index < 10)
{ {
if (Key >= KEY_0 && Key <= KEY_9) if (/* Key >= KEY_0 && */ Key <= KEY_9)
{ {
edit[edit_index] = '0' + Key - KEY_0; edit[edit_index] = '0' + Key - KEY_0;
@ -1193,6 +1198,9 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
if (!gIsInSubMenu) if (!gIsInSubMenu)
{ {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gInputBoxIndex) switch (gInputBoxIndex)
{ {
case 2: case 2:
@ -1224,6 +1232,8 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
break; break;
} }
#pragma GCC diagnostic pop
gInputBoxIndex = 0; gInputBoxIndex = 0;
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
@ -1269,7 +1279,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1; Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
if (IS_MR_CHANNEL(Value)) if (Value <= MR_CHANNEL_LAST)
{ {
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
@ -1661,6 +1671,9 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
VFO = 0; VFO = 0;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gMenuCursor) switch (gMenuCursor)
{ {
case MENU_DEL_CH: case MENU_DEL_CH:
@ -1681,6 +1694,8 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
return; return;
} }
#pragma GCC diagnostic pop
Channel = RADIO_FindNextChannel(gSubMenuSelection + Direction, Direction, bCheckScanList, VFO); Channel = RADIO_FindNextChannel(gSubMenuSelection + Direction, Direction, bCheckScanList, VFO);
if (Channel != 0xFF) if (Channel != 0xFF)
gSubMenuSelection = Channel; gSubMenuSelection = Channel;

View File

@ -67,7 +67,7 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
gInputBoxIndex = 0; gInputBoxIndex = 0;
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1; Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
{ {
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key; gAnotherVoiceID = (VOICE_ID_t)Key;
@ -193,7 +193,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
} }
} }
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST)
{ {
gScannerEditState = 1; gScannerEditState = 1;
gScanChannel = gTxVfo->CHANNEL_SAVE; gScanChannel = gTxVfo->CHANNEL_SAVE;
@ -247,7 +247,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
gTxVfo->freq_config_TX.Code = gScanCssResultCode; gTxVfo->freq_config_TX.Code = gScanCssResultCode;
} }
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE)) if (gTxVfo->CHANNEL_SAVE <= MR_CHANNEL_LAST)
{ {
Channel = gScanChannel; Channel = gScanChannel;
gEeprom.MrChannel[gEeprom.TX_VFO] = Channel; gEeprom.MrChannel[gEeprom.TX_VFO] = Channel;
@ -428,7 +428,7 @@ void SCANNER_Stop(void)
if (!bScanKeepFrequency) if (!bScanKeepFrequency)
{ {
if (IS_MR_CHANNEL(gNextMrChannel)) if (gNextMrChannel <= MR_CHANNEL_LAST)
{ {
gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel; gEeprom.MrChannel[gEeprom.RX_VFO] = gRestoreMrChannel;
gEeprom.ScreenChannel[gEeprom.RX_VFO] = Previous; gEeprom.ScreenChannel[gEeprom.RX_VFO] = Previous;
@ -446,7 +446,7 @@ void SCANNER_Stop(void)
return; return;
} }
if (!IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE)) if (gRxVfo->CHANNEL_SAVE > MR_CHANNEL_LAST)
{ {
RADIO_ApplyOffset(gRxVfo); RADIO_ApplyOffset(gRxVfo);
RADIO_ConfigureSquelchAndOutputPower(gRxVfo); RADIO_ConfigureSquelchAndOutputPower(gRxVfo);

View File

@ -450,7 +450,7 @@ bool UART_IsCommandAvailable(void)
Index = DMA_INDEX(gUART_WriteIndex, 2); Index = DMA_INDEX(gUART_WriteIndex, 2);
Size = (UART_DMA_Buffer[DMA_INDEX(Index, 1)] << 8) | UART_DMA_Buffer[Index]; Size = (UART_DMA_Buffer[DMA_INDEX(Index, 1)] << 8) | UART_DMA_Buffer[Index];
if ((Size + 8) > sizeof(UART_DMA_Buffer)) if ((Size + 8u) > sizeof(UART_DMA_Buffer))
{ {
gUART_WriteIndex = DmaLength; gUART_WriteIndex = DmaLength;
return false; return false;

View File

@ -142,6 +142,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
SYSTEM_DelayMs(60); SYSTEM_DelayMs(60);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (Beep) switch (Beep)
{ {
case BEEP_880HZ_60MS_TRIPLE_BEEP: case BEEP_880HZ_60MS_TRIPLE_BEEP:
@ -181,6 +184,8 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
break; break;
} }
#pragma GCC diagnostic pop
SYSTEM_DelayMs(Duration); SYSTEM_DelayMs(Duration);
BK4819_EnterTxMute(); BK4819_EnterTxMute();
SYSTEM_DelayMs(20); SYSTEM_DelayMs(20);

View File

@ -134,9 +134,9 @@ void ADC_Configure(ADC_Config_t *pAdc)
; ;
if (SARADC_IE == 0) { if (SARADC_IE == 0) {
NVIC_DisableIRQ(DP32_SARADC_IRQn); NVIC_DisableIRQ((IRQn_Type)DP32_SARADC_IRQn);
} else { } else {
NVIC_EnableIRQ(DP32_SARADC_IRQn); NVIC_EnableIRQ((IRQn_Type)DP32_SARADC_IRQn);
} }
} }

View File

@ -24,6 +24,8 @@ static void AES_Setup_ENC_CBC(bool IsDecrypt, const void *pKey, const void *pIv)
const uint32_t *pK = (const uint32_t *)pKey; const uint32_t *pK = (const uint32_t *)pKey;
const uint32_t *pI = (const uint32_t *)pIv; const uint32_t *pI = (const uint32_t *)pIv;
(void)IsDecrypt; // unused
AES_CR = (AES_CR & ~AES_CR_EN_MASK) | AES_CR_EN_BITS_DISABLE; AES_CR = (AES_CR & ~AES_CR_EN_MASK) | AES_CR_EN_BITS_DISABLE;
AES_CR = AES_CR_CHMOD_BITS_CBC; AES_CR = AES_CR_CHMOD_BITS_CBC;
AES_KEYR3 = pK[0]; AES_KEYR3 = pK[0];

View File

@ -103,7 +103,7 @@ KEY_Code_t KEYBOARD_Poll(void)
// ***************** // *****************
for (int j = 0; j < ARRAY_SIZE(keyboard); j++) for (unsigned int j = 0; j < ARRAY_SIZE(keyboard); j++)
{ {
//Set all high //Set all high
GPIOA->DATA |= 1u << GPIOA_PIN_KEYBOARD_4 | GPIOA->DATA |= 1u << GPIOA_PIN_KEYBOARD_4 |
@ -118,7 +118,7 @@ KEY_Code_t KEYBOARD_Poll(void)
// Read all 4 GPIO pins at once // Read all 4 GPIO pins at once
uint16_t reg = GPIOA->DATA; uint16_t reg = GPIOA->DATA;
for (int i = 0; i < ARRAY_SIZE(keyboard[j].pins); i++) for (unsigned int i = 0; i < ARRAY_SIZE(keyboard[j].pins); i++)
{ {
uint16_t mask = 1u << keyboard[j].pins[i].pin; uint16_t mask = 1u << keyboard[j].pins[i].pin;
if (!(reg & mask)) if (!(reg & mask))

View File

@ -93,9 +93,9 @@ void SPI_Configure(volatile SPI_Port_t *pPort, SPI_Config_t *pConfig)
if (pPort->IE) { if (pPort->IE) {
if (pPort == SPI0) { if (pPort == SPI0) {
NVIC_EnableIRQ(DP32_SPI0_IRQn); NVIC_EnableIRQ((IRQn_Type)DP32_SPI0_IRQn);
} else if (pPort == SPI1) { } else if (pPort == SPI1) {
NVIC_EnableIRQ(DP32_SPI1_IRQn); NVIC_EnableIRQ((IRQn_Type)DP32_SPI1_IRQn);
} }
} }
} }

Binary file not shown.

Binary file not shown.

22
misc.h
View File

@ -24,26 +24,22 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif #endif
#define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST) #define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST)
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST) #define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL) #define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
#ifdef ENABLE_NOAA #define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST)
#define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST) #define IS_NOT_NOAA_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
#define IS_NOT_NOAA_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
#endif
enum { typedef enum {
MR_CHANNEL_FIRST = 0, MR_CHANNEL_FIRST = 0,
MR_CHANNEL_LAST = 199u, MR_CHANNEL_LAST = 199u,
FREQ_CHANNEL_FIRST = 200u, FREQ_CHANNEL_FIRST = 200u,
FREQ_CHANNEL_LAST = 206u, FREQ_CHANNEL_LAST = 206u,
#ifdef ENABLE_NOAA NOAA_CHANNEL_FIRST = 207u,
NOAA_CHANNEL_FIRST = 207u, NOAA_CHANNEL_LAST = 216u,
NOAA_CHANNEL_LAST = 216u,
#endif
LAST_CHANNEL LAST_CHANNEL
}; } channel_num_t;
enum { enum {
FLASHLIGHT_OFF = 0, FLASHLIGHT_OFF = 0,

24
radio.c
View File

@ -51,7 +51,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 (!IS_MR_CHANNEL(Channel)) if (Channel > MR_CHANNEL_LAST)
return false; return false;
Attributes = gMR_ChannelAttributes[Channel]; Attributes = gMR_ChannelAttributes[Channel];
@ -176,7 +176,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
} }
#endif #endif
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
{ {
Channel = RADIO_FindNextChannel(Channel, RADIO_CHANNEL_UP, false, VFO); Channel = RADIO_FindNextChannel(Channel, RADIO_CHANNEL_UP, false, VFO);
if (Channel == 0xFF) if (Channel == 0xFF)
@ -200,7 +200,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
uint8_t Index; uint8_t Index;
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
{ {
Channel = gEeprom.FreqChannel[VFO]; Channel = gEeprom.FreqChannel[VFO];
gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO]; gEeprom.ScreenChannel[VFO] = gEeprom.FreqChannel[VFO];
@ -218,7 +218,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
Band = BAND6_400MHz; Band = BAND6_400MHz;
} }
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
{ {
gEeprom.VfoInfo[VFO].Band = Band; gEeprom.VfoInfo[VFO].Band = Band;
gEeprom.VfoInfo[VFO].SCANLIST1_PARTICIPATION = !!(Attributes & MR_CH_SCANLIST1); gEeprom.VfoInfo[VFO].SCANLIST1_PARTICIPATION = !!(Attributes & MR_CH_SCANLIST1);
@ -235,7 +235,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
gEeprom.VfoInfo[VFO].SCANLIST2_PARTICIPATION = bParticipation2; gEeprom.VfoInfo[VFO].SCANLIST2_PARTICIPATION = bParticipation2;
gEeprom.VfoInfo[VFO].CHANNEL_SAVE = Channel; gEeprom.VfoInfo[VFO].CHANNEL_SAVE = Channel;
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
Base = Channel * 16; Base = Channel * 16;
else else
Base = 0x0C80 + ((Channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16); Base = 0x0C80 + ((Channel - FREQ_CHANNEL_FIRST) * 32) + (VFO * 16);
@ -380,13 +380,13 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
if (Frequency >= 10800000 && Frequency < 13600000) if (Frequency >= 10800000 && Frequency < 13600000)
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF; gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
else else
if (!IS_MR_CHANNEL(Channel)) if (Channel > MR_CHANNEL_LAST)
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_FloorToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency, 0); gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_FloorToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency, 0);
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 (IS_MR_CHANNEL(Channel)) if (Channel < MR_CHANNEL_LAST)
{ // 16 bytes allocated to the channel name but only 10 used, the rest are 0's { // 16 bytes allocated to the channel name but only 10 used, the rest are 0's
EEPROM_ReadBuffer(0x0F50 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 0, 8); EEPROM_ReadBuffer(0x0F50 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 0, 8);
EEPROM_ReadBuffer(0x0F58 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 8, 2); EEPROM_ReadBuffer(0x0F58 + (Channel * 16), gEeprom.VfoInfo[VFO].Name + 8, 2);
@ -576,6 +576,9 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false); BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (Bandwidth) switch (Bandwidth)
{ {
default: default:
@ -591,6 +594,8 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
break; break;
} }
#pragma GCC diagnostic pop
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false); BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
BK4819_SetupPowerAmplifier(0, 0); BK4819_SetupPowerAmplifier(0, 0);
@ -825,6 +830,9 @@ void RADIO_SetTxParameters(void)
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false); BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (Bandwidth) switch (Bandwidth)
{ {
default: default:
@ -840,6 +848,8 @@ void RADIO_SetTxParameters(void)
break; break;
} }
#pragma GCC diagnostic pop
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency); BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
// TX compressor // TX compressor

View File

@ -184,10 +184,6 @@ void SETTINGS_SaveSettings(void)
EEPROM_WriteBuffer(0x0F40, State); EEPROM_WriteBuffer(0x0F40, State);
} }
void SETTINGS_LoadChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO)
{
}
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
@ -197,13 +193,13 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
const uint16_t OffsetMR = Channel * 16; const uint16_t OffsetMR = Channel * 16;
uint16_t OffsetVFO = OffsetMR; uint16_t OffsetVFO = OffsetMR;
if (!IS_MR_CHANNEL(Channel)) if (Channel > MR_CHANNEL_LAST)
{ // 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 || Channel > MR_CHANNEL_LAST)
{ // copy VFO to a channel { // copy VFO to a channel
uint8_t State[8]; uint8_t State[8];
@ -228,8 +224,9 @@ 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 (Channel <= MR_CHANNEL_LAST)
{ { // it's a memory channel
#ifndef ENABLE_KEEP_MEM_NAME #ifndef ENABLE_KEEP_MEM_NAME
// clear/reset the channel name // clear/reset the channel name
//memset(&State, 0xFF, sizeof(State)); //memset(&State, 0xFF, sizeof(State));
@ -262,7 +259,7 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
uint8_t Attributes = 0xFF; // default attributes uint8_t Attributes = 0xFF; // default attributes
uint16_t Offset = 0x0D60 + (Channel & ~7u); uint16_t Offset = 0x0D60 + (Channel & ~7u);
Attributes &= ~MR_CH_COMPAND; // default to '0' = compander disabled Attributes &= (uint8_t)(~MR_CH_COMPAND); // default to '0' = compander disabled
EEPROM_ReadBuffer(Offset, State, sizeof(State)); EEPROM_ReadBuffer(Offset, State, sizeof(State));
@ -280,8 +277,9 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
gMR_ChannelAttributes[Channel] = Attributes; gMR_ChannelAttributes[Channel] = Attributes;
// #ifndef ENABLE_KEEP_MEM_NAME // #ifndef ENABLE_KEEP_MEM_NAME
if (IS_MR_CHANNEL(Channel)) if (Channel <= MR_CHANNEL_LAST)
{ { // it's a memory channel
const uint16_t OffsetMR = Channel * 16; const uint16_t OffsetMR = Channel * 16;
if (!keep) if (!keep)
{ // clear/reset the channel name { // clear/reset the channel name

View File

@ -14,6 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
#pragma GCC diagnostic pop
#include <string.h> #include <string.h>
#include <stdlib.h> // abs() #include <stdlib.h> // abs()
@ -42,6 +46,9 @@ center_line_t center_line = CENTER_LINE_NONE;
void UI_drawBars(uint8_t *p, const unsigned int level) void UI_drawBars(uint8_t *p, const unsigned int level)
{ {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (level) switch (level)
{ {
default: default:
@ -54,6 +61,8 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna)); case 1: memmove(p + 0, BITMAP_Antenna, sizeof(BITMAP_Antenna));
case 0: break; case 0: break;
} }
#pragma GCC diagnostic pop
} }
#ifdef ENABLE_AUDIO_BAR #ifdef ENABLE_AUDIO_BAR
@ -214,6 +223,8 @@ void UI_UpdateRSSI(const int16_t rssi, const int vfo)
{ {
#ifdef ENABLE_RSSI_BAR #ifdef ENABLE_RSSI_BAR
(void)vfo; // unused
// optional larger RSSI dBm, S-point and bar level // optional larger RSSI dBm, S-point and bar level
if (center_line != CENTER_LINE_RSSI) if (center_line != CENTER_LINE_RSSI)
@ -333,13 +344,13 @@ void UI_DisplayMain(void)
for (vfo_num = 0; vfo_num < 2; vfo_num++) for (vfo_num = 0; vfo_num < 2; vfo_num++)
{ {
const unsigned int line = (vfo_num == 0) ? line0 : line1; const unsigned int line = (vfo_num == 0) ? line0 : line1;
uint8_t channel = gEeprom.TX_VFO; unsigned int channel = gEeprom.TX_VFO;
// uint8_t tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO; // unsigned int tx_channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
const bool same_vfo = (channel == vfo_num) ? true : false; const bool same_vfo = (channel == vfo_num) ? true : false;
uint8_t *p_line0 = gFrameBuffer[line + 0]; uint8_t *p_line0 = gFrameBuffer[line + 0];
uint8_t *p_line1 = gFrameBuffer[line + 1]; uint8_t *p_line1 = gFrameBuffer[line + 1];
uint8_t mode = 0; unsigned int mode = 0;
uint8_t state; unsigned int state;
if (single_vfo) if (single_vfo)
{ // we're in single VFO mode - screen is dedicated to just one VFO { // we're in single VFO mode - screen is dedicated to just one VFO
@ -457,7 +468,7 @@ void UI_DisplayMain(void)
} }
} }
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) if (gEeprom.ScreenChannel[vfo_num] <= MR_CHANNEL_LAST)
{ // channel mode { // channel mode
const unsigned int x = 2; const unsigned int x = 2;
const bool inputting = (gInputBoxIndex == 0 || gEeprom.TX_VFO != vfo_num) ? false : true; const bool inputting = (gInputBoxIndex == 0 || gEeprom.TX_VFO != vfo_num) ? false : true;
@ -508,7 +519,7 @@ void UI_DisplayMain(void)
if (state != VFO_STATE_NORMAL) if (state != VFO_STATE_NORMAL)
{ {
const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"}; const char *state_list[] = {"", "BUSY", "BAT LOW", "TX DISABLE", "TIMEOUT", "ALARM", "VOLT HIGH"};
if (state >= 0 && state < ARRAY_SIZE(state_list)) if (state < ARRAY_SIZE(state_list))
UI_PrintString(state_list[state], 31, 0, line, 8); UI_PrintString(state_list[state], 31, 0, line, 8);
} }
else else
@ -528,8 +539,8 @@ void UI_DisplayMain(void)
frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency; frequency = gEeprom.VfoInfo[vfo_num].pTX->Frequency;
} }
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo_num])) if (gEeprom.ScreenChannel[vfo_num] <= MR_CHANNEL_LAST)
{ // channel mode { // it's a channel
// show the channel symbols // show the channel symbols
const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]]; const uint8_t attributes = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
@ -546,6 +557,9 @@ void UI_DisplayMain(void)
#endif #endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gEeprom.CHANNEL_DISPLAY_MODE) switch (gEeprom.CHANNEL_DISPLAY_MODE)
{ {
case MDF_FREQUENCY: // show the channel frequency case MDF_FREQUENCY: // show the channel frequency
@ -595,6 +609,8 @@ void UI_DisplayMain(void)
break; break;
} }
#pragma GCC diagnostic pop
} }
else else
{ // frequency mode { // frequency mode
@ -660,7 +676,7 @@ void UI_DisplayMain(void)
const FREQ_Config_t *pConfig = (mode == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX; const FREQ_Config_t *pConfig = (mode == 1) ? gEeprom.VfoInfo[vfo_num].pTX : gEeprom.VfoInfo[vfo_num].pRX;
const unsigned int code_type = pConfig->CodeType; const unsigned int code_type = pConfig->CodeType;
const char *code_list[] = {"", "CT", "DCS", "DCR"}; const char *code_list[] = {"", "CT", "DCS", "DCR"};
if (code_type >= 0 && code_type < ARRAY_SIZE(code_list)) if (code_type < ARRAY_SIZE(code_list))
strcpy(String, code_list[code_type]); strcpy(String, code_list[code_type]);
} }
UI_PrintStringSmall(String, LCD_WIDTH + 24, 0, line + 1); UI_PrintStringSmall(String, LCD_WIDTH + 24, 0, line + 1);
@ -669,7 +685,7 @@ void UI_DisplayMain(void)
{ // show the TX power { // show the TX power
const char pwr_list[] = "LMH"; const char pwr_list[] = "LMH";
const unsigned int i = gEeprom.VfoInfo[vfo_num].OUTPUT_POWER; const unsigned int i = gEeprom.VfoInfo[vfo_num].OUTPUT_POWER;
String[0] = (i >= 0 && i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0'; String[0] = (i < ARRAY_SIZE(pwr_list)) ? pwr_list[i] : '\0';
String[1] = '\0'; String[1] = '\0';
UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, line + 1); UI_PrintStringSmall(String, LCD_WIDTH + 46, 0, line + 1);
} }

View File

@ -436,6 +436,9 @@ void UI_DisplayMenu(void)
bool already_printed = false; bool already_printed = false;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
switch (gMenuCursor) switch (gMenuCursor)
{ {
case MENU_SQL: case MENU_SQL:
@ -806,6 +809,8 @@ void UI_DisplayMenu(void)
} }
} }
#pragma GCC diagnostic pop
if (!already_printed) if (!already_printed)
{ // we now do multi-line text in a single string { // we now do multi-line text in a single string