Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/detect/ScanI2CTwoWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions src/gps/GPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down
25 changes: 13 additions & 12 deletions src/graphics/SharedUIDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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, "%");
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/draw/DebugRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/draw/NotificationRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
20 changes: 8 additions & 12 deletions src/graphics/draw/UIRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/mesh/aes-ccm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 5 additions & 6 deletions src/modules/CannedMessageModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, ">");
Expand Down Expand Up @@ -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");
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/modules/TrafficManagementModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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++) {
Expand Down
6 changes: 3 additions & 3 deletions src/nimble/NimbleBluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know what the behavioral differences are between this and the old methods?

}

void requestLowerPowerConnection(uint16_t conn_handle)
Expand All @@ -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);
}
};

Expand Down Expand Up @@ -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)
Expand Down
Loading