diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index 151e559f15b..24da97223a2 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -416,6 +416,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) if (type == DPS310 || type == SPA06) { break; } + [[fallthrough]]; default: registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x00), 1); // GET_ID switch (registerValue) { diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 0a942f10dc0..6c6591d7571 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -719,12 +719,15 @@ bool GPS::verifyCachedProbePresence() break; case GNSS_MODEL_MTK_L76B: cachedProbeModelName = "L76B"; + [[fallthrough]]; case GNSS_MODEL_MTK_PA1010D: if (cachedProbeModel == GNSS_MODEL_MTK_PA1010D) cachedProbeModelName = "PA1010D"; + [[fallthrough]]; case GNSS_MODEL_MTK_PA1616S: if (cachedProbeModel == GNSS_MODEL_MTK_PA1616S) cachedProbeModelName = "PA1616S"; + [[fallthrough]]; case GNSS_MODEL_LS20031: if (cachedProbeModel == GNSS_MODEL_LS20031) cachedProbeModelName = "LS20031"; @@ -733,6 +736,7 @@ bool GPS::verifyCachedProbePresence() break; case GNSS_MODEL_AG3335: cachedProbeModelName = "AG3335"; + [[fallthrough]]; case GNSS_MODEL_AG3352: if (cachedProbeModel == GNSS_MODEL_AG3352) cachedProbeModelName = "AG3352"; diff --git a/src/graphics/SharedUIDisplay.cpp b/src/graphics/SharedUIDisplay.cpp index 88ba3f96b56..5d157854759 100644 --- a/src/graphics/SharedUIDisplay.cpp +++ b/src/graphics/SharedUIDisplay.cpp @@ -118,7 +118,7 @@ void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const char *ti const int screenW = display->getWidth(); const int screenH = display->getHeight(); const int headerHeight = highlightHeight + 2; - const uint16_t headerColorForRoles = getThemeHeaderBg(); + [[maybe_unused]] const uint16_t headerColorForRoles = getThemeHeaderBg(); // Color TFT headers use a fixed dark background + white glyphs. // Keep legacy inverted bitmap behavior only for monochrome displays. const bool useInvertedHeaderStyle = (isInverted && !force_no_invert && !isTFTColoringEnabled() && !transparent_background); @@ -131,10 +131,11 @@ void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const char *ti #endif { - const uint16_t headerColor = getThemeHeaderBg(); + [[maybe_unused]] const uint16_t headerColor = getThemeHeaderBg(); const uint16_t headerTextColor = getThemeHeaderText(); - const uint16_t headerTitleColorForRole = use_title_color_override ? title_color_override : headerTextColor; - uint16_t headerStatusColor = getThemeHeaderStatus(); + [[maybe_unused]] const uint16_t headerTitleColorForRole = + use_title_color_override ? title_color_override : headerTextColor; + [[maybe_unused]] uint16_t headerStatusColor = getThemeHeaderStatus(); #if GRAPHICS_TFT_COLORING_ENABLED // Clock frame uses transparent header + date + empty title. // For accent clock themes (Pink/Creamsicle + classic monochrome), tint @@ -232,11 +233,11 @@ void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const char *ti bool useHorizontalBattery = (currentResolution == ScreenResolution::High && screenW >= screenH); const int textY = y + (highlightHeight - FONT_HEIGHT_SMALL) / 2; - bool hasBatteryFillRegion = false; - int16_t batteryFillRegionX = 0; - int16_t batteryFillRegionY = 0; - int16_t batteryFillRegionW = 0; - int16_t batteryFillRegionH = 0; + [[maybe_unused]] bool hasBatteryFillRegion = false; + [[maybe_unused]] int16_t batteryFillRegionX = 0; + [[maybe_unused]] int16_t batteryFillRegionY = 0; + [[maybe_unused]] int16_t batteryFillRegionW = 0; + [[maybe_unused]] int16_t batteryFillRegionH = 0; #if GRAPHICS_TFT_COLORING_ENABLED uint16_t batteryFillColor = getThemeBatteryFillColor(chargePercent); if (useClockHeaderAccent) { @@ -316,7 +317,7 @@ void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const char *ti char chargeStr[4]; snprintf(chargeStr, sizeof(chargeStr), "%d", chargePercent); int chargeNumWidth = display->getStringWidth(chargeStr); - const int percentWidth = display->getStringWidth("%"); + [[maybe_unused]] const int percentWidth = display->getStringWidth("%"); const int percentX = batteryX + chargeNumWidth - 1; display->drawString(batteryX, textY, chargeStr); display->drawString(percentX, textY, "%"); @@ -569,8 +570,8 @@ void drawCommonFooter(OLEDDisplay *display, int16_t x, int16_t y) const int footerH = (connection_icon_height * scale) + (2 * scale); const int iconX = 0; const int iconY = SCREEN_HEIGHT - (connection_icon_height * scale); - const int iconW = connection_icon_width * scale; - const int iconH = connection_icon_height * scale; + [[maybe_unused]] const int iconW = connection_icon_width * scale; + [[maybe_unused]] const int iconH = connection_icon_height * scale; #if GRAPHICS_TFT_COLORING_ENABLED // Only tint the link glyph itself on TFT; keep the footer background black. diff --git a/src/graphics/draw/DebugRenderer.cpp b/src/graphics/draw/DebugRenderer.cpp index b4dd5ab8aff..6c0c45ef757 100644 --- a/src/graphics/draw/DebugRenderer.cpp +++ b/src/graphics/draw/DebugRenderer.cpp @@ -466,7 +466,7 @@ void drawLoRaFocused(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int chutil_bar_height = (currentResolution == ScreenResolution::High) ? 12 : 7; int extraoffset = (currentResolution == ScreenResolution::High) ? 6 : 3; int chutil_percent = airTime->channelUtilizationPercent(); - const int raw_chutil_percent = chutil_percent; + [[maybe_unused]] const int raw_chutil_percent = chutil_percent; int centerofscreen = SCREEN_WIDTH / 2; int total_line_content_width = (chUtil_x + chutil_bar_width + display->getStringWidth(chUtilPercentage) + extraoffset) / 2; diff --git a/src/graphics/draw/NotificationRenderer.cpp b/src/graphics/draw/NotificationRenderer.cpp index 98f229b8384..24894176156 100644 --- a/src/graphics/draw/NotificationRenderer.cpp +++ b/src/graphics/draw/NotificationRenderer.cpp @@ -1029,7 +1029,6 @@ void NotificationRenderer::drawNotificationBox(OLEDDisplay *display, OLEDDisplay const int barSpacing = 2; const int barHeightStep = 2; const int gap = 6; - const int maxBarHeight = totalBars * barHeightStep; int textWidth = display->getStringWidth(lineBuffer, strlen(lineBuffer), true); int barsWidth = totalBars * barWidth + (totalBars - 1) * barSpacing + gap; @@ -1054,6 +1053,7 @@ void NotificationRenderer::drawNotificationBox(OLEDDisplay *display, OLEDDisplay } const int activeBars = min(graphics::bannerSignalBars, totalBars); const int regionWidth = activeBars * barWidth + (activeBars - 1) * barSpacing; + const int maxBarHeight = totalBars * barHeightStep; setAndRegisterTFTColorRole(TFTColorRole::SignalBars, signalBarsColor, TFTPalette::Black, baseX, baseY - maxBarHeight, regionWidth, maxBarHeight); } diff --git a/src/graphics/draw/UIRenderer.cpp b/src/graphics/draw/UIRenderer.cpp index 53f016645ca..67715e7fb4c 100644 --- a/src/graphics/draw/UIRenderer.cpp +++ b/src/graphics/draw/UIRenderer.cpp @@ -1209,7 +1209,7 @@ void UIRenderer::drawDeviceFocused(OLEDDisplay *display, OLEDDisplayUiState *sta // === Node Identity === int textWidth = 0; int nameX = 0; - const char *shortName = owner.short_name ? owner.short_name : ""; + const char *shortName = owner.short_name[0] ? owner.short_name : ""; // === ShortName Centered === textWidth = UIRenderer::measureStringWithEmotes(display, shortName); @@ -1252,7 +1252,7 @@ void UIRenderer::drawDeviceFocused(OLEDDisplay *display, OLEDDisplayUiState *sta if (!config.bluetooth.enabled) { extraoffset = (currentResolution == ScreenResolution::High) ? 6 : 1; } - const int raw_chutil_percent = chutil_percent; + [[maybe_unused]] const int raw_chutil_percent = chutil_percent; // With BT disabled we pin this row left to make room for the extra "BT off" indicator. const int starting_position = config.bluetooth.enabled ? x : 0; @@ -1298,7 +1298,7 @@ void UIRenderer::drawDeviceFocused(OLEDDisplay *display, OLEDDisplayUiState *sta int nameX = 0; int yOffset = (currentResolution == ScreenResolution::High) ? 0 : 5; const char *longName = (nodeInfoLiteHasUser(ourNode) && ourNode->long_name[0]) ? ourNode->long_name : ""; - const char *shortName = owner.short_name ? owner.short_name : ""; + const char *shortName = owner.short_name[0] ? owner.short_name : ""; char combinedName[96]; if (longName[0] && shortName[0]) { snprintf(combinedName, sizeof(combinedName), "%s (%s)", longName, shortName); @@ -1507,7 +1507,7 @@ void UIRenderer::drawIconScreen(const char *upperMsg, OLEDDisplay *display, OLED } // Draw version and short name in bottom middle char footer[64]; - if (owner.short_name && owner.short_name[0]) { + if (owner.short_name[0]) { snprintf(footer, sizeof(footer), "%s %s", xstr(APP_VERSION_SHORT), owner.short_name); } else { snprintf(footer, sizeof(footer), "%s", xstr(APP_VERSION_SHORT)); @@ -1550,7 +1550,7 @@ void UIRenderer::drawIconScreen(const char *upperMsg, OLEDDisplay *display, OLED if (gBootSplashBoldPass) { display->drawString(versionX + 1, y + 5, version); } - if (owner.short_name && owner.short_name[0]) { + if (owner.short_name[0]) { const char *shortName = owner.short_name; int shortNameW = UIRenderer::measureStringWithEmotes(display, shortName); int shortNameX = x + SCREEN_WIDTH - shortNameW - 5; @@ -1792,7 +1792,7 @@ void UIRenderer::drawOEMIconScreen(const char *upperMsg, OLEDDisplay *display, O const char *version = xstr(APP_VERSION_SHORT); int versionX = x + SCREEN_WIDTH - display->getStringWidth(version); display->drawString(versionX, y + 0, version); - if (owner.short_name && owner.short_name[0]) { + if (owner.short_name[0]) { const char *shortName = owner.short_name; int shortNameW = UIRenderer::measureStringWithEmotes(display, shortName); int shortNameX = x + SCREEN_WIDTH - shortNameW; @@ -1981,10 +1981,8 @@ void UIRenderer::drawNavigationBar(OLEDDisplay *display, OLEDDisplayUiState *sta // Right arrow if (navBarVisible && pageEnd < totalIcons) { - int baseX = rectX + rectWidth + offset; - int regionX = baseX; - #if GRAPHICS_TFT_COLORING_ENABLED + int regionX = rectX + rectWidth + offset; registerTFTColorRegion(TFTColorRole::NavigationArrow, regionX, top, maxW, halfH); #endif @@ -1993,10 +1991,8 @@ void UIRenderer::drawNavigationBar(OLEDDisplay *display, OLEDDisplayUiState *sta // Left arrow if (navBarVisible && pageStart > 0) { - int baseX = rectX - offset - 1; - int regionX = baseX - maxW + 1; - #if GRAPHICS_TFT_COLORING_ENABLED + int regionX = rectX - offset - 1 - maxW + 1; registerTFTColorRegion(TFTColorRole::NavigationArrow, regionX, top, maxW, halfH); #endif diff --git a/src/mesh/aes-ccm.cpp b/src/mesh/aes-ccm.cpp index 5ed7ff92838..776fe87717d 100644 --- a/src/mesh/aes-ccm.cpp +++ b/src/mesh/aes-ccm.cpp @@ -21,8 +21,8 @@ static int constant_time_compare(const void *a_, const void *b_, size_t len) { /* Cast to volatile to prevent the compiler from optimizing out their comparison. */ - const volatile uint8_t *volatile a = (const volatile uint8_t *volatile)a_; - const volatile uint8_t *volatile b = (const volatile uint8_t *volatile)b_; + const volatile uint8_t *volatile a = (const volatile uint8_t *)a_; + const volatile uint8_t *volatile b = (const volatile uint8_t *)b_; if (len == 0) return 0; if (a == NULL || b == NULL) diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index 7710660547b..709bda51336 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -2066,10 +2066,9 @@ void CannedMessageModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *st int rowHeight = getRowHeightForEmoteText(msg, baseRowSpacing); bool _highlight = (msgIdx == currentMessageIndex); +#ifdef USE_EINK // Vertically center based on rowHeight int textYOffset = (rowHeight - FONT_HEIGHT_SMALL) / 2; - -#ifdef USE_EINK int nextX = x + (_highlight ? 12 : 0); if (_highlight) display->drawString(x + 0, lineY + textYOffset, ">"); @@ -2244,19 +2243,19 @@ ProcessMessage CannedMessageModule::handleReceived(const meshtastic_MeshPacket & snprintf(buf, sizeof(buf), "Message sent to\n#%s\n\nSignal: %s", (channelName && channelName[0]) ? channelName : "unknown", qualityLabel); } else { - snprintf(buf, sizeof(buf), "DM sent to\n@%s\n\nSignal: %s", - (nodeName && nodeName[0]) ? nodeName : "unknown", qualityLabel); + snprintf(buf, sizeof(buf), "DM sent to\n@%s\n\nSignal: %s", nodeName[0] ? nodeName : "unknown", + qualityLabel); } } else if (isAck && !isFromDest) { // Relay ACK banner snprintf(buf, sizeof(buf), "DM Relayed\n(Status Unknown)\n%s\n\nSignal: %s", - (nodeName && nodeName[0]) ? nodeName : "unknown", qualityLabel); + nodeName[0] ? nodeName : "unknown", qualityLabel); } else { if (this->lastSentNode == NODENUM_BROADCAST) { snprintf(buf, sizeof(buf), "Message failed to\n#%s", (channelName && channelName[0]) ? channelName : "unknown"); } else { - snprintf(buf, sizeof(buf), "DM failed to\n@%s", (nodeName && nodeName[0]) ? nodeName : "unknown"); + snprintf(buf, sizeof(buf), "DM failed to\n@%s", nodeName[0] ? nodeName : "unknown"); } } diff --git a/src/modules/TrafficManagementModule.cpp b/src/modules/TrafficManagementModule.cpp index f10a9f0d47e..1de39e5bd91 100644 --- a/src/modules/TrafficManagementModule.cpp +++ b/src/modules/TrafficManagementModule.cpp @@ -864,8 +864,6 @@ int32_t TrafficManagementModule::runOnce() return INT32_MAX; #if TRAFFIC_MANAGEMENT_CACHE_SIZE > 0 - const uint32_t nowMs = TrafficManagementModule::clockMs(); - // Warm-start the next-hop cache from persisted NodeInfoLite hints once nodeDB // is populated. Done here (not in the constructor) so nodeDB has finished // loading. Takes its own lock, so call before acquiring the sweep guard below. @@ -900,7 +898,6 @@ int32_t TrafficManagementModule::runOnce() uint16_t expiredEntries = 0; const uint32_t sweepStartMs = TrafficManagementModule::clockMs(); - const auto &cfg = moduleConfig.traffic_management; concurrency::LockGuard guard(&cacheLock); for (uint16_t i = 0; i < cacheSize(); i++) { diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index 647c1bef88e..7d523bc4863 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -440,7 +440,7 @@ class BluetoothPhoneAPI : public PhoneAPI, public concurrency::OSThread setup. Not worth adjusting much. */ LOG_INFO("BLE requestHighThroughputConnection"); - bleServer->updateConnParams(conn_handle, 6, 12, 0, 600); + bleServer->requestConnParams(conn_handle, 6, 12, 0, 600); } void requestLowerPowerConnection(uint16_t conn_handle) @@ -463,7 +463,7 @@ class BluetoothPhoneAPI : public PhoneAPI, public concurrency::OSThread per second. */ LOG_INFO("BLE requestLowerPowerConnection"); - bleServer->updateConnParams(conn_handle, 24, 40, 2, 600); + bleServer->requestConnParams(conn_handle, 24, 40, 2, 600); } }; @@ -754,7 +754,7 @@ class NimbleBluetoothServerCallback : public BLEServerCallbacks #endif LOG_INFO("BLE conn %u peer MTU %u (target %u)", connHandle, pServer->getPeerMTU(connHandle), kPreferredBleMtu); - pServer->updateConnParams(connHandle, 6, 12, 0, 200); + pServer->requestConnParams(connHandle, 6, 12, 0, 200); } void onDisconnect(BLEServer *pServer, struct ble_gap_conn_desc *desc)