From 4e0760eaec4884172343c8660ef70ae9083cb539 Mon Sep 17 00:00:00 2001 From: Peter Feerick <5500713+pfeerick@users.noreply.github.com> Date: Sun, 23 Aug 2026 04:24:55 +0000 Subject: [PATCH 1/5] fix(cli): drop dead spModuleInit/DeInit compiled on EXTERNAL_MODULE-only targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The internal/external module OR-guard was added in #5703 without a matching case for HARDWARE_EXTERNAL_MODULE-only targets (pl18/pl18ev/pl18u) in cliSerialPassthrough's switch — the functions were compiled but never called there, producing -Wunused-function warnings. Serial passthrough over an external module isn't implemented yet, so narrow the guard to match the only call site. Co-Authored-By: Claude Sonnet 5 --- radio/src/cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/cli.cpp b/radio/src/cli.cpp index af6f62bd36c..d895b0ca9ee 100644 --- a/radio/src/cli.cpp +++ b/radio/src/cli.cpp @@ -1233,7 +1233,7 @@ static void _sp_Tx(uint8_t* buf, uint32_t len) } } -#if defined(HARDWARE_INTERNAL_MODULE) || defined(HARDWARE_EXTERNAL_MODULE) +#if defined(HARDWARE_INTERNAL_MODULE) static etx_module_state_t *spModuleState = nullptr; static void spModuleInit(int port_n, int baudrate) From e94d3facbd6d27b5ef0aa85d8244741faba3d57c Mon Sep 17 00:00:00 2001 From: Peter Feerick <5500713+pfeerick@users.noreply.github.com> Date: Sun, 23 Aug 2026 04:25:43 +0000 Subject: [PATCH 2/5] fix(lua): avoid always-true BLING_LED_STRIP_LENGTH comparison on bling-less targets Introduced in #6095: on targets with only a CFS LED strip and no bling strip (BLING_LED_STRIP_LENGTH == 0, e.g. gx12/mt12/tx12mk2/boxer sharing the RADIO_GX12 hal config), `id >= BLING_LED_STRIP_LENGTH` is always true for the unsigned uint8_t id, triggering -Wtype-limits. Nest the bling-specific check and offset adjustment inside their own BLING_LED_STRIP_LENGTH > 0 guard, with an early return for the bling case, so bling-less targets never compile the tautological comparison at all; the CFS-handling body stays written once, shared by both paths, matching existing runtime behavior. Co-Authored-By: Claude Sonnet 5 --- radio/src/lua/api_general.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index 0e54c7b3011..e2f5542a790 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -2935,18 +2935,20 @@ static int luaSetRgbLedColor(lua_State * L) uint8_t b = luaL_checkunsigned(L, 4); #if CFS_LED_STRIP_LENGTH > 0 - if (id >= BLING_LED_STRIP_LENGTH) { - id -= BLING_LED_STRIP_LENGTH; - uint8_t swIdx = switchGetSwitchFromCustomIdx(id / CFS_LEDS_PER_SWITCH); - if (g_model.getSwitchType(swIdx) == SWITCH_NONE) { - rgbSetLedColor(id + CFS_LED_STRIP_START, r, g, b); - } else { - lua_pushboolean(L, false); - return 1; - } - } else { +#if BLING_LED_STRIP_LENGTH > 0 + if (id < BLING_LED_STRIP_LENGTH) { rgbSetLedColor(id + BLING_LED_STRIP_START, r, g, b); + lua_pushboolean(L, true); + return 1; + } + id -= BLING_LED_STRIP_LENGTH; +#endif + uint8_t swIdx = switchGetSwitchFromCustomIdx(id / CFS_LEDS_PER_SWITCH); + if (g_model.getSwitchType(swIdx) != SWITCH_NONE) { + lua_pushboolean(L, false); + return 1; } + rgbSetLedColor(id + CFS_LED_STRIP_START, r, g, b); #else rgbSetLedColor(id + BLING_LED_STRIP_START, r, g, b); #endif From f4495db38af3b529c38beb6850f1f3af4137f30b Mon Sep 17 00:00:00 2001 From: Peter Feerick <5500713+pfeerick@users.noreply.github.com> Date: Sun, 23 Aug 2026 04:25:58 +0000 Subject: [PATCH 3/5] fix(pa01): avoid always-true LED_CHARGING_START comparison in ledChargingInfo Introduced in #6392: pa01 defines LED_CHARGING_START as 0, so `i >= LED_CHARGING_START` with the loop's unsigned uint8_t i is always true, triggering -Wtype-limits. Use a plain int loop variable so the comparisons are ordinary signed comparisons instead of testing a constant. Co-Authored-By: Claude Sonnet 5 --- radio/src/targets/pa01/battery_driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/targets/pa01/battery_driver.cpp b/radio/src/targets/pa01/battery_driver.cpp index 184ca7632b2..7a0216801e6 100644 --- a/radio/src/targets/pa01/battery_driver.cpp +++ b/radio/src/targets/pa01/battery_driver.cpp @@ -220,7 +220,7 @@ void ledChargingInfo(uint16_t chargeState) { ledIdx = LED_CHARGING_START; else ledIdx += LED_CHARGING_START > LED_CHARGING_END ? -1 : 1; - for (uint8_t i = 0; i < LED_STRIP_LENGTH; i++) { + for (int i = 0; i < LED_STRIP_LENGTH; i++) { uint8_t green = 0; if (CHARGE_FINISHED == chargeState) { if (LED_CHARGING_START > LED_CHARGING_END && i <= LED_CHARGING_START && i >= LED_CHARGING_END) From 8309ba543d42b8aeba6142b1fa4352d5ed5b4a7c Mon Sep 17 00:00:00 2001 From: Peter Feerick <5500713+pfeerick@users.noreply.github.com> Date: Sun, 23 Aug 2026 06:51:41 +0000 Subject: [PATCH 4/5] fix(v12): drop dead SDRAM busy-wait scaffolding in SDRAM_InitSequence Introduced already-dead in #7114: the `timeout` variable and its four busy-wait loops were commented out from the start (copy-pasted from a pre-#6952 st16/pa01 sdram_driver.cpp), leaving `timeout` unused and triggering -Wunused-variable. No H750 target actually polls the SDRAM BUSY flag - they all rely on the delay_ms(100) after CLK_ENABLE - so this just catches helloradio-h750 up to jumper-h750/rm-h750/c14, which already dropped the same dead block outright rather than commenting it out (as #6952 did for st16/pa01). Co-Authored-By: Claude Sonnet 5 --- .../boards/helloradio-h750/sdram_driver.cpp | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/radio/src/boards/helloradio-h750/sdram_driver.cpp b/radio/src/boards/helloradio-h750/sdram_driver.cpp index fc66af9c9e5..e8e51a7ad81 100644 --- a/radio/src/boards/helloradio-h750/sdram_driver.cpp +++ b/radio/src/boards/helloradio-h750/sdram_driver.cpp @@ -110,7 +110,6 @@ extern "C" void SDRAM_InitSequence(void) { FMC_SDRAM_CommandTypeDef FMC_SDRAMCommandStructure; uint32_t tmpr = 0; - uint32_t timeout = SDRAM_TIMEOUT; /* Step 3 --------------------------------------------------------------------*/ /* Configure a clock configuration enable command */ @@ -118,12 +117,6 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1; FMC_SDRAMCommandStructure.AutoRefreshNumber = 1; FMC_SDRAMCommandStructure.ModeRegisterDefinition = 0; - /* Wait until the SDRAM controller is ready */ - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && - // (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); @@ -137,15 +130,8 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1; FMC_SDRAMCommandStructure.AutoRefreshNumber = 1; FMC_SDRAMCommandStructure.ModeRegisterDefinition = 0; - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); - // delay_ms(1); /* Step 6 --------------------------------------------------------------------*/ /* Configure a Auto-Refresh command */ @@ -154,16 +140,8 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.AutoRefreshNumber = 8; FMC_SDRAMCommandStructure.ModeRegisterDefinition = 0; - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && - // (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); - // delay_ms(1); /* Step 7 --------------------------------------------------------------------*/ /* Program the external memory mode register */ @@ -179,15 +157,8 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.AutoRefreshNumber = 1; FMC_SDRAMCommandStructure.ModeRegisterDefinition = tmpr; - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); - // delay_ms(1); /* Step 8 --------------------------------------------------------------------*/ /* Set the refresh rate counter */ @@ -195,13 +166,6 @@ extern "C" void SDRAM_InitSequence(void) /* Set the device refresh counter */ FMC_SDRAM_SetAutoRefreshNumber(FMC_Bank5_6_R, 15); FMC_SDRAM_ProgramRefreshRate(FMC_Bank5_6_R, 1855); - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && (timeout > 0)) - // { - // timeout--; - // } - // delay_ms(1); } extern "C" void SDRAM_Init(void) From a752fd7830e690c750a4fda2296d41b925b800f7 Mon Sep 17 00:00:00 2001 From: Peter Feerick <5500713+pfeerick@users.noreply.github.com> Date: Sun, 23 Aug 2026 07:11:47 +0000 Subject: [PATCH 5/5] chore(sdram): drop dead SDRAM busy-wait scaffolding on pa01/st16 Same dead code as helloradio-h750 (fixed in 8309ba543d): the commented-out `timeout`/busy-wait blocks in SDRAM_InitSequence() left over from before #6952 commented out just the declaration on these two targets seven months ago, but never removed the four dead wait-loop comment blocks themselves. No functional change - the loops were already commented out - this just brings pa01/st16 in line with jumper-h750/rm-h750/c14, which never had this scaffolding in the first place. Co-Authored-By: Claude Sonnet 5 --- radio/src/targets/pa01/sdram_driver.cpp | 32 ------------------------- radio/src/targets/st16/sdram_driver.cpp | 32 ------------------------- 2 files changed, 64 deletions(-) diff --git a/radio/src/targets/pa01/sdram_driver.cpp b/radio/src/targets/pa01/sdram_driver.cpp index 187a5c35f2b..45defc5f5cd 100644 --- a/radio/src/targets/pa01/sdram_driver.cpp +++ b/radio/src/targets/pa01/sdram_driver.cpp @@ -111,7 +111,6 @@ extern "C" void SDRAM_InitSequence(void) { FMC_SDRAM_CommandTypeDef FMC_SDRAMCommandStructure; uint32_t tmpr = 0; - // uint32_t timeout = SDRAM_TIMEOUT; /* Step 3 --------------------------------------------------------------------*/ /* Configure a clock configuration enable command */ @@ -119,12 +118,6 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1; FMC_SDRAMCommandStructure.AutoRefreshNumber = 1; FMC_SDRAMCommandStructure.ModeRegisterDefinition = 0; - /* Wait until the SDRAM controller is ready */ - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && - // (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); @@ -138,12 +131,6 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1; FMC_SDRAMCommandStructure.AutoRefreshNumber = 1; FMC_SDRAMCommandStructure.ModeRegisterDefinition = 0; - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); // delay_ms(1); @@ -155,13 +142,6 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.AutoRefreshNumber = 8; FMC_SDRAMCommandStructure.ModeRegisterDefinition = 0; - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && - // (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); // delay_ms(1); @@ -180,12 +160,6 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.AutoRefreshNumber = 1; FMC_SDRAMCommandStructure.ModeRegisterDefinition = tmpr; - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); // delay_ms(1); @@ -196,12 +170,6 @@ extern "C" void SDRAM_InitSequence(void) /* Set the device refresh counter */ FMC_SDRAM_SetAutoRefreshNumber(FMC_Bank5_6_R, 15); FMC_SDRAM_ProgramRefreshRate(FMC_Bank5_6_R, 1855); - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && (timeout > 0)) - // { - // timeout--; - // } // delay_ms(1); } diff --git a/radio/src/targets/st16/sdram_driver.cpp b/radio/src/targets/st16/sdram_driver.cpp index d62a6f18bcb..d9adf7337ae 100644 --- a/radio/src/targets/st16/sdram_driver.cpp +++ b/radio/src/targets/st16/sdram_driver.cpp @@ -110,7 +110,6 @@ extern "C" void SDRAM_InitSequence(void) { FMC_SDRAM_CommandTypeDef FMC_SDRAMCommandStructure; uint32_t tmpr = 0; - // uint32_t timeout = SDRAM_TIMEOUT; /* Step 3 --------------------------------------------------------------------*/ /* Configure a clock configuration enable command */ @@ -118,12 +117,6 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1; FMC_SDRAMCommandStructure.AutoRefreshNumber = 1; FMC_SDRAMCommandStructure.ModeRegisterDefinition = 0; - /* Wait until the SDRAM controller is ready */ - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && - // (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); @@ -137,12 +130,6 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1; FMC_SDRAMCommandStructure.AutoRefreshNumber = 1; FMC_SDRAMCommandStructure.ModeRegisterDefinition = 0; - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); // delay_ms(1); @@ -154,13 +141,6 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.AutoRefreshNumber = 8; FMC_SDRAMCommandStructure.ModeRegisterDefinition = 0; - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && - // (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); // delay_ms(1); @@ -179,12 +159,6 @@ extern "C" void SDRAM_InitSequence(void) FMC_SDRAMCommandStructure.AutoRefreshNumber = 1; FMC_SDRAMCommandStructure.ModeRegisterDefinition = tmpr; - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && (timeout > 0)) - // { - // timeout--; - // } /* Send the command */ FMC_SDRAM_SendCommand(FMC_Bank5_6_R, &FMC_SDRAMCommandStructure, 10); // delay_ms(1); @@ -195,12 +169,6 @@ extern "C" void SDRAM_InitSequence(void) /* Set the device refresh counter */ FMC_SDRAM_SetAutoRefreshNumber(FMC_Bank5_6_R, 15); FMC_SDRAM_ProgramRefreshRate(FMC_Bank5_6_R, 1855); - /* Wait until the SDRAM controller is ready */ - // timeout = SDRAM_TIMEOUT; - // while((__FMC_SDRAM_GET_FLAG(FMC_Bank5_6_R, FMC_SDRAM_FLAG_BUSY) != 0) && (timeout > 0)) - // { - // timeout--; - // } // delay_ms(1); }