From 02bcec0bd4f44a6b4151f5c093bfe9e6b872cc5e Mon Sep 17 00:00:00 2001 From: Derecho Date: Sun, 11 Feb 2024 13:15:14 +0100 Subject: [PATCH] Fix compilation warnings during linux build --- openrtx/src/core/audio_codec.c | 8 +++++--- openrtx/src/core/voicePromptUtils.c | 2 +- openrtx/src/rtx/OpMode_M17.cpp | 1 + openrtx/src/ui/default/ui_main.c | 2 +- platform/drivers/display/display_libSDL.c | 4 +++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/openrtx/src/core/audio_codec.c b/openrtx/src/core/audio_codec.c index fecd9ca0..1e4de31a 100644 --- a/openrtx/src/core/audio_codec.c +++ b/openrtx/src/core/audio_codec.c @@ -57,9 +57,11 @@ static uint64_t dataBuffer[BUF_SIZE]; static const uint8_t micGainPre = 4; static const uint8_t micGainPost = 3; #else +#ifndef PLATFORM_LINUX static const uint8_t micGainPre = 8; static const uint8_t micGainPost = 4; #endif +#endif static void *encodeFunc(void *arg); static void *decodeFunc(void *arg); @@ -189,7 +191,7 @@ static void *encodeFunc(void *arg) { streamId iStream; - pathId iPath = (pathId) arg; + pathId iPath = *((pathId*) arg); stream_sample_t audioBuf[320]; struct CODEC2 *codec2; filter_state_t dcrState; @@ -269,7 +271,7 @@ static void *encodeFunc(void *arg) static void *decodeFunc(void *arg) { streamId oStream; - pathId oPath = (pathId) arg; + pathId oPath = *((pathId*) arg); stream_sample_t audioBuf[320]; struct CODEC2 *codec2; @@ -411,7 +413,7 @@ static bool startThread(const pathId path, void *(*func) (void *)) #endif // Start thread - int ret = pthread_create(&codecThread, &codecAttr, func, ((void *) audioPath)); + int ret = pthread_create(&codecThread, &codecAttr, func, &audioPath); if(ret < 0) running = false; diff --git a/openrtx/src/core/voicePromptUtils.c b/openrtx/src/core/voicePromptUtils.c index ad6b2ee1..f0c25a53 100644 --- a/openrtx/src/core/voicePromptUtils.c +++ b/openrtx/src/core/voicePromptUtils.c @@ -177,7 +177,7 @@ void vp_announcePower(const uint32_t power, const vpQueueFlags_t flags) // Compute x.y format avoiding to pull in floating point math. // Remember that power is expressed in mW! char buffer[16] = "\0"; - sniprintf(buffer, 16, "%lu.%lu", (power / 1000), (power % 1000) / 100); + sniprintf(buffer, 16, "%lu.%lu", (power / 1000lu), (power % 1000lu) / 100lu); vp_queueString(buffer, vpAnnounceCommonSymbols); vp_queuePrompt(PROMPT_WATTS); diff --git a/openrtx/src/rtx/OpMode_M17.cpp b/openrtx/src/rtx/OpMode_M17.cpp index b2198775..de2fd8fc 100644 --- a/openrtx/src/rtx/OpMode_M17.cpp +++ b/openrtx/src/rtx/OpMode_M17.cpp @@ -78,6 +78,7 @@ void OpMode_M17::disable() void OpMode_M17::update(rtxStatus_t *const status, const bool newCfg) { + (void) newCfg; #if defined(PLATFORM_MD3x0) || defined(PLATFORM_MDUV3x0) // // Invert TX phase for all MDx models. diff --git a/openrtx/src/ui/default/ui_main.c b/openrtx/src/ui/default/ui_main.c index 641b2668..8ad1aa59 100644 --- a/openrtx/src/ui/default/ui_main.c +++ b/openrtx/src/ui/default/ui_main.c @@ -193,7 +193,7 @@ void _ui_drawFrequency() // Print big numbers frequency char freq_str[16] = {0}; - sniprintf(freq_str, sizeof(freq_str), "%lu.%lu", (freq / 1000000), (freq % 1000000)); + sniprintf(freq_str, sizeof(freq_str), "%lu.%lu", (freq / 1000000lu), (freq % 1000000lu)); stripTrailingZeroes(freq_str); gfx_print(layout.line3_large_pos, layout.line3_large_font, TEXT_ALIGN_CENTER, diff --git a/platform/drivers/display/display_libSDL.c b/platform/drivers/display/display_libSDL.c index bbd6797f..ed3d43c3 100644 --- a/platform/drivers/display/display_libSDL.c +++ b/platform/drivers/display/display_libSDL.c @@ -43,6 +43,7 @@ extern chan_t fb_sync; /* Shared channel to send a frame buffer update */ /* Custom SDL Event to adjust backlight */ extern Uint32 SDL_Backlight_Event; +#ifndef CONFIG_PIX_FMT_RGB565 /** * @internal * Internal helper function which fetches pixel at position (x, y) from framebuffer @@ -52,6 +53,7 @@ static uint32_t fetchPixelFromFb(unsigned int x, unsigned int y, void *fb) { (void) x; (void) y; + (void) fb; uint32_t pixel = 0; #ifdef CONFIG_PIX_FMT_BW @@ -78,7 +80,7 @@ static uint32_t fetchPixelFromFb(unsigned int x, unsigned int y, void *fb) return pixel; } - +#endif void display_init() {