mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-30 08:48:12 +00:00
Settings > Radio gains a repeater toggle, 16 community-suggested radio presets plus manual Freq/SF/BW/CR tuning (digit-by-digit Freq editor), 4 persisted user preset slots, and the packet pool bumped 16->32 so queued retransmits stop starving incoming-packet allocation while relaying. Four opt-in politeness knobs (skip-advert, max-hops, yield, min-SNR), all flood-only and off by default, plus overhear suppression that cancels a queued retransmit if a peer relays the same packet first. Adaptive Power Control is suppressed while relaying (pins TX power to the ceiling) and duty-cycle RX is forced off, since a repeater needs to hear and relay at consistent power. A dedicated Tools > Repeater screen consolidates the toggle, the politeness knobs, and live forwarding stats, plus an optional "Custom" radio profile — a dedicated frequency/SF/BW/CR for relaying, separate from the companion's own network, band-matched to the companion frequency by default and used everywhere a radio change can happen (boot, on-device toggle, app-driven CMD_SET_RADIO_PARAMS, Settings radio edits) so the device never silently falls back to the wrong params mid-relay. Diagnostics gains the actually-forwarded packet count, real heap-free via mallinfo(), a reset-counters popup, and hardened loop-detect bounds. Also: a frequency-floor fix and a float-equality preset-match fix in the repeater profile logic, deduped BW-table/valCol/profile- seeding helpers shared between Settings and the Repeater screen, and a build.sh fix tolerating control characters in `pio project config`'s JSON dump. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
47 lines
1.8 KiB
C++
47 lines
1.8 KiB
C++
#pragma once
|
|
// Custom screen — not part of upstream UITask.cpp
|
|
// Included by UITask.cpp just before HomeScreen.
|
|
|
|
class ToolsScreen : public UIScreen {
|
|
UITask* _task;
|
|
int _sel;
|
|
int _scroll = 0;
|
|
|
|
static const int ITEM_COUNT = 8;
|
|
static const char* ITEMS[ITEM_COUNT];
|
|
|
|
public:
|
|
ToolsScreen(UITask* task) : _task(task), _sel(0) {}
|
|
|
|
int render(DisplayDriver& display) override {
|
|
display.setTextSize(1);
|
|
display.setColor(DisplayDriver::LIGHT);
|
|
display.drawCenteredHeader("TOOLS");
|
|
|
|
drawList(display, ITEM_COUNT, _sel, _scroll, [&](int idx, int y, bool sel, int reserve) {
|
|
display.drawSelectionRow(0, y - 1, display.width() - reserve, display.lineStep() - 1, sel);
|
|
display.setCursor(2, y);
|
|
display.print(ITEMS[idx]);
|
|
});
|
|
return 500;
|
|
}
|
|
|
|
bool handleInput(char c) override {
|
|
if (c == KEY_UP) { _sel = (_sel > 0) ? _sel - 1 : ITEM_COUNT - 1; return true; }
|
|
if (c == KEY_DOWN) { _sel = (_sel < ITEM_COUNT - 1) ? _sel + 1 : 0; return true; }
|
|
if (c == KEY_CANCEL || c == KEY_CONTEXT_MENU) { _task->gotoHomeScreen(); return true; }
|
|
if (c == KEY_ENTER) {
|
|
if (_sel == 0) { _task->gotoRingtoneEditor(); return true; }
|
|
if (_sel == 1) { _task->gotoBotScreen(); return true; }
|
|
if (_sel == 2) { _task->gotoNearbyScreen(); return true; }
|
|
if (_sel == 3) { _task->gotoAutoAdvertScreen(); return true; }
|
|
if (_sel == 4) { _task->gotoTrailScreen(); return true; }
|
|
if (_sel == 5) { _task->gotoCompassScreen(); return true; }
|
|
if (_sel == 6) { _task->gotoDiagnosticsScreen(); return true; }
|
|
if (_sel == 7) { _task->gotoRepeaterScreen(); return true; }
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
const char* ToolsScreen::ITEMS[8] = { "Ringtone Editor", "Auto-Reply Bot", "Nearby Nodes", "Auto-Advert", "Trail", "Compass", "Diagnostics", "Repeater" };
|