mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 19:02:00 +00:00
refactor(ui): remove dead code and fix stale comments after the review
- ui-core: Diagnostics::systemLines, NearbyModel::typeShort, rptctl::currentPresetName, RoomSessions::pendingKey, settings::isSwitch, UiCore::reconcileDMUnread. - ui-new: the retired Recent page, fmtAlt, the battMvToPercent wrapper, setFavouriteChannelSlot, AccordionList onHeader/visibleCount, drawBoxedIcon and seven unused icons; info::row folded into info::valueRow. - ui-lvgl: onOpenNav, TileDownloader::withTrails; the trail header size is one constant (TRAIL_HDR) for live and saved trails. - Home quick panels save prefs only when a value changed. - Comments brought in line with the code (status bar reserve, settings rows, page order, SH1106 frame skip, UiCore header). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -118,24 +118,6 @@ inline void shortVersion(char* out, size_t n) {
|
||||
out[len] = '\0';
|
||||
}
|
||||
|
||||
// Static system card, one full-width line each. Returns the line count.
|
||||
inline int systemLines(Line* lines) {
|
||||
int n = 0;
|
||||
char sv[24];
|
||||
shortVersion(sv, sizeof(sv));
|
||||
addLine(lines, n, "FW %s", sv);
|
||||
addLine(lines, n, "Built %s", FIRMWARE_BUILD_DATE);
|
||||
addLine(lines, n, "Dev %s", board.getManufacturerName());
|
||||
addLine(lines, n, "Node %s", the_mesh.getNodeName());
|
||||
NodePrefs* p = the_mesh.getNodePrefs();
|
||||
if (p) {
|
||||
addLine(lines, n, "Freq %.3f MHz", p->freq);
|
||||
addLine(lines, n, "SF%u BW%.0f CR%u", (unsigned)p->sf, p->bw, (unsigned)p->cr);
|
||||
addLine(lines, n, "TX %d dBm", (int)p->tx_power_dbm);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
// One sample per script the UI font covers, to check coverage by eye. "Acc"
|
||||
// takes one letter from each of the keyboard's accent-popup groups.
|
||||
inline int fontLines(Line* lines) {
|
||||
|
||||
@@ -68,16 +68,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static const char* typeShort(uint8_t t) {
|
||||
switch (t) {
|
||||
case ADV_TYPE_REPEATER: return "Rpt";
|
||||
case ADV_TYPE_SENSOR: return "Snsr";
|
||||
case ADV_TYPE_ROOM: return "Room";
|
||||
case ADV_TYPE_CHAT: return "Comp";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
|
||||
void bindModel(UiCore* core, NodePrefs* prefs) { _core = core; _prefs = prefs; }
|
||||
|
||||
int count() const { return _count; }
|
||||
|
||||
@@ -61,11 +61,6 @@ static int currentPreset(const NodePrefs* p) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const char* currentPresetName(const NodePrefs* p) {
|
||||
const char* name; float f, b; uint8_t s, c;
|
||||
return radioctl::presetAt(p, currentPreset(p), name, f, b, s, c) ? name : "Custom";
|
||||
}
|
||||
|
||||
static bool choosePreset(NodePrefs* p, int idx) {
|
||||
const char* name; float f, b; uint8_t s, c;
|
||||
if (!p || !radioctl::presetAt(p, idx, name, f, b, s, c)) return false;
|
||||
|
||||
@@ -43,7 +43,6 @@ public:
|
||||
|
||||
bool loggingIn() const { return _pending; }
|
||||
bool loggingIn(const uint8_t* pub_key) const { return _pending && memcmp(_pending_key, pub_key, 4) == 0; }
|
||||
const uint8_t* pendingKey() const { return _pending_key; }
|
||||
|
||||
// Local only: the room ACL has no session to tear down (MyMesh::logoutRoom()).
|
||||
void logout(const uint8_t* pub_key) {
|
||||
|
||||
@@ -249,8 +249,6 @@ static const char* shortLabel(const Setting& s) {
|
||||
for (auto& l : SHORT_LABELS) if (l.offset == s.offset) return l.text;
|
||||
return s.label;
|
||||
}
|
||||
// A switch: two values, no labels of its own (on / off, however it's stored).
|
||||
static bool isSwitch(const Setting& s) { return !s.option && s.count == 2; }
|
||||
// The index of the setting over NodePrefs field `offset`; -1 if none.
|
||||
static int indexOf(uint16_t offset) {
|
||||
for (int i = 0; i < COUNT; i++) if (ALL[i].offset == offset) return i;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
// UI Core: hardware-independent UI state and logic shared by every frontend
|
||||
// (ui-new today, ui-lvgl later). See docs/solo/developer/ui-core.md.
|
||||
// (ui-new on the OLED / e-ink boards, ui-lvgl on the L2). See
|
||||
// docs/solo/developer/ui-core.md.
|
||||
//
|
||||
// The Core is MyMesh's Listener: it files incoming/outgoing messages into the
|
||||
// history, keeps the unread counters, runs the engines, and tells the frontend
|
||||
@@ -89,7 +90,6 @@ public:
|
||||
void clearAllDMUnread() { dm_unread.clearAll(); }
|
||||
// Every conversation read: direct, channels, rooms.
|
||||
void markAllRead() { _room_unread = 0; dm_unread.clearAll(); history.clearAllChannelUnread(); }
|
||||
void reconcileDMUnread() { dm_unread.reconcile(history); }
|
||||
|
||||
// ── Actions ───────────────────────────────────────────────────────────────
|
||||
// Send a DM composed on the device and file it (with end-to-end ACK tracking
|
||||
|
||||
Reference in New Issue
Block a user