refactor(ui): upstream's UIColor palette in place of the DARK/LIGHT enum

- DisplayDriver takes ColorVal; each driver's .cpp defines the UIColor roles
  (window_bkg, primary_txt, ...) in its own values. ui-new draws in two:
  window_bkg and primary_txt. OLED and e-ink look as before (sim screens
  pixel-identical).
- E213, E290, LGFX, Null, ST7735, ST7789LCD, U8g2 taken whole from upstream
  (with them the rewritten ST7735 driver and the Heltec V4 R8 TFT display).
- SH1106, SSD1306, ST7789, EinkGfxDisplay and the sim drivers converted.
- ui-orig, ui-tiny, simple_* get upstream's colour roles; the repeater's UI
  taken from upstream (its power-off screen).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-15 14:42:04 +02:00
co-authored by Claude Opus 5.5
parent 83ba0161da
commit 8c20914689
69 changed files with 1062 additions and 530 deletions
+1 -1
View File
@@ -230,7 +230,7 @@ void setup() {
#endif
// Three dots mid-screen: no words, so no orientation (the settings aren't read yet).
const int dot = disp->width() >= 240 ? 6 : 3;
disp->setColor(DisplayDriver::LIGHT);
disp->setColor(UIColor::primary_txt);
for (int i = -1; i <= 1; i++)
disp->fillRect(disp->width() / 2 + i * 3 * dot - dot / 2, disp->height() / 2 - dot / 2, dot, dot);
disp->endFrame();
@@ -172,7 +172,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
if (_login_kb) return kb().render(display);
AdminSession::State st = S().state();
@@ -31,7 +31,7 @@ public:
// cycles, Back saves) instead of a screen of its own with typed hints.
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
drawScreenHeader(display, "Auto-advert");
int sel = 0, scroll = 0;
drawList(display, 1, sel, scroll, [&](int, int y, bool is_sel, int reserve) {
@@ -35,7 +35,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
drawScreenHeader(display, "Battery curve");
const int mv = _task->getBattMilliVolts();
const bool custom = _prefs && battery::validCurve(_prefs->batt_curve_mv);
+3 -3
View File
@@ -84,7 +84,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
if (_kb_row >= 0) {
return _kb->render(display);
@@ -103,7 +103,7 @@ public:
if (sent > 0) {
display.setCursor(display.width() - cw - 1, 0);
display.print(cbuf);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
int n = botcfg::rowCount(_tab);
@@ -138,7 +138,7 @@ public:
}
int mqr = info::listRow(display, y, r.label, shown, sel, reserve);
if (mqr > 0) mq_delay = mqr;
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
});
return 2000;
}
@@ -29,7 +29,7 @@ inline void draw(DisplayDriver& d, int x, int y, int w, const struct tm& t, uint
static const char* const INITIALS[] = { "M", "T", "W", "T", "F", "S", "S" };
const int lh = d.getLineHeight(), step = tight ? lh : lh + 2, cw = w / 7;
const int x0 = x + (w - 7 * cw) / 2;
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
for (int c = 0; c < 7; c++) d.drawTextCentered(x0 + c * cw + cw / 2, y, (tight ? INITIALS : NAMES)[c]);
info::rule(d, x0, y + (tight ? lh - 1 : lh + 1), 7 * cw);
const int top = y + (tight ? lh + 1 : step + 3), col0 = firstCol(t), n = daysIn(t.tm_year, t.tm_mon);
@@ -40,17 +40,17 @@ inline void draw(DisplayDriver& d, int x, int y, int w, const struct tm& t, uint
if (today && day == t.tm_mday) {
if (tight) d.fillSoftRect(cx, cy - 1, cw, lh);
else d.fillSoftRect(cx + 1, cy - 1, cw - 2, lh + 2);
d.setColor(DisplayDriver::DARK);
d.setColor(UIColor::window_bkg);
d.drawTextCentered(cx + cw / 2, cy, buf);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
} else {
d.drawTextCentered(cx + cw / 2, cy, buf);
}
if (marked & (1UL << (day - 1))) { // under the number, in the gap below it
const int uw = d.getTextWidth(buf);
d.setColor(today && day == t.tm_mday ? DisplayDriver::DARK : DisplayDriver::LIGHT);
d.setColor(today && day == t.tm_mday ? UIColor::window_bkg : UIColor::primary_txt);
d.fillRect(cx + (cw - uw) / 2, cy + (tight ? lh - 2 : lh), uw, d.sepH());
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
}
}
}
@@ -111,7 +111,7 @@ public:
int render(DisplayDriver& display) {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
if (_kb_active) return kb().render(display);
const int top = display.listStart();
@@ -124,7 +124,7 @@ public:
int y = top + i * step;
display.drawSelectionRow(0, y - 1, display.width(), step - 1, i == _type_sel);
display.drawTextEllipsized(2, y, display.width() - 4, TYPE_LABELS[i]);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
return 1000;
}
@@ -139,7 +139,7 @@ public:
display.drawSelectionRow(0, y - 1, display.width(), step - 1, sel);
int r = info::valueRow(display, y, "Topic", _topic[0] ? _topic : "(none)", sel, 0);
if (r > 0) mq_delay = r;
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
return (mq_delay > 0 && mq_delay < 1000) ? mq_delay : 1000;
}
@@ -157,7 +157,7 @@ public:
: info::valueRow(display, y, _hex_mode ? "Secret (hex)" : "Secret (phrase)",
_secret_text[0] ? _secret_text : "(none)", sel, 0);
if (r > 0) mq_delay = r;
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
return (mq_delay > 0 && mq_delay < 1000) ? mq_delay : 1000;
}
@@ -133,17 +133,17 @@ class ClockToolsScreen : public UIScreen {
for (int k = 0; buf[k]; k++) {
int cx = valx + k * cw;
if (k == char_idx) {
d.setColor(DisplayDriver::DARK);
d.setColor(UIColor::window_bkg);
d.fillSoftRect(cx, y - 1, cw, d.getLineHeight() + 1);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
} else {
d.setColor(DisplayDriver::DARK);
d.setColor(UIColor::window_bkg);
}
char one[2] = { buf[k], '\0' };
d.setCursor(cx, y);
d.print(one);
}
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
}
// ── Sub-renders ───────────────────────────────────────────────────────────
@@ -416,7 +416,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
switch (_view) {
case V_ALARM: return renderAlarm(display);
case V_TIMER: return renderTimer(display);
@@ -31,7 +31,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
drawScreenHeader(display, "Compass");
const int cx = display.width() / 2;
@@ -26,7 +26,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
int item_h = display.lineStep();
int start_y = display.listStart();
int val_x = display.valCol();
@@ -43,7 +43,7 @@ public:
display.setCursor(val_x, y);
uint8_t f = _prefs->dashboard_fields[i];
display.print(telemetry::COMPACT[f < telemetry::COUNT ? f : telemetry::NONE]);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
return 500;
}
@@ -76,16 +76,16 @@ struct DigitEditor {
for (int k = 0; buf[k]; k++) {
int cx = x + k * cw;
if (k == char_idx) {
d.setColor(DisplayDriver::DARK);
d.setColor(UIColor::window_bkg);
d.fillSoftRect(cx, y - 1, cw, d.getLineHeight() + 1);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
} else {
d.setColor(DisplayDriver::DARK);
d.setColor(UIColor::window_bkg);
}
char one[2] = { buf[k], '\0' };
d.setCursor(cx, y);
d.print(one);
}
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
}
};
@@ -13,7 +13,7 @@ public:
int render(DisplayDriver& display) override {
display.setBrightness(4);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.fillRect(0, 0, display.width(), display.height());
return 1000;
}
@@ -134,9 +134,9 @@ struct FullscreenMsgView {
const int startY = header_h + 2;
const int visible = (display.height() - startY - lineH) / lineH;
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.fillRect(0, 0, display.width(), header_h);
display.setColor(DisplayDriver::DARK);
display.setColor(UIColor::window_bkg);
display.drawTextEllipsized(2, 1, display.width() - 4, sender);
if (to_nick[0]) {
char trans_nick[32], to_label[36];
@@ -144,7 +144,7 @@ struct FullscreenMsgView {
snprintf(to_label, sizeof(to_label), "To: %s", trans_nick);
display.drawTextEllipsized(2, lineH + 3, display.width() - 4, to_label);
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.translateUTF8ToBlocks(s_wrap_trans, body, sizeof(s_wrap_trans));
int lcount = wrapLines(display, s_wrap_trans, max_px, s_wrap_lines, 12);
+2 -2
View File
@@ -110,7 +110,7 @@ public:
int render(DisplayDriver& display) override {
buildItems();
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
drawScreenHeader(display, "GPIO");
bool any_live = false;
@@ -128,7 +128,7 @@ public:
} else { // indented: reads as GPIOn's sub-row
info::switchRow(display, y, " State", gpioModeOf(it.pin) == 3, sel, reserve);
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
});
return any_live ? 500 : 2000; // faster refresh only while a row needs a live reading
}
+29 -29
View File
@@ -387,8 +387,8 @@ class HomeScreen : public UIScreen {
for (int i = 0; i < n; i++, y += step) {
const QRow& r = rows[i];
const bool sel = i == _quick_sel;
d.setColor(DisplayDriver::LIGHT);
if (sel) { d.fillSoftRect(m - 3, y - 1, W - 2 * m + 6, lh + 1); d.setColor(DisplayDriver::DARK); }
d.setColor(UIColor::primary_txt);
if (sel) { d.fillSoftRect(m - 3, y - 1, W - 2 * m + 6, lh + 1); d.setColor(UIColor::window_bkg); }
switch (r.kind) {
case Q_SWITCH: info::switchRow(d, y, r.label, r.n != 0, sel, reserve, m); break;
case Q_BAR: {
@@ -424,7 +424,7 @@ class HomeScreen : public UIScreen {
if (q > 0) mq = q;
}
}
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
}
return mq;
}
@@ -545,7 +545,7 @@ class HomeScreen : public UIScreen {
uint8_t mode = battery::mode(_node_prefs ? _node_prefs->batt_display_mode : 0);
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
const int lh = display.getLineHeight();
const int cw = display.getCharWidth();
@@ -726,7 +726,7 @@ public:
if (!init) return false;
// North marker — top-right, the same mini-icon as the full Trail map.
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
{
const int ns = miniIconScale(display);
miniIconDrawTop(display, ax + aw - ICON_MAP_NORTH.w * ns - 1, ay + 1, ICON_MAP_NORTH);
@@ -771,7 +771,7 @@ public:
// status line below instead (see statusDistanceKm() / render()), so this
// corner is free for it.
{
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
int ty = ay + ah - display.getLineHeight();
static const float M_PER_1E6 = 0.11132f; // metres per 1e-6° lat
float ppm = scale / M_PER_1E6; // pixels per metre
@@ -835,7 +835,7 @@ public:
const int rows_h = tall ? 4 * (lh + lh / 2) : 0;
const int ph = H - top - rows_h;
const int pw = tall ? W : wide ? (ph < W * 3 / 5 ? ph : W * 3 / 5) : W / 2; // map panel
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
d.drawSoftRect(0, top, pw, ph);
if (!drawMapPreview(d, 2, top + 2, pw - 4, ph - 4)) {
// An empty sheet: a sparse dot grid with the reason over it.
@@ -843,9 +843,9 @@ public:
for (int gx = 4; gx < pw - 2; gx += 6 * s) d.fillRect(gx, gy, s, s);
const char* why = "No fix";
const int tw = d.getTextWidth(why), tx = (pw - tw) / 2, ty = top + (ph - lh) / 2;
d.setColor(DisplayDriver::DARK);
d.setColor(UIColor::window_bkg);
d.fillRect(tx - 2, ty - 1, tw + 4, lh + 2);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
d.setCursor(tx, ty);
d.print(why);
}
@@ -995,7 +995,7 @@ public:
const bool h12 = _node_prefs && _node_prefs->clock_12h;
const bool show_sec = !Features::IS_EINK && (!_node_prefs || !_node_prefs->clock_hide_seconds);
const int W = d.width(), H = d.height();
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
d.setTextSize(1);
const int lh = d.getLineHeight();
@@ -1066,7 +1066,7 @@ public:
// seconds (UITask::lockHintShown); e-ink keeps it up, it has no glance.
void drawLockPage(DisplayDriver& d) {
const int W = d.width(), H = d.height();
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
d.setTextSize(1);
const int lh = d.getLineHeight(), top = statusBarH(d) + 3;
const bool hint = Features::IS_EINK || _task->lockHintShown();
@@ -1145,9 +1145,9 @@ public:
if (!pill[0]) return;
const int pw = d.getTextWidth(pill) + 6;
d.fillSoftRect((W - pw) / 2, pill_y, pw, lh + 3);
d.setColor(DisplayDriver::DARK);
d.setColor(UIColor::window_bkg);
d.drawTextCentered(W / 2, pill_y + 2, pill);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
}
// Under the lock clock on a tall or a 4.2" screen, between y and bottom: the month,
@@ -1195,7 +1195,7 @@ public:
const int mid_x = W / 2, mid_y = top + H / 2;
const bool roomy = H / 2 >= 7 * lh; // three lines and a chart a tile
StatusScreen* st = (StatusScreen*)_task->statusScreen();
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
info::vrule(d, mid_x, top, H);
info::rule(d, 0, mid_y, W);
// The tile's box, inside the rules.
@@ -1312,12 +1312,12 @@ public:
// Title bar displaying node name (except on lock screen), status icons and battery.
// Hidden on fullscreen pages (CLOCK).
if (_page != CLOCK) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
// The lock page has nothing on the left of the bar (its clock sits
// below it), so the status icons may use the whole row.
const int lock_reserve = _page == LOCK ? 0 : -1;
int rightEdge = renderBatteryIndicator(display, _task->getBattMilliVolts(), lock_reserve);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
if (_page != LOCK) {
const int bar_ty = (statusBarH(display) - lh) / 2; // text centred in a tall bar (STATUS_ICON_SCALE)
@@ -1382,24 +1382,24 @@ public:
for (int i = 0; i < n; i++)
if (order[i] == _slide_from) { pill_x = x + pitch * i + (int)((pill_x - x - pitch * i) * slide + 0.5f); break; }
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.fillSoftRect(pill_x - pw / 2, dots_y - pg_half - pad, pw, pg_half * 2 + 1 + 2 * pad);
for (int i = 0; i < n; i++) {
const MiniIcon* ic = pageIcon(order[i]);
const int d2 = 2 * (x - pill_x < 0 ? pill_x - x : x - pill_x);
if (d2 <= pw - icon_w) display.setColor(DisplayDriver::DARK); // inside the pill
if (d2 <= pw - icon_w) display.setColor(UIColor::window_bkg); // inside the pill
else if (d2 < pw + icon_w) { x += pitch; continue; } // half under the gliding pill
else display.setColor(DisplayDriver::LIGHT);
else display.setColor(UIColor::primary_txt);
if (ic) miniIconDrawCenteredScaled(display, x, dots_y, *ic, s);
x += pitch;
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
if (_page == HomePage::CLOCK) {
uint32_t unix_ts = _rtc->getCurrentTime();
if (unix_ts < 1000000000UL) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.setTextSize(1);
int mid_y = display.height() / 2 - step;
display.drawTextCentered(display.width() / 2, mid_y, "! No time sync");
@@ -1413,7 +1413,7 @@ public:
} else if (_page == HomePage::STATUS) {
drawStatusTiles(display, content_y);
} else if (isQuickPage(_page) && !(_page == HomePage::SHUTDOWN && _shutdown_init)) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.setTextSize(1);
QRow rows[QUICK_MAX];
const int n = buildQuick(_page, rows);
@@ -1427,7 +1427,7 @@ public:
// landscape → 3×2, portrait → 2×3. The selected card is filled.
// No title — node name + battery (top bar) and the page-dots indicator above
// serve as the page identity.
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.setTextSize(1);
const int cols = favCols(display);
@@ -1451,8 +1451,8 @@ public:
// Each slot a card: a soft frame round a pinned one, a dotted outline
// round a free one, filled while selected.
const int tx = cx + 1, ty = cy, tw = cell_w - 2, th = cell_h - 2;
display.setColor(DisplayDriver::LIGHT);
if (sel) { display.fillSoftRect(tx, ty, tw, th); display.setColor(DisplayDriver::DARK); }
display.setColor(UIColor::primary_txt);
if (sel) { display.fillSoftRect(tx, ty, tw, th); display.setColor(UIColor::window_bkg); }
else if (prefix) display.drawSoftRect(tx, ty, tw, th);
else {
const int t = display.sepH(); // dot size: 2px on a doubled panel
@@ -1533,7 +1533,7 @@ public:
// the newest message under the name, how long ago and how far along
// the bottom.
if (th >= 6 * line_h && display.width() >= 40 * display.getCharWidth()) {
display.setColor(sel ? DisplayDriver::DARK : DisplayDriver::LIGHT);
display.setColor(sel ? UIColor::window_bkg : UIColor::primary_txt);
const int by = ty + th - line_h - 3; // the bottom line
const uint32_t now = rtc_clock.getCurrentTime();
char buf[16];
@@ -1564,7 +1564,7 @@ public:
for (int k = 0; k < n; k++) display.drawTextEllipsized(tx + 3, my + k * line_h, tw - 6, lines[k]);
}
} else if (tall) {
display.setColor(sel ? DisplayDriver::DARK : DisplayDriver::LIGHT); // the badge leaves its own
display.setColor(sel ? UIColor::window_bkg : UIColor::primary_txt); // the badge leaves its own
const int s = miniIconScale(display), gap = line_h / 3;
int y = name_y + line_h + gap;
auto detail = [&](const MiniIcon& ic, const char* text) {
@@ -1590,7 +1590,7 @@ public:
} else {
display.drawTextCentered(tx + tw / 2, ty + (th - line_h) / 2, "+");
}
if (sel) display.setColor(DisplayDriver::LIGHT);
if (sel) display.setColor(UIColor::primary_txt);
}
// Persist any pruned slots once, outside the loop — a render pass can clear
// several gone tiles but only one flash write is needed. Self-healing: once
@@ -1598,7 +1598,7 @@ public:
if (fav_changed) the_mesh.savePrefs();
if (_tile_menu.active) _tile_menu.render(display);
} else if (_page == HomePage::SHUTDOWN) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.setTextSize(1);
display.drawTextCentered(display.width() / 2, content_y + step, "hibernating..."); // the panel's Hibernate row
}
+7 -7
View File
@@ -148,9 +148,9 @@ inline void rose(DisplayDriver& d, int cx, int cy, int r, int deg) {
d.fillRect(cx - s / 2, cy + r - t, s, t); // S
d.fillRect(cx + r - t, cy - s / 2, t, s); // E
d.fillRect(cx - r, cy - s / 2, t, s); // W
d.setColor(DisplayDriver::DARK); // N, on a gap in the ring
d.setColor(UIColor::window_bkg); // N, on a gap in the ring
d.fillRect(cx - cw / 2 - 1, cy - r - lh / 2, cw + 2, lh);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
d.setCursor(cx - cw / 2, cy - r - lh / 2);
d.print("N");
if (deg >= 0) {
@@ -173,10 +173,10 @@ inline int chip(DisplayDriver& d, int x, int y, const char* t, bool filled = fal
const int w = chipW(d, t), h = d.getLineHeight() + 2;
if (filled) d.fillSoftRect(x, y, w, h);
else d.drawSoftRect(x, y, w, h);
if (filled) d.setColor(DisplayDriver::DARK);
if (filled) d.setColor(UIColor::window_bkg);
d.setCursor(x + 3, y + 1);
d.print(t);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
return x + w + 3;
}
@@ -203,7 +203,7 @@ inline int bigH(DisplayDriver& d) { return 2 * d.getLineHeight(); }
// the light bar).
inline int switchW(DisplayDriver& d) { return d.getTextWidth("Off"); }
inline void toggle(DisplayDriver& d, int x_right, int y, bool on, bool inv = false) {
d.setColor(inv ? DisplayDriver::DARK : DisplayDriver::LIGHT);
d.setColor(inv ? UIColor::window_bkg : UIColor::primary_txt);
d.drawTextRightAlign(x_right, y, on ? "On" : "Off");
}
@@ -323,9 +323,9 @@ inline void chart(DisplayDriver& d, int x, int y, int w, int h, const History<N>
const int ix = x + 2, iy = y + 2, iw = w - 4, ih = h - 4;
if (empty) { // nothing to draw yet: say so over the line
const int tw = d.getTextWidth("no data"), tx = x + (w - tw) / 2, ty = y + (h - lh) / 2;
d.setColor(DisplayDriver::DARK);
d.setColor(UIColor::window_bkg);
d.fillRect(tx - 2, ty, tw + 4, lh);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
d.setCursor(tx, ty);
d.print("no data");
} else {
@@ -589,7 +589,7 @@ struct KeyboardWidget {
// Single UI font (misc-fixed 5x7) covers Latin/Greek/Cyrillic — the keyboard
// renders in it directly, no per-render font switching or headroom padding.
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
const int rows = gridRows();
const int cols = gridCols();
@@ -703,10 +703,10 @@ struct KeyboardWidget {
char one[5], one_t[8];
kbUtf8CharAt(buf + cursor_pos, 0, one);
display.translateUTF8ToBlocks(one_t, one, sizeof(one_t));
display.setColor(DisplayDriver::DARK);
display.setColor(UIColor::window_bkg);
display.setCursor(bx, by);
display.print(one_t);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
} else {
display.fillRect(bx, by + lh - display.sepH(), cw - display.sepH(), display.sepH());
@@ -718,11 +718,11 @@ struct KeyboardWidget {
const int tw = display.getTextWidth(count), y = (prev_lines - 1) * lh;
if (count[0] == '-') { // over (a placeholder grew): inverted
display.fillRect(display.width() - tw - 2, y, tw + 2, lh);
display.setColor(DisplayDriver::DARK);
display.setColor(UIColor::window_bkg);
}
display.setCursor(display.width() - tw - (count[0] == '-' ? 1 : 0), y);
display.print(count);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
} else if (!isPin()) {
// Bottom-right of the preview: what the field is, or near the limit how
// much room is left. Only when it clears the text on that line.
@@ -795,7 +795,7 @@ struct KeyboardWidget {
// instead of/alongside CardKB) still drive row/col/page as normal; it
// just won't be visible on this screen which cell is selected.
if (compact_ui) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
if (cursor_mode) {
display.drawTextCentered(display.width() / 2, chars_y, "<> char ^v word");
} else {
@@ -889,7 +889,7 @@ struct KeyboardWidget {
// ink colour is the one that shows against it.
if (i == 0 && caps_lock) display.fillRect(sx + 2, spec_y + cell_h - 3, spec_w - 5, display.sepH());
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
}
}
@@ -919,17 +919,17 @@ struct KeyboardWidget {
char shown[5]; kbApplyCapsUtf8(one, caps, shown, sizeof(shown));
int x = bx + i * seg_w;
if (i == accent_sel) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.fillSoftRect(x + 1, by + 1, seg_w - 1, bh - 2);
display.setColor(DisplayDriver::DARK);
display.setColor(UIColor::window_bkg);
} else {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
int tw = display.getTextWidth(shown);
display.setCursor(x + (seg_w - tw) / 2, by + 1);
display.print(shown);
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
// placeholder picker overlay (drawn on top of keyboard)
@@ -100,7 +100,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
drawScreenHeader(display, "Live share");
int mq_delay = 0;
@@ -108,7 +108,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
if (_picking) { int mq = renderPicker(display); return (mq > 0 && mq < 400) ? mq : 400; }
drawScreenHeader(display, "Locator");
@@ -499,10 +499,10 @@ class MessagesScreen : public UIScreen {
// Spans exactly [box_x, box_x+box_w) — the caller sizes/positions the bubble
// (see computeBubbleBox below), this just draws whatever box it's given.
static void drawHistRowFrame(DisplayDriver& d, int box_x, int box_w, int y, int bh, int lh, bool sel) {
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
if (sel) {
d.fillSoftRect(box_x, y, box_w, bh);
d.setColor(DisplayDriver::DARK);
d.setColor(UIColor::window_bkg);
} else {
d.drawSoftRect(box_x, y, box_w, bh);
}
@@ -1076,7 +1076,7 @@ public:
const char* t = "New";
int tw = d.getTextWidth(t);
int tx = (w - tw) / 2, mid = y + lh / 2;
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
d.fillRect(1, mid, tx - 4, d.sepH());
d.fillRect(tx + tw + 3, mid, w - 1 - (tx + tw + 3), d.sepH());
d.setCursor(tx, y + 1);
@@ -1313,7 +1313,7 @@ public:
int render(DisplayDriver& display) override {
int mq_delay = 0; // >0 while a selected row's text is marquee-scrolling
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
// Channel Add/Edit form owns the screen while active.
if (_ch_view.active()) {
@@ -1358,7 +1358,7 @@ public:
if (badges[i] > 0)
display.drawUnreadBadge(display.width() - 1, y, badges[i], sel, overflow[i]);
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
// Fold the popup's own suggested redraw delay into mq_delay -- otherwise
// a marquee inside it (see PopupMenu::render()) only ever advances at
// whatever slower cadence this phase's own return statement below picks,
@@ -1422,7 +1422,7 @@ public:
drawRowSelection(display, y, sel, reserve);
if (list_idx == _num_channels) { // the synthetic "Add" row
display.setCursor(2, y); display.print("+ Add channel");
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
return;
}
ChannelDetails ch;
@@ -1470,10 +1470,10 @@ public:
_dm_hist_sel < dm_count - 1,
_dm_hist_sel > 0);
if (e.outgoing) { // delivery marker in the (inverted) header bar
display.setColor(DisplayDriver::DARK);
display.setColor(UIColor::window_bkg);
drawAckGlyph(display, 2 + display.getTextWidth(sender) + 3, 1,
_history.dmEffectiveStatus(e), e.attempt + 1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
// Fold the popup's own suggested redraw delay into mq_delay -- otherwise
// a marquee inside it (see PopupMenu::render()) only ever advances at
@@ -1669,7 +1669,7 @@ public:
if (div_y >= 0) drawNewDivider(display, div_y, display.width() - reserve, lh);
if (dm_count == 0) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.drawTextCentered(display.width()/2, display.height()/2, "No messages yet");
}
@@ -1717,10 +1717,10 @@ public:
// plus the distinct-echoing-repeater count as tiny digits (path_len's
// hop_count -- see markChannelRelayed/showPathDetail's "Relayed by").
if (strcmp(fsender, "Me") == 0 && _history.chAtPos(ring_pos).relay_status == ACK_OK) {
display.setColor(DisplayDriver::DARK);
display.setColor(UIColor::window_bkg);
int relay_count = _history.chAtPos(ring_pos).path_len & 63;
drawAckGlyph(display, 2 + display.getTextWidth(fsender) + 3, 1, ACK_OK, 1, relay_count);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
// Fold the popup's own suggested redraw delay into mq_delay -- otherwise
// a marquee inside it (see PopupMenu::render()) only ever advances at
@@ -1858,7 +1858,7 @@ public:
if (div_y >= 0) drawNewDivider(display, div_y, display.width() - reserve, lh);
if (ch_hist_count == 0) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.drawTextCentered(display.width()/2, display.height()/2, "No messages yet");
}
@@ -162,7 +162,7 @@ public:
const int rw = right[0] ? display.getTextWidth(right) + display.getCharWidth() : 0;
display.drawTextEllipsized(2, y, display.width() - reserve - 4 - rw, left, sel);
if (right[0]) {
display.setColor(sel ? DisplayDriver::DARK : DisplayDriver::LIGHT);
display.setColor(sel ? UIColor::window_bkg : UIColor::primary_txt);
display.drawTextRightAlign(display.width() - reserve - 2, y, right);
}
});
@@ -894,7 +894,7 @@ class NearbyScreen : public UIScreen, protected NearbyModel {
void renderMap(DisplayDriver& d) {
const int W = d.width(), H = d.height(), lh = d.getLineHeight(), s = miniIconScale(d);
const int bar_y = H - lh - 1, ax = 1, ay = 1, aw = W - 2, ah = bar_y - 3;
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
int32_t tla = 0, tlo = 0;
const bool target = _task->activeTargetPos(tla, tlo);
int32_t mnla = 0, mxla = 0, mnlo = 0, mxlo = 0;
@@ -1048,7 +1048,7 @@ class NearbyScreen : public UIScreen, protected NearbyModel {
// matching the wrap-around LEFT/RIGHT cycle.
void drawFilterTabs(DisplayDriver& display) {
tabbar::draw(display, filterLabels(), F_COUNT, _filter, display.menuHintWidth());
display.drawContextMenuHint(DisplayDriver::LIGHT, ctxMenuOpen()); // Nodes list has a Hold-Enter menu
display.drawContextMenuHint(UIColor::primary_txt, ctxMenuOpen()); // Nodes list has a Hold-Enter menu
}
public:
@@ -1159,7 +1159,7 @@ public:
const bool arrows = _source == SRC_STORED && _sort != SORT_TIME;
int dist_col = lw - display.getCharWidth() * (arrows ? 9 : 7);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
const char* flt = (_filter != F_ALL) ? filterLabel(_filter) : nullptr;
if (_source == SRC_SCAN) {
char title[28];
@@ -1227,7 +1227,7 @@ public:
int mqr = display.drawTextEllipsized(tx, y, dist_col - tx - 2, filt, sel);
if (sel && mqr > 0) mq_delay = mqr;
display.setColor(sel ? DisplayDriver::DARK : DisplayDriver::LIGHT);
display.setColor(sel ? UIColor::window_bkg : UIColor::primary_txt);
char right[10];
if (_source == SRC_SCAN) { // live scan: how well we hear it, as bars
drawSignalBars(display, lw - reserve - 2, y, e.snr_x4);
@@ -1249,7 +1249,7 @@ public:
}, lw);
if (split && _sel < _count) {
const int top = display.listStart();
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.fillRect(lw + 2, top, display.sepH(), display.height() - top);
drawStoredFields(display, _entries[_sel], lw + 2 + display.sepH() + 2, top,
display.width() - lw - 4 - display.sepH(), display.height());
+5 -5
View File
@@ -179,14 +179,14 @@ struct PopupMenu {
int idx = _scroll + i;
int py = list_y + i * item_h + 1;
if (idx == _sel) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
// Stops short of the scroll-indicator gutter, like every other list's
// selection bar (e.g. drawList's row width - reserve) — otherwise the
// bar paints over the indicator's column instead of framing it.
display.fillSoftRect(bx + 2, py - 1, bw - 4 - arrow_w, item_h);
display.setColor(DisplayDriver::DARK);
display.setColor(UIColor::window_bkg);
} else {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
// Return value not needed here: this popup already redraws every 50ms
// (below), faster than any marquee step, so the animation is already smooth.
@@ -196,14 +196,14 @@ struct PopupMenu {
else
display.drawTextEllipsized(bx + pad, py, text_w, _items[idx], idx == _sel);
if (_has_checkboxes) drawCheckbox(display, bx + bw - arrow_w - pad - checkboxWidth(display), py, isChecked(idx));
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
// Same proportional track + thumb indicator the rest of the UI uses,
// anchored to the box's own right edge (a couple px clear of the border)
// instead of the screen edge since this box floats centred on screen.
drawScrollIndicator(display, bx + bw - 2, list_y, vis * item_h, _count, vis, _scroll);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
return 50;
}
@@ -149,7 +149,7 @@ public:
NodePrefs* p = _task->getNodePrefs();
buildItems(p);
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
drawScreenHeader(display, "Repeater");
// Config only — live forwarding stats live on Status › Mesh.
@@ -165,9 +165,9 @@ public:
itemValue(item, p, val, sizeof(val));
info::listRow(display, y, itemLabel(item), val, sel, reserve);
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
});
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
if (_picker.menu.active) _picker.menu.render(display);
if (_scope_picker_active) _scope_menu.render(display);
return (_picker.menu.active || _editor.active() || _scope_picker_active) ? 50 : 500;
@@ -78,7 +78,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
const int lh = display.getLineHeight();
const int cw = display.getCharWidth();
@@ -117,21 +117,21 @@ public:
label[2] = '\0';
}
if (sel) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.fillSoftRect(cx, notes_y, cell_w - 1, cell_h);
display.setColor(DisplayDriver::DARK);
display.setColor(UIColor::window_bkg);
} else {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.drawRect(cx, notes_y, cell_w - 1, cell_h);
}
display.setCursor(cx + (cell_w - cw * 2) / 2, notes_y + 3);
display.print(label);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
} else if (ni == _len && _len < MAX_NOTES) {
display.drawSelectionRow(cx, notes_y, cell_w - 1, cell_h, sel);
display.setCursor(cx + (cell_w - cw) / 2, notes_y + 3);
display.print("+");
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
}
@@ -168,7 +168,7 @@ public:
const int h = y1 - y0, W = _visible_notes * cell_w;
if (h < steps * 2) return;
const int bar_h = h / steps > 5 ? 5 : h / steps > 2 ? h / steps : 2;
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
for (int o = 0; o <= soundctl::OCT_MAX - soundctl::OCT_MIN; o++) {
const int y = y1 - (o * 7) * h / steps;
for (int x = 0; x < W; x += 3) d.fillRect(x, y, 1, 1);
@@ -618,7 +618,7 @@ class SettingsScreen : public UIScreen {
uint8_t _reset_stage = 0;
int renderScopeMgmt(DisplayDriver& display) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
drawScreenHeader(display, "Scope", -1, 0, true, _scope_action_menu.active);
const ScopeList& sl = the_mesh.scopeList();
int total = sl.totalCount() + 1; // +1 synthetic "+ Add scope" row
@@ -632,7 +632,7 @@ class SettingsScreen : public UIScreen {
if ((uint8_t)idx == sl.default_idx)
display.drawTextRightAlign(display.width() - reserve - 2, y, "default");
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
});
if (_scope_action_menu.active) _scope_action_menu.render(display);
return _scope_action_menu.active ? 50 : 500;
@@ -692,7 +692,7 @@ public:
// Section header: disclosure mark + name
[&](int sec, int y, bool sel, int reserve, bool collapsed) {
_reserve = reserve;
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
drawRowSelection(display, y, sel, reserve);
drawDisclosure(display, 2, y, !collapsed);
display.setCursor(2 + 2 * display.getCharWidth(), y);
+6 -6
View File
@@ -63,9 +63,9 @@ namespace skyview {
info::circle(d, cx, cy, r); // the horizon
info::circle(d, cx, cy, r / 2, 2); // 45 degrees up, dotted
dot(d, cx, cy); // straight up
d.setColor(DisplayDriver::DARK); // north, on a gap in the rim
d.setColor(UIColor::window_bkg); // north, on a gap in the rim
d.fillRect(cx - cw / 2 - 1, cy - r - lh / 2, cw + 2, lh);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
d.setCursor(cx - cw / 2, cy - r - lh / 2);
d.print("N");
@@ -80,9 +80,9 @@ namespace skyview {
if (used) {
d.fillRect(x - s, y - s, 2 * s + 1, 2 * s + 1);
} else if (sat.snr >= 0) {
d.setColor(DisplayDriver::DARK); // clear inside, over a ring
d.setColor(UIColor::window_bkg); // clear inside, over a ring
d.fillRect(x - s, y - s, 2 * s + 1, 2 * s + 1);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
d.drawRect(x - s, y - s, 2 * s + 1, 2 * s + 1);
} else if (s > 1) { // in view, no signal: a small point
d.fillRect(x - 1, y - 1, 3, 3);
@@ -197,9 +197,9 @@ namespace skyview {
int h = snr < 0 ? 1 : (H * snr / 50 > 2 ? H * snr / 50 : 2);
if (g.used(sat) || h <= 2) d.fillRect(x, y1 - h + 1, bw, h);
else {
d.setColor(DisplayDriver::DARK); // over the dotted line
d.setColor(UIColor::window_bkg); // over the dotted line
d.fillRect(x, y1 - h + 1, bw, h);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
d.drawRect(x, y1 - h + 1, bw, h);
}
}
@@ -48,7 +48,7 @@ public:
const bool anim = !display.isEink();
const unsigned long t = anim ? millis() - _start : 100000UL; // e-ink: the settled frame
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
const int lh = display.getLineHeight();
const int cx = display.width() / 2;
@@ -355,13 +355,13 @@ private:
const int x0 = tall ? (W - px) / 2 : 0;
const int y0 = tall ? (H - px - lh / 2 - lines * lh) / 2 : (H - px) / 2;
const bool eink = d.isEink();
if (!eink) { d.setColor(DisplayDriver::LIGHT); d.fillRect(x0, y0, px, px); }
d.setColor(eink ? DisplayDriver::LIGHT : DisplayDriver::DARK);
if (!eink) { d.setColor(UIColor::primary_txt); d.fillRect(x0, y0, px, px); }
d.setColor(eink ? UIColor::primary_txt : UIColor::window_bkg);
const int q = x0 + siteqr::QUIET * s, r = y0 + siteqr::QUIET * s;
for (int y = 0; y < n; y++)
for (int x = 0; x < n; x++)
if (dark(x, y)) d.fillRect(q + x * s, r + y * s, s, s);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
int ty = tall ? y0 + px + lh / 2 : (H - lines * lh) / 2;
for (int i = 0; i < lines; i++) {
int w = d.getTextWidth(cap[i]);
@@ -434,7 +434,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
if (_qr) { renderQr(display); return 1000; }
tabbar::draw(display, _labels, _count, _cur);
const int top = display.listStart(), bottom = display.height();
@@ -457,7 +457,7 @@ public:
if (rsv) drawScrollIndicatorPx(display, top, view, f.total_px, view, f.skipped_px);
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
if (_reset_menu.active) { _reset_menu.render(display); return 50; }
return next;
}
+8 -8
View File
@@ -61,21 +61,21 @@ inline bool endFrame(DisplayDriver& d) {
inline void drawPill(DisplayDriver& display, int x, int w, const char* label, bool active) {
int lh = display.getLineHeight();
if (active) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.fillSoftRect(x, 0, w, lh + 1);
display.setColor(DisplayDriver::DARK);
display.setColor(UIColor::window_bkg);
} else {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
display.drawTextCentered(x + w / 2, 0, label);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
// Small solid triangle pointing left (dir < 0) or right, 3 px wide and 5
// tall (times sepH()), centred on row y_mid: "more tabs this way".
inline void drawEdgeArrow(DisplayDriver& display, int x, int y_mid, int dir) {
const int t = display.sepH();
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
for (int c = 0; c < 3; c++) {
int h = (dir < 0 ? c * 2 + 1 : 5 - c * 2) * t;
display.fillRect(x + c * t, y_mid - h / 2, t, h);
@@ -151,14 +151,14 @@ inline void draw(DisplayDriver& display, const char* const* labels, int count, i
Fit f = layout(0, false);
if (f.shown < count && f.left_free < arr + 1 && f.right_free < arr + 1) f = layout(arr + 2, false);
const int bh = display.headerH() - display.sepH(), y_mid = display.getLineHeight() / 2;
display.setColor(DisplayDriver::DARK);
display.setColor(UIColor::window_bkg);
display.fillRect(0, 0, f.left_free, bh);
display.fillRect(rx_limit - f.right_free, 0, f.right_free + right_reserve, bh);
if (f.shown < count) {
if (f.left_free >= arr + 1) drawEdgeArrow(display, 0, y_mid, -1);
if (f.right_free >= arr + 1) drawEdgeArrow(display, rx_limit - arr, y_mid, +1);
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.fillRect(0, display.headerH() - display.sepH(), display.width(), display.sepH());
return;
}
@@ -175,7 +175,7 @@ inline void draw(DisplayDriver& display, const char* const* labels, int count, i
if (f.left_free >= arr + 1) drawEdgeArrow(display, 0, y_mid, -1);
if (f.right_free >= arr + 1) drawEdgeArrow(display, rx_limit - arr, y_mid, +1);
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.fillRect(0, display.headerH() - display.sepH(), display.width(), display.sepH());
}
@@ -81,7 +81,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
drawScreenHeader(display, "Tools");
const int cw = display.getCharWidth();
@@ -120,7 +120,7 @@ public:
int render(DisplayDriver& display) override {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
// Waypoint management UI owns the screen while active.
if (_wp.active()) return _wp.render(display);
+5 -5
View File
@@ -703,9 +703,9 @@ void UITask::renderAlertOverlay() {
k = 100 - (100 - k) * (100 - k) / 100;
}
const int y = -h + h * k / 100;
_display->setColor(DisplayDriver::DARK);
_display->setColor(UIColor::window_bkg);
_display->fillRect(0, y, W, h);
_display->setColor(DisplayDriver::LIGHT);
_display->setColor(UIColor::primary_txt);
_display->drawRect(0, y, W, h);
for (int i = 0; i < nl; i++)
_display->drawTextCentered(W / 2, y + pad + i * lh, s_wrap_lines[i]);
@@ -720,9 +720,9 @@ void UITask::renderMsgBadge() {
DisplayDriver& d = *_display;
const int s = miniIconScale(d), h = d.headerH() - d.sepH(), w = mailCountWidth(d, _alert_count);
const int x = d.width() - w - 2 * s;
d.setColor(DisplayDriver::DARK);
d.setColor(UIColor::window_bkg);
d.fillRect(x - 2 * s, 0, w + 4 * s, h);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
if (msgBadgeLit()) drawMailCount(d, x, 0, h, _alert_count);
}
@@ -1488,7 +1488,7 @@ void UITask::loop() {
if (_display != NULL) {
_display->startFrame();
_display->setTextSize(1);
_display->setColor(DisplayDriver::LIGHT);
_display->setColor(UIColor::primary_txt);
int mid = _display->height() / 2;
int step = _display->lineStep();
_display->drawTextCentered(_display->width() / 2, mid - step, "Low Battery");
@@ -140,7 +140,7 @@ class WaypointsView {
}
void renderAddForm(DisplayDriver& display) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
drawScreenHeader(display, "Add waypoint");
const int top = display.listStart();
const int step = display.lineStep();
@@ -169,14 +169,14 @@ class WaypointsView {
else snprintf(val, sizeof(val), "%s", _add_label[0] ? _add_label : "(auto)");
info::valueRow(display, y, label, val, sel, 0);
}
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
}
}
// GPS-averaging progress screen. Sampling itself happens in poll(); this only
// reports remaining time and the running sample count.
void renderAvg(DisplayDriver& display) {
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
drawScreenHeader(display, "Averaging GPS");
const int top = display.listStart();
const int step = display.lineStep();
@@ -192,7 +192,7 @@ class WaypointsView {
// keep a marquee animation going (see DisplayDriver::drawTextEllipsized).
int renderWpList(DisplayDriver& display) {
int mq_delay = 0;
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
char title[24];
snprintf(title, sizeof(title), "Waypoints %d/%d",
_task->waypoints().count(), WaypointStore::CAPACITY);
@@ -207,7 +207,7 @@ class WaypointsView {
if (row == n) { // the synthetic "Add" row
display.setCursor(2, y); display.print("+ Add by coords");
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
return;
}
@@ -223,7 +223,7 @@ class WaypointsView {
int mqr = display.drawTextEllipsized(2, y, display.width() - 2 - bw - reserve, nm, sel);
if (sel && mqr > 0) mq_delay = mqr;
if (dist[0]) { display.setCursor(display.width() - bw + 1 - reserve, y); display.print(dist); }
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
});
return mq_delay;
}
@@ -337,7 +337,7 @@ public:
// Only called while active().
int render(DisplayDriver& display) {
display.setTextSize(1);
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
if (_kb_active) return _task->keyboard().render(display); // keyboard owns the screen
if (_mode == ADD) { renderAddForm(display); return 1000; }
if (_mode == AVG) { renderAvg(display); return display.isEink() ? 1000 : 300; }
+7 -7
View File
@@ -1486,7 +1486,7 @@ inline void drawScrollIndicatorPx(DisplayDriver& d, int right_x, int top_y, int
if (thumb_h > track_h) thumb_h = track_h;
const int thumb_y = top_y + (int)((long)(track_h - thumb_h) * scroll_px / span);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
for (int y = top_y; y < top_y + track_h; y += 2)
if (y < thumb_y - 1 || y > thumb_y + thumb_h) d.fillRect(mid, y, 1, 1);
d.fillSoftRect(x, thumb_y, bar_w, thumb_h);
@@ -1573,7 +1573,7 @@ inline int drawLoadingDots(DisplayDriver& d, int cx, int y_bottom) {
const int dot = 3 * s, pitch = 9 * s, lift_max = 3 * s;
const bool anim = !d.isEink();
const unsigned long t = millis();
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
for (int i = 0; i < 3; i++) {
int lift = 0;
if (anim) {
@@ -1643,7 +1643,7 @@ inline void drawPageDots(DisplayDriver& d, int x_right, int cy, int page, int pa
inline void drawScreenHeader(DisplayDriver& d, const char* title, int page = -1, int pages = 0,
bool menu_hint = false, bool menu_open = false) {
const int s = miniIconScale(d);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
const int hint = menu_hint ? d.menuHintWidth() : 0;
const int dots = pages > 1 ? pageDotsWidth(d, pages) + 3 * s : 0;
const int reserve = hint + dots;
@@ -1660,7 +1660,7 @@ inline void drawScreenHeader(DisplayDriver& d, const char* title, int page = -1,
}
d.fillRect(0, d.headerH() - d.sepH(), d.width(), d.sepH());
if (pages > 1) drawPageDots(d, d.width() - hint - s, (d.headerH() - d.sepH()) / 2, page, pages);
if (menu_hint) d.drawContextMenuHint(DisplayDriver::LIGHT, menu_open);
if (menu_hint) d.drawContextMenuHint(UIColor::primary_txt, menu_open);
}
// An accordion section's disclosure mark, one character wide: a triangle
@@ -1676,11 +1676,11 @@ inline void drawDisclosure(DisplayDriver& d, int x, int y, bool open) {
inline int buttonWidth(DisplayDriver& d, const char* label) { return d.getTextWidth(label) + 6; }
inline int drawButton(DisplayDriver& d, int x, int y, const char* label, bool sel) {
const int w = buttonWidth(d, label), h = d.getLineHeight();
d.setColor(DisplayDriver::LIGHT);
if (sel) { d.fillSoftRect(x, y, w, h); d.setColor(DisplayDriver::DARK); }
d.setColor(UIColor::primary_txt);
if (sel) { d.fillSoftRect(x, y, w, h); d.setColor(UIColor::window_bkg); }
else d.drawSoftRect(x, y, w, h);
d.setCursor(x + 3, y);
d.print(label);
d.setColor(DisplayDriver::LIGHT);
d.setColor(UIColor::primary_txt);
return w;
}
+13 -14
View File
@@ -169,7 +169,7 @@ void UITask::renderBatteryIndicator(uint16_t batteryMilliVolts) {
int iconHeight = 12;
int iconX = _display->width() - iconWidth - 5; // Position the icon near the top-right corner
int iconY = 0;
_display->setColor(DisplayDriver::GREEN);
_display->setColor(UIColor::primary_txt);
// battery outline
_display->drawRect(iconX, iconY, iconWidth, iconHeight);
@@ -190,7 +190,7 @@ void UITask::renderCurrScreen() {
_display->setTextSize(1.4);
uint16_t textWidth = _display->getTextWidth(_alert);
_display->setCursor((_display->width() - textWidth) / 2, 22);
_display->setColor(DisplayDriver::GREEN);
_display->setColor(UIColor::warning_txt);
_display->print(_alert);
_alert[0] = 0;
_need_refresh = true;
@@ -199,30 +199,29 @@ void UITask::renderCurrScreen() {
// render message preview
_display->setCursor(0, 0);
_display->setTextSize(1);
_display->setColor(DisplayDriver::GREEN);
_display->setColor(UIColor::primary_txt);
_display->print(_node_prefs->node_name);
_display->setCursor(0, 12);
_display->setColor(DisplayDriver::YELLOW);
_display->setColor(UIColor::secondary_txt);
_display->print(_origin);
_display->setCursor(0, 24);
_display->setColor(DisplayDriver::LIGHT);
_display->print(_msg);
_display->setCursor(_display->width() - 28, 9);
_display->setTextSize(2);
_display->setColor(DisplayDriver::ORANGE);
_display->setColor(UIColor::primary_txt);
sprintf(tmp, "%d", _msgcount);
_display->print(tmp);
_display->setColor(DisplayDriver::YELLOW); // last color will be kept on T114
_display->setColor(UIColor::secondary_txt); // last color will be kept on T114
} else if ((millis() - ui_started_at) < BOOT_SCREEN_MILLIS) { // boot screen
// meshcore logo
_display->setColor(DisplayDriver::BLUE);
_display->setColor(UIColor::corp_blue);
int logoWidth = 128;
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
// version info
_display->setColor(DisplayDriver::LIGHT);
_display->setColor(UIColor::primary_txt);
_display->setTextSize(1);
uint16_t textWidth = _display->getTextWidth(_version_info);
_display->setCursor((_display->width() - textWidth) / 2, 22);
@@ -231,7 +230,7 @@ void UITask::renderCurrScreen() {
// node name
_display->setCursor(0, 0);
_display->setTextSize(1);
_display->setColor(DisplayDriver::GREEN);
_display->setColor(UIColor::primary_txt);
_display->print(_node_prefs->node_name);
// battery voltage
@@ -239,7 +238,7 @@ void UITask::renderCurrScreen() {
// freq / sf
_display->setCursor(0, 20);
_display->setColor(DisplayDriver::YELLOW);
_display->setColor(UIColor::secondary_txt);
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
_display->print(tmp);
@@ -250,14 +249,14 @@ void UITask::renderCurrScreen() {
// BT pin
if (!_connected && the_mesh.getBLEPin() != 0) {
_display->setColor(DisplayDriver::RED);
_display->setColor(UIColor::warning_txt);
_display->setTextSize(2);
_display->setCursor(0, 43);
sprintf(tmp, "Pin:%d", the_mesh.getBLEPin());
_display->print(tmp);
_display->setColor(DisplayDriver::GREEN);
_display->setColor(UIColor::primary_txt);
} else {
_display->setColor(DisplayDriver::LIGHT);
_display->setColor(UIColor::primary_txt);
}
}
_need_refresh = false;
@@ -104,7 +104,7 @@ public:
if (_status[0] == 0) return;
display.setTextSize(1);
display.setColor(DisplayDriver::GREEN);
display.setColor(UIColor::primary_txt);
// if (_needs_redraw) {
// _text_width = display.getTextWidth(_status);
+18 -13
View File
@@ -57,24 +57,24 @@ public:
int render(DisplayDriver& display) override {
if (millis() < version_after) {
// meshcore logo
display.setColor(DisplayDriver::BLUE);
display.setColor(UIColor::corp_blue);
int logoWidth = 72;
display.drawXbm(0, 0, meshcore_logo, 72, 36);
} else {
// meshcore website
const char* website = "meshcore.io";
display.setColor(DisplayDriver::LIGHT);
display.setColor(UIColor::primary_txt);
display.setTextSize(1);
uint16_t websiteWidth = display.getTextWidth(website);
display.setCursor((display.width() - websiteWidth) / 2, 9);
display.print(website);
// version info
display.setColor(DisplayDriver::LIGHT);
display.setTextSize(1);
display.drawTextCentered(display.width()/2, 18, _version_info);
display.setColor(UIColor::secondary_txt);
display.setTextSize(1);
display.drawTextCentered(display.width()/2, 27, FIRMWARE_BUILD_DATE);
}
@@ -164,7 +164,7 @@ public:
// display.print(filtered_name);
display.setColor(DisplayDriver::YELLOW);
display.setColor(UIColor::primary_txt);
display.setTextSize(2);
sprintf(tmp, "MSG: %d", _task->getMsgCount());
display.setCursor(0, 10);
@@ -181,19 +181,19 @@ public:
display.drawTextCentered(display.width() / 2, 54, tmp);
#endif
if (_task->hasConnection()) {
display.setColor(DisplayDriver::GREEN);
display.setColor(UIColor::warning_txt);
display.setTextSize(1);
display.drawTextCentered(display.width() / 2, display.height()-8, "< Connected >");
} else if (the_mesh.getBLEPin() != 0) { // BT pin
display.setColor(DisplayDriver::RED);
display.setColor(UIColor::warning_txt);
display.setTextSize(2);
sprintf(tmp, "Pin:%d", the_mesh.getBLEPin());
display.drawTextCentered(display.width() / 2, display.height()-8, tmp);
}
} else if (_page == HomePage::RECENT) {
the_mesh.getRecentlyHeard(recent, UI_RECENT_LIST_SIZE);
display.setColor(DisplayDriver::GREEN);
display.setColor(UIColor::primary_txt);
int y = 8;
for (int i = 0; i < UI_RECENT_LIST_SIZE; i++, y += 11) {
auto a = &recent[i];
@@ -217,7 +217,7 @@ public:
display.print(tmp);
}
} else if (_page == HomePage::RADIO) {
display.setColor(DisplayDriver::YELLOW);
display.setColor(UIColor::primary_txt);
display.setTextSize(1);
// frequency and spreading factor
display.setCursor(0, 8);
@@ -239,14 +239,14 @@ public:
display.drawTextRightAlign(display.width(), 26, tmp);
} else if (_page == HomePage::BLUETOOTH) {
display.setColor(DisplayDriver::GREEN);
display.setColor(UIColor::corp_blue);
display.drawXbm((display.width() - 32) / 2, 8,
_task->isBluetoothEnabled() ? bluetooth_on : bluetooth_off,
32, 32);
display.setTextSize(1);
// display.drawTextCentered(display.width() / 2, 40 - 11, "toggle: " PRESS_LABEL);
} else if (_page == HomePage::ADVERT) {
display.setColor(DisplayDriver::GREEN);
display.setColor(UIColor::corp_blue);
display.drawXbm((display.width() - 32) / 2, 8, advert_icon, 32, 32);
// display.drawTextCentered(display.width() / 2, 40 - 11, "advert: " PRESS_LABEL);
#if ENV_INCLUDE_GPS == 1
@@ -265,9 +265,11 @@ public:
#else
strcpy(buf, gps_state ? "gps on" : "gps off");
#endif
display.setColor(UIColor::primary_txt);
display.drawTextLeftAlign(0, y, buf);
if (nmea == NULL) {
// y = y + 8;
display.setColor(UIColor::warning_txt);
display.drawTextLeftAlign(0, y, "Can't access GPS");
} else {
if (!gps_state || !nmea->isValid()) {
@@ -275,6 +277,7 @@ public:
} else {
sprintf(buf, "%d sat", nmea->satellitesCount());
}
display.setColor(UIColor::primary_txt);
display.drawTextRightAlign(display.width()-1, y, buf);
y = y + 8;
sprintf(buf, "lat %.4f",
@@ -350,8 +353,10 @@ public:
r.skipData(type);
strcpy(name, "unk"); sprintf(buf, "");
}
display.setColor(UIColor::secondary_txt);
display.setCursor(0, y);
display.print(name);
display.setColor(UIColor::primary_txt);
display.setCursor(
display.width()-display.getTextWidth(buf)-1, y
);
@@ -362,7 +367,7 @@ public:
else sensors_scroll_offset = 0;
#endif
} else if (_page == HomePage::SHUTDOWN) {
display.setColor(DisplayDriver::GREEN);
display.setColor(UIColor::secondary_txt);
display.setTextSize(1);
if (_shutdown_init) {
display.drawTextCentered(display.width() / 2, 20, "hibernating...");
@@ -694,9 +699,9 @@ void UITask::loop() {
_display->setTextSize(1);
int y = _display->height() / 3;
int p = _display->height() / 32;
_display->setColor(DisplayDriver::DARK);
_display->setColor(UIColor::popup_bkg);
_display->fillRect(p, y, _display->width() - p*2, y);
_display->setColor(DisplayDriver::LIGHT); // draw box border
_display->setColor(UIColor::popup_txt); // draw box border
_display->drawRect(p, y, _display->width() - p*2, y);
_display->drawTextCentered(_display->width() / 2, y + p*3, _alert);
_next_refresh = _alert_expiry; // will need refresh when alert is dismissed
+58 -32
View File
@@ -1,4 +1,5 @@
#include "UITask.h"
#include "target.h"
#include <Arduino.h>
#include <helpers/CommonCLI.h>
@@ -9,6 +10,8 @@
#define AUTO_OFF_MILLIS 20000 // 20 seconds
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds
#define POWEROFF_DELAY 3000
// 'meshcore', 128x13px
static const uint8_t meshcore_logo [] PROGMEM = {
0x3c, 0x01, 0xe3, 0xff, 0xc7, 0xff, 0x8f, 0x03, 0x87, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe,
@@ -29,9 +32,14 @@ static const uint8_t meshcore_logo [] PROGMEM = {
void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version) {
_prevBtnState = HIGH;
_auto_off = millis() + AUTO_OFF_MILLIS;
_started_at = millis();
_node_prefs = node_prefs;
_display->turnOn();
#if defined(PIN_USER_BTN) && defined(DISPLAY_CLASS)
user_btn.begin();
#endif
// strip off dash and commit hash by changing dash to null terminator
// e.g: v1.2.3-abcdef -> v1.2.3
char *version = strdup(firmware_version);
@@ -41,47 +49,56 @@ void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* fi
}
// v1.2.3 (1 Jan 2025)
sprintf(_version_info, "%s (%s)", version, build_date);
snprintf(_version_info, sizeof(_version_info), "%s (%s)", version, build_date);
free(version);
}
void UITask::renderCurrScreen() {
char tmp[80];
if (millis() < BOOT_SCREEN_MILLIS) { // boot screen
if (millis() < _started_at + BOOT_SCREEN_MILLIS) { // boot screen
// meshcore logo
_display->setColor(DisplayDriver::BLUE);
_display->setColor(UIColor::corp_blue);
int logoWidth = 128;
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
// meshcore website
const char* website = "https://meshcore.io";
_display->setColor(DisplayDriver::LIGHT);
_display->setColor(UIColor::primary_txt);
_display->setTextSize(1);
uint16_t websiteWidth = _display->getTextWidth(website);
_display->setCursor((_display->width() - websiteWidth) / 2, 22);
_display->print(website);
_display->drawTextCentered(_display->width() / 2, 22, website);
// version info
_display->setColor(DisplayDriver::LIGHT);
_display->setTextSize(1);
uint16_t versionWidth = _display->getTextWidth(_version_info);
_display->setCursor((_display->width() - versionWidth) / 2, 35);
_display->print(_version_info);
_display->drawTextCentered(_display->width() / 2, 35, _version_info);
// node type
const char* node_type = "< Repeater >";
uint16_t typeWidth = _display->getTextWidth(node_type);
_display->setCursor((_display->width() - typeWidth) / 2, 48);
_display->print(node_type);
} else { // home screen
// node name
_display->drawTextCentered(_display->width() / 2, 48, node_type);
} else if (_powering_off_at > 0) {
// meshcore logo
_display->setColor(UIColor::corp_blue);
int logoWidth = 128;
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
// meshcore website
const char* website = "https://meshcore.io";
_display->setColor(UIColor::primary_txt);
_display->setTextSize(1);
_display->drawTextCentered(_display->width()/ 2, 22, website);
// Powering off
const char* poweroff_string = "Turning OFF";
uint16_t poffWidth = _display->getTextWidth(poweroff_string);
_display->setCursor((_display->width() - poffWidth) / 2, 48);
_display->drawTextCentered(_display->width()/2, 48, poweroff_string);
} else {
_display->setCursor(0, 0);
_display->setTextSize(1);
_display->setColor(DisplayDriver::GREEN);
_display->setColor(UIColor::primary_txt);
_display->print(_node_prefs->node_name);
// freq / sf
_display->setCursor(0, 20);
_display->setColor(DisplayDriver::YELLOW);
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
_display->print(tmp);
@@ -93,21 +110,19 @@ void UITask::renderCurrScreen() {
}
void UITask::loop() {
#ifdef PIN_USER_BTN
if (millis() >= _next_read) {
int btnState = digitalRead(PIN_USER_BTN);
if (btnState != _prevBtnState) {
if (btnState == USER_BTN_PRESSED) { // pressed?
if (_display->isOn()) {
// TODO: any action ?
} else {
_display->turnOn();
}
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
}
_prevBtnState = btnState;
#if defined(PIN_USER_BTN) && defined(DISPLAY_CLASS)
int ev = user_btn.check();
if (ev == BUTTON_EVENT_CLICK) {
if (_display->isOn()) {
// TODO: any action ?
} else {
_display->turnOn();
}
_next_read = millis() + 200; // 5 reads per second
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
} else if (ev == BUTTON_EVENT_LONG_PRESS) {
_display->turnOn();
Serial.println("Powering Off");
_powering_off_at = millis() + POWEROFF_DELAY;
}
#endif
@@ -123,4 +138,15 @@ void UITask::loop() {
_display->turnOff();
}
}
if (_powering_off_at > 0) { // power off timer armed
#if defined(LED_PIN) && defined(LED_STATE_ON)
digitalWrite(LED_PIN, LED_STATE_ON); // switch on the led until poweroff
delay(1000);
digitalWrite(LED_PIN, !LED_STATE_ON); // off LED
#endif
if (millis() > _powering_off_at) {
_board->powerOff(); // should not return
}
}
}
+4 -1
View File
@@ -4,15 +4,18 @@
#include <helpers/CommonCLI.h>
class UITask {
mesh::MainBoard* _board;
DisplayDriver* _display;
unsigned long _next_read, _next_refresh, _auto_off;
int _prevBtnState;
NodePrefs* _node_prefs;
char _version_info[32];
unsigned long _powering_off_at = 0;
unsigned long _started_at = 0;
void renderCurrScreen();
public:
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
UITask(mesh::MainBoard& board, DisplayDriver& display) : _board(&board), _display(&display) { _next_read = _next_refresh = 0; }
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version);
void loop();
+1 -1
View File
@@ -5,7 +5,7 @@
#ifdef DISPLAY_CLASS
#include "UITask.h"
static UITask ui_task(display);
static UITask ui_task(board, display);
#endif
#ifdef ETHERNET_ENABLED
+3 -5
View File
@@ -49,20 +49,19 @@ void UITask::renderCurrScreen() {
char tmp[80];
if (millis() < BOOT_SCREEN_MILLIS) { // boot screen
// meshcore logo
_display->setColor(DisplayDriver::BLUE);
_display->setColor(UIColor::corp_blue);
int logoWidth = 128;
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
// meshcore website
const char* website = "https://meshcore.io";
_display->setColor(DisplayDriver::LIGHT);
_display->setColor(UIColor::primary_txt);
_display->setTextSize(1);
uint16_t websiteWidth = _display->getTextWidth(website);
_display->setCursor((_display->width() - websiteWidth) / 2, 22);
_display->print(website);
// version info
_display->setColor(DisplayDriver::LIGHT);
_display->setTextSize(1);
uint16_t versionWidth = _display->getTextWidth(_version_info);
_display->setCursor((_display->width() - versionWidth) / 2, 35);
@@ -77,12 +76,11 @@ void UITask::renderCurrScreen() {
// node name
_display->setCursor(0, 0);
_display->setTextSize(1);
_display->setColor(DisplayDriver::GREEN);
_display->setColor(UIColor::primary_txt);
_display->print(_node_prefs->node_name);
// freq / sf
_display->setCursor(0, 20);
_display->setColor(DisplayDriver::YELLOW);
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
_display->print(tmp);
+3 -5
View File
@@ -49,20 +49,19 @@ void UITask::renderCurrScreen() {
char tmp[80];
if (millis() < BOOT_SCREEN_MILLIS) { // boot screen
// meshcore logo
_display->setColor(DisplayDriver::BLUE);
_display->setColor(UIColor::corp_blue);
int logoWidth = 128;
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
// meshcore website
const char* website = "https://meshcore.io";
_display->setColor(DisplayDriver::LIGHT);
_display->setColor(UIColor::primary_txt);
_display->setTextSize(1);
uint16_t websiteWidth = _display->getTextWidth(website);
_display->setCursor((_display->width() - websiteWidth) / 2, 22);
_display->print(website);
// version info
_display->setColor(DisplayDriver::LIGHT);
_display->setTextSize(1);
uint16_t versionWidth = _display->getTextWidth(_version_info);
_display->setCursor((_display->width() - versionWidth) / 2, 35);
@@ -77,12 +76,11 @@ void UITask::renderCurrScreen() {
// node name
_display->setCursor(0, 0);
_display->setTextSize(1);
_display->setColor(DisplayDriver::GREEN);
_display->setColor(UIColor::primary_txt);
_display->print(_node_prefs->node_name);
// freq / sf
_display->setCursor(0, 20);
_display->setColor(DisplayDriver::YELLOW);
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
_display->print(tmp);