mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-10-14 17:41:58 +00:00
- L1's MessagesScreen sends through UiCore::sendDirectText / sendChannelText (its own copy of send + file + ACK tracking gone). - ui-core/Telemetry.h: the dashboard fields (numbers, names, formats) and sensor readings as text, each frontend passing its Style; L2 Home, L1's clock page, lock screen, sensors page and GPS altitude use it. - L2: the side button held in the first 8 s is the CLI rescue, as on L1. - L1's repeater radio goes through rptctl. - L1 Settings are built from SettingsSchema: short labels for small screens, SCHEMA_* placeholders expand to the schema's sections, one generic row (switch ON/OFF, bars for brightness / volume). 20 hand-written rows and their tables gone; L1 implements applyDisplayPrefs / applySoundPrefs. settings::text / step / indexOf shared with L2. - Schema: auto-off gains 5 s; the advert sound scope reads "Direct". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
2.0 KiB
C++
66 lines
2.0 KiB
C++
#pragma once
|
|
// Configures which data fields appear on the clock home page.
|
|
// Included by UITask.cpp after BotScreen.h.
|
|
|
|
// The fields and their names: ui-core/Telemetry.h.
|
|
|
|
class DashboardConfigScreen : public UIScreen {
|
|
UITask* _task;
|
|
NodePrefs* _prefs;
|
|
|
|
static const int FIELD_SLOTS = 3;
|
|
|
|
int _sel;
|
|
bool _dirty;
|
|
|
|
void cycle(int slot, int dir) {
|
|
uint8_t& f = _prefs->dashboard_fields[slot];
|
|
f = (uint8_t)((f + telemetry::COUNT + dir) % telemetry::COUNT);
|
|
_dirty = true;
|
|
}
|
|
|
|
public:
|
|
DashboardConfigScreen(UITask* task, NodePrefs* prefs) : _task(task), _prefs(prefs) {}
|
|
|
|
void onShow() override { _sel = 0; _dirty = false; }
|
|
|
|
int render(DisplayDriver& display) override {
|
|
display.setTextSize(1);
|
|
display.setColor(DisplayDriver::LIGHT);
|
|
int item_h = display.lineStep();
|
|
int start_y = display.listStart();
|
|
int val_x = display.valCol();
|
|
|
|
display.drawCenteredHeader("CLOCK FIELDS");
|
|
|
|
static const char* labels[] = { "Field 1", "Field 2", "Field 3" };
|
|
for (int i = 0; i < FIELD_SLOTS; i++) {
|
|
int y = start_y + i * item_h;
|
|
bool sel = (i == _sel);
|
|
display.drawSelectionRow(0, y - 1, display.width(), item_h, sel);
|
|
display.setCursor(2, y);
|
|
display.print(labels[i]);
|
|
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);
|
|
}
|
|
return 500;
|
|
}
|
|
|
|
bool handleInput(char c) override {
|
|
if (c == KEY_CANCEL) {
|
|
_task->savePrefsIfDirty(_dirty);
|
|
_task->gotoHomeScreen();
|
|
return true;
|
|
}
|
|
if (c == KEY_UP) { _sel = (_sel > 0) ? _sel - 1 : FIELD_SLOTS - 1; return true; }
|
|
if (c == KEY_DOWN) { _sel = (_sel < FIELD_SLOTS - 1) ? _sel + 1 : 0; return true; }
|
|
if (keyIsPrev(c)) { cycle(_sel, -1); return true; }
|
|
if (keyIsNext(c)) { cycle(_sel, 1); return true; }
|
|
if (c == KEY_ENTER) { cycle(_sel, 1); return true; }
|
|
return false;
|
|
}
|
|
};
|
|
|