fix: meshcore serial connection and battery calculation issues

- Fix _pollUntilConnected overwriting real error with generic timeout
  message — stop polling once backend reaches error state
- Fix battery % calculation: was battery_mv/42 (71% at empty); now
  (battery_mv-3000)/12 for a proper 0-100% LiPo curve
- Improve auto-detect: scan available ports rather than blindly using
  /dev/ttyUSB0; update label to show fallback so users know what to expect
- Add port refresh button (↻) — previously required switching modes
  and back if device was plugged in after panel opened
- Add baud rate selector to serial config strip (default 115200,
  options up to 921600) and wire it through to the connect request

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
James Smith
2026-07-01 14:22:10 +01:00
parent 7e50df25c9
commit 2f2d0dac9b
3 changed files with 34 additions and 5 deletions
+7
View File
@@ -22,6 +22,13 @@
<select id="meshcorePortSelect" class="meshcore-strip-select">
<option value="">Auto-detect</option>
</select>
<button class="meshcore-strip-btn" onclick="MeshCore.refreshPorts()" title="Refresh port list"></button>
<select id="meshcoreBaudSelect" class="meshcore-strip-select" style="width:90px;">
<option value="115200" selected>115200</option>
<option value="921600">921600</option>
<option value="57600">57600</option>
<option value="38400">38400</option>
</select>
</div>
<div id="meshcoreTcpConfig" class="meshcore-strip-group" style="display:none;">
<input id="meshcoreTcpHost" type="text" placeholder="Host / IP" value="localhost" class="meshcore-strip-input" style="width:120px;">