From 1dfd9b689ecc5dc2dd8e97f3da996d651c357be0 Mon Sep 17 00:00:00 2001 From: Dual Tachyon Date: Tue, 29 Aug 2023 17:16:59 +0100 Subject: [PATCH] Fixed issues found by the superior clang. --- app/app.c | 4 ++-- app/main.c | 4 ++-- app/menu.c | 2 +- app/scanner.c | 4 ++-- audio.c | 1 - driver/keyboard.c | 2 +- driver/keyboard.h | 2 +- dtmf.c | 4 ++-- ui/main.c | 2 +- 9 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app/app.c b/app/app.c index 24238e7..24fff0d 100644 --- a/app/app.c +++ b/app/app.c @@ -1693,7 +1693,7 @@ static void APP_ProcessKey_MAIN(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) } if (g_200003BA != 0 && !bKeyHeld && bKeyPressed) { char Character = DTMF_GetCharacter(Key); - if (Character != 0xFF) { + if (Character != -1) { g_20000396 = 1; XXX_Append(Character); gRequestDisplayScreen = DISPLAY_MAIN; @@ -1822,7 +1822,7 @@ static void APP_ProcessKey_SCANNER(KEY_Code_t Key, bool bKeyPressed, bool bKeyHe case KEY_0: case KEY_1: case KEY_2: case KEY_3: case KEY_4: case KEY_5: case KEY_6: case KEY_7: case KEY_8: case KEY_9: - SCANNER_Key_DIGITS((VOICE_ID_t)Key, bKeyPressed, bKeyHeld); + SCANNER_Key_DIGITS(Key, bKeyPressed, bKeyHeld); break; case KEY_MENU: SCANNER_Key_MENU(bKeyPressed, bKeyHeld); diff --git a/app/main.c b/app/main.c index 68ad76d..5b9ca23 100644 --- a/app/main.c +++ b/app/main.c @@ -78,7 +78,7 @@ void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) uint32_t Frequency; if (gInputBoxIndex < 6) { - gAnotherVoiceID = Key; + gAnotherVoiceID = (VOICE_ID_t)Key; return; } gInputBoxIndex = 0; @@ -114,7 +114,7 @@ void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) uint8_t Channel; if (gInputBoxIndex != 2) { - gAnotherVoiceID = Key; + gAnotherVoiceID = (VOICE_ID_t)Key; gRequestDisplayScreen = DISPLAY_MAIN; return; } diff --git a/app/menu.c b/app/menu.c index 65bca91..5ef685a 100644 --- a/app/menu.c +++ b/app/menu.c @@ -875,7 +875,7 @@ void MENU_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) gInputBoxIndex = 0; Value = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1; if (IS_MR_CHANNEL(Value)) { - gAnotherVoiceID = Key; + gAnotherVoiceID = (VOICE_ID_t)Key; gSubMenuSelection = Value; return; } diff --git a/app/scanner.c b/app/scanner.c index f392b2c..32ac656 100644 --- a/app/scanner.c +++ b/app/scanner.c @@ -33,13 +33,13 @@ void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) INPUTBOX_Append(Key); gRequestDisplayScreen = DISPLAY_SCANNER; if (gInputBoxIndex < 3) { - gAnotherVoiceID = Key; + gAnotherVoiceID = (VOICE_ID_t)Key; return; } gInputBoxIndex = 0; Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1; if (IS_MR_CHANNEL(Channel)) { - gAnotherVoiceID = Key; + gAnotherVoiceID = (VOICE_ID_t)Key; gShowChPrefix = RADIO_CheckValidChannel(Channel, false, 0); gScanChannel = (uint8_t)Channel; return; diff --git a/audio.c b/audio.c index d84ba95..b49432c 100644 --- a/audio.c +++ b/audio.c @@ -293,7 +293,6 @@ void AUDIO_PlayQueuedVoice(void) bool Skip; Skip = false; - gVoiceReadIndex = gVoiceReadIndex; if (gVoiceReadIndex != gVoiceWriteIndex && gEeprom.VOICE_PROMPT != VOICE_PROMPT_OFF) { VoiceID = gVoiceID[gVoiceReadIndex]; if (gEeprom.VOICE_PROMPT == VOICE_PROMPT_CHINESE) { diff --git a/driver/keyboard.c b/driver/keyboard.c index f90c37e..bdfad89 100644 --- a/driver/keyboard.c +++ b/driver/keyboard.c @@ -22,7 +22,7 @@ KEY_Code_t gKeyReading0; KEY_Code_t gKeyReading1; -uint8_t gDebounceCounter; +uint16_t gDebounceCounter; bool gWasFKeyPressed; KEY_Code_t KEYBOARD_Poll(void) diff --git a/driver/keyboard.h b/driver/keyboard.h index 58a7da3..dba318d 100644 --- a/driver/keyboard.h +++ b/driver/keyboard.h @@ -48,7 +48,7 @@ typedef enum KEY_Code_t KEY_Code_t; extern KEY_Code_t gKeyReading0; extern KEY_Code_t gKeyReading1; -extern uint8_t gDebounceCounter; +extern uint16_t gDebounceCounter; extern bool gWasFKeyPressed; KEY_Code_t KEYBOARD_Poll(void); diff --git a/dtmf.c b/dtmf.c index bdcb85a..7ac1479 100644 --- a/dtmf.c +++ b/dtmf.c @@ -27,12 +27,12 @@ bool DTMF_ValidateCodes(char *pCode, uint8_t Size) { uint8_t i; - if (pCode[0] == 0xFF || pCode[0] == 0) { + if (pCode[0] == -1 || pCode[0] == 0) { return false; } for (i = 0; i < Size; i++) { - if (pCode[i] == 0xFF || pCode[i] == 0) { + if (pCode[i] == -1 || pCode[i] == 0) { pCode[i] = 0; break; } diff --git a/ui/main.c b/ui/main.c index 0b5959d..3ebf3e8 100644 --- a/ui/main.c +++ b/ui/main.c @@ -218,7 +218,7 @@ void UI_DisplayMain(void) UI_DisplayFrequency(gInputBox, 31, i * 4, true, false); } else { 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] == -1)) { sprintf(String, "CH-%03d", gEeprom.ScreenChannel[i] + 1); UI_PrintString(String, 31, 112, i * 4, 8, true); } else {