diff --git a/examples/companion_radio/GeoUtils.h b/examples/companion_radio/GeoUtils.h index fdb4e90c..930fe8a9 100644 --- a/examples/companion_radio/GeoUtils.h +++ b/examples/companion_radio/GeoUtils.h @@ -72,11 +72,16 @@ static inline void fmtDist(char* buf, int n, float km, bool imperial, bool space // sender's clock runs a little fast, or ours hasn't synced yet) clamps to // "0s" instead of going blank, since it did just arrive. Takes `now` rather // than reading the RTC itself, so this stays a pure function like the rest -// of this file. +// of this file. An e-ink build says "<1m" for the first minute: a count of +// seconds would refresh the panel every second. static inline void fmtAgeShort(char* buf, int n, uint32_t now, uint32_t lastmod) { if (lastmod == 0) { buf[0] = '\0'; return; } uint32_t age = (now > lastmod) ? (now - lastmod) : 0; +#if defined(EINK_DISPLAY_MODEL) + if (age < 60) snprintf(buf, n, "<1m"); +#else if (age < 60) snprintf(buf, n, "%us", (unsigned)age); +#endif else if (age < 3600) snprintf(buf, n, "%um", (unsigned)(age / 60)); else if (age < 86400) snprintf(buf, n, "%uh", (unsigned)(age / 3600)); else snprintf(buf, n, "%ud", (unsigned)(age / 86400)); diff --git a/examples/companion_radio/ui-new/SkyView.h b/examples/companion_radio/ui-new/SkyView.h index c162368f..c06c65e3 100644 --- a/examples/companion_radio/ui-new/SkyView.h +++ b/examples/companion_radio/ui-new/SkyView.h @@ -105,7 +105,12 @@ namespace skyview { d.setCursor(x0, y); d.print(buf); y += step; if (g.ttff_ms) snprintf(buf, sizeof(buf), "TTFF %lus", (unsigned long)(g.ttff_ms / 1000)); - else if (g.start_ms) snprintf(buf, sizeof(buf), "Wait %lus", (unsigned long)((millis() - g.start_ms) / 1000)); + else if (g.start_ms) { + const unsigned long s = (millis() - g.start_ms) / 1000; + if (!d.isEink()) snprintf(buf, sizeof(buf), "Wait %lus", s); + else if (s < 60) snprintf(buf, sizeof(buf), "Wait <1m"); // in minutes, as the panel refreshes + else snprintf(buf, sizeof(buf), "Wait %lum", s / 60); + } else buf[0] = 0; d.setCursor(x0, y); d.print(buf); } @@ -178,7 +183,7 @@ namespace skyview { } if (signal) renderSignal(d, *g, top); else renderSky(d, *g, top); - return 1000; + return d.isEink() ? 15000 : 1000; // the sky shifts slowly; each e-ink redraw is a refresh } } // namespace skyview diff --git a/examples/companion_radio/ui-new/StatusScreen.h b/examples/companion_radio/ui-new/StatusScreen.h index 00e1c883..779c111c 100644 --- a/examples/companion_radio/ui-new/StatusScreen.h +++ b/examples/companion_radio/ui-new/StatusScreen.h @@ -189,7 +189,12 @@ private: if (g->hdop > 0 && g->hdop < 99) snprintf(a, sizeof(a), "%.1f", g->hdop); else strcpy(a, "-"); row(d, f, rsv, "HDOP", a); if (g->ttff_ms) snprintf(a, sizeof(a), "%lu s", (unsigned long)(g->ttff_ms / 1000)); - else if (g->start_ms) snprintf(a, sizeof(a), "%lu s", (unsigned long)((millis() - g->start_ms) / 1000)); + else if (g->start_ms) { + const unsigned long s = (millis() - g->start_ms) / 1000; + if (!Features::IS_EINK) snprintf(a, sizeof(a), "%lu s", s); + else if (s < 60) strcpy(a, "<1 min"); // seconds would refresh the panel every second + else snprintf(a, sizeof(a), "%lu min", s / 60); + } else strcpy(a, "-"); row(d, f, rsv, g->ttff_ms ? "First fix" : "Searching", a); }