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 <noreply@anthropic.com>
This commit is contained in:
1 parent
708f4434f5
commit
dbf2c43f7d
2 files changed
+2
-2
No files matched your search
@@ -374,7 +374,7 @@ static const char WS_HTML_TERMINAL_PAGE[] =
|
||||
"function showSettings(d){var g=E;\n"
|
||||
" var h='<div class=sset><label>NODE NAME</label><div class=srow><input type=text id=sfname><button class=sbtn id=sbname>Save</button></div>';\n"
|
||||
" h+='<label>RADIO (applies live)</label><div class=sgrid>';\n"
|
||||
" h+='<div class=f><label>Freq MHz</label><input type=number step=0.001 id=sffreq></div><div class=f><label>BW kHz</label><input type=number id=sfbw></div>';\n"
|
||||
" h+='<div class=f><label>Freq MHz</label><input type=number step=0.001 id=sffreq></div><div class=f><label>BW kHz</label><input type=number step=0.1 id=sfbw></div>';\n"
|
||||
" h+='<div class=f><label>SF</label><input type=number id=sfsf></div><div class=f><label>CR</label><input type=number id=sfcr></div>';\n"
|
||||
" h+='<div class=f><label>TX dBm</label><input type=number id=sftx></div><div class=f><label> </label><button class=sbtn id=sbradio style=width:100%>Apply</button></div></div>';\n"
|
||||
" h+='<label>CONNECTIVITY</label><div class=stog><b>Wi-Fi</b><div class=sw id=swifi><i></i></div></div>';\n"
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user