From dbf2c43f7dac437c809a91f263a60b48804e435e Mon Sep 17 00:00:00 2001 From: Kaj Schittecat Date: Fri, 28 Aug 2026 16:31:11 +0200 Subject: [PATCH] web: stop the remote UI rounding the bandwidth to a whole number (#345) bradhawkins85: a T-Deck on BW 62.5 shows 62 in the remote web settings, and applying anything from that form sends 62 back to the radio. So opening the page and pressing Apply silently reconfigures the radio onto a bandwidth the mesh is not using. Two independent halves, both needed: - The settings JSON emitted "bw":%.0f, so 62.5 was already 62 before the browser saw it. Now %.1f. - The form's bandwidth input had no step attribute, so it defaults to step=1 and a decimal is invalid. The frequency field beside it has step=0.001; this one was simply missed. Now step=0.1. The apply path was never wrong: it parses with %f and passes a float through. Only the outbound direction lost the fraction, which is why it looked like a display quirk while actually changing the radio. Co-Authored-By: Claude Opus 5 --- src/helpers/esp32/WebSocketCompanionServer.cpp | 2 +- src/ui-touch/UITask.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/esp32/WebSocketCompanionServer.cpp b/src/helpers/esp32/WebSocketCompanionServer.cpp index 962eb96..2692bc5 100644 --- a/src/helpers/esp32/WebSocketCompanionServer.cpp +++ b/src/helpers/esp32/WebSocketCompanionServer.cpp @@ -374,7 +374,7 @@ static const char WS_HTML_TERMINAL_PAGE[] = "function showSettings(d){var g=E;\n" " var h='
';\n" " h+='
';\n" - " h+='
';\n" + " h+='
';\n" " h+='
';\n" " h+='
';\n" " h+='
Wi-Fi
';\n" diff --git a/src/ui-touch/UITask.cpp b/src/ui-touch/UITask.cpp index e842078..e402bf1 100644 --- a/src/ui-touch/UITask.cpp +++ b/src/ui-touch/UITask.cpp @@ -19887,7 +19887,7 @@ static void webPushSettings() { const bool wc = (WiFi.status() == WL_CONNECTED); char* p = s_webdata_buf; const char* e = s_webdata_buf + WEBDATA_BUF; p += snprintf(p, e - p, - "{\"t\":\"sg\",\"freq\":%.3f,\"bw\":%.0f,\"sf\":%d,\"cr\":%d,\"tx\":%d,\"wifi\":%d,\"ble\":%d,\"blecap\":%d,\"tcp\":%d,\"name\":\"", + "{\"t\":\"sg\",\"freq\":%.3f,\"bw\":%.1f,\"sf\":%d,\"cr\":%d,\"tx\":%d,\"wifi\":%d,\"ble\":%d,\"blecap\":%d,\"tcp\":%d,\"name\":\"", pr ? pr->freq : 0.0f, pr ? pr->bw : 0.0f, pr ? pr->sf : 0, pr ? pr->cr : 0, pr ? (int)pr->tx_power_dbm : 0, wc ? 1 : 0, g_lv.task->isBleEnabled() ? 1 : 0, g_lv.task->hasBleCapability() ? 1 : 0, g_lv.task->isTcpEnabled() ? 1 : 0);