2026-05-12 14:45:02 +02:00
|
|
|
#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;
|
2026-06-03 14:14:28 +02:00
|
|
|
int _scroll = 0;
|
2026-05-12 14:45:02 +02:00
|
|
|
|
2026-06-20 09:07:00 +02:00
|
|
|
static const int ITEM_COUNT = 8;
|
2026-05-12 14:45:02 +02:00
|
|
|
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);
|
2026-06-15 21:23:00 +02:00
|
|
|
display.drawCenteredHeader("TOOLS");
|
2026-05-22 18:34:20 +02:00
|
|
|
|
2026-06-15 21:23:00 +02:00
|
|
|
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);
|
2026-06-15 14:41:46 +02:00
|
|
|
display.setCursor(2, y);
|
2026-06-03 14:14:28 +02:00
|
|
|
display.print(ITEMS[idx]);
|
2026-06-15 21:23:00 +02:00
|
|
|
});
|
2026-05-12 14:45:02 +02:00
|
|
|
return 500;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool handleInput(char c) override {
|
2026-06-18 09:16:57 +02:00
|
|
|
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; }
|
2026-05-12 14:45:02 +02:00
|
|
|
if (c == KEY_CANCEL || c == KEY_CONTEXT_MENU) { _task->gotoHomeScreen(); return true; }
|
|
|
|
|
if (c == KEY_ENTER) {
|
2026-05-14 16:08:33 +02:00
|
|
|
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; }
|
2026-05-25 09:10:40 +02:00
|
|
|
if (_sel == 4) { _task->gotoTrailScreen(); return true; }
|
2026-06-03 14:07:53 +02:00
|
|
|
if (_sel == 5) { _task->gotoCompassScreen(); return true; }
|
2026-06-18 22:34:52 +02:00
|
|
|
if (_sel == 6) { _task->gotoDiagnosticsScreen(); return true; }
|
2026-06-20 09:07:00 +02:00
|
|
|
if (_sel == 7) { _task->gotoRepeaterScreen(); return true; }
|
2026-05-12 14:45:02 +02:00
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
2026-06-20 09:07:00 +02:00
|
|
|
const char* ToolsScreen::ITEMS[8] = { "Ringtone Editor", "Auto-Reply Bot", "Nearby Nodes", "Auto-Advert", "Trail", "Compass", "Diagnostics", "Repeater" };
|