fix(wio-tracker-l2): USB power detection works - charge bolt, Power row, GPS hint

- The AW35615 USB-C controller (FUSB302-style registers, ID 0x91) only
  reports VBUSOK with its measure block on; POWER resets to bandgap only,
  so isExternalPowered() was always false. Board init turns it on
- Status bar shows a charge bolt on the cable, Diagnostics > Live has a
  Power row, the GPS screen notes that charging disturbs GPS, and the
  low-battery warning is skipped on USB as intended
- Roadmap: USB detection closed; GPS indoors still worse than the L1
  even on battery, left open for later

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-09-26 22:12:05 +02:00
co-authored by Claude Opus 5.5
parent 70921cd865
commit f849ee0b00
6 changed files with 45 additions and 16 deletions
@@ -10,7 +10,7 @@ namespace diagview {
enum : uint8_t { TAB_LIVE, TAB_SYSTEM, TAB_FONT, TAB_COUNT };
static uint8_t s_tab = TAB_LIVE; // kept across visits
static lv_obj_t* s_list = nullptr;
static const int EXTRA = 3; // GPS, last reset, last crash (L2 only)
static const int EXTRA = 4; // GPS, power, last reset, last crash (L2 only)
static lv_obj_t* s_vals[diag::MAX_ROWS + EXTRA];
static int s_rows = 0;
@@ -34,6 +34,7 @@ static int allRows(diag::Row* rows, bool gps_on) {
if (!gps_on) extraRow(rows, n, "GPS", "off");
else if (!data) extraRow(rows, n, "GPS", "no data (%lu B)", (unsigned long)c);
else extraRow(rows, n, "GPS", "%s, %ld sats", gps.isValid() ? "fix" : "no fix", gps.satellitesCount());
extraRow(rows, n, "Power", "%s", board.isExternalPowered() ? "USB" : "battery");
#else
(void)gps_on;
#endif
+5 -1
View File
@@ -348,7 +348,7 @@ void UITask::refreshGps() {
if (off) lv_obj_remove_flag(s_on_btn, LV_OBJ_FLAG_HIDDEN);
else lv_obj_add_flag(s_on_btn, LV_OBJ_FLAG_HIDDEN);
char used[48] = "", info[200] = "";
char used[48] = "", info[240] = "";
if (!g) {
lv_label_set_text(s_status, "Not available");
lv_obj_set_style_text_color(s_status, lv_color_hex(theme::TEXT_MUTED), 0);
@@ -387,6 +387,10 @@ void UITask::refreshGps() {
o += snprintf(info + o, sizeof(info) - o, "%.0f m - %.1f km/h\n", g->alt_m, g->speed_kmh);
if (g->utc_valid) o += snprintf(info + o, sizeof(info) - o, "UTC %02u:%02u:%02u", g->utc_h, g->utc_m, g->utc_s);
}
if (g && !off && _board->isExternalPowered()) { // measured: on the cable the L76K never decodes indoors
size_t o = strlen(info);
snprintf(info + o, sizeof(info) - o, "%sOn USB power: charging disturbs GPS", o ? "\n" : "");
}
lv_label_set_text(s_used, used);
lv_label_set_text(s_info, info);
+1 -1
View File
@@ -616,7 +616,7 @@ void UITask::refreshStatusBar() {
case battery::VOLTAGE: snprintf(level, sizeof(level), " %u.%02u V", mv / 1000, (mv % 1000) / 10); break;
default: break;
}
lv_label_set_text_fmt(_status_batt, "%s%s", batt, level);
lv_label_set_text_fmt(_status_batt, "%s%s%s", _board->isExternalPowered() ? LV_SYMBOL_CHARGE " " : "", batt, level);
// Status icons, as the original's status bar (ui-new): Bluetooth (bright
// when the app is connected), GPS (green with a fix), the alarm, mute, then