Files
roro9stack/src/ui/widgets.h
T
twislaandClaude Opus 5.5 b1de0f8804 M3 step 5: Sweep, the band's signal strength as bars and a waterfall
Tab in the LoRa Scanner sweeps 863-870 MHz in 100 kHz steps (the
strongest of three RSSI readings at each, at 125 kHz), shown as bars with
peak hold over a waterfall, the Sniffer's frequency marked (Q98). The
Sweep pauses the Sniffer and keeps its packets; Tab resumes it (Q99).
Status Bar: SW. The floor, top and peaks are host-tested; `lora sweep
on|off|dump` prints them on the console.

At the desk: about 607 ms a pass, a flat floor at -100 to -102 dBm
(15 dB above the chip's own) and a steady carrier at 863.2 MHz.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
2026-10-05 20:28:46 +02:00

65 lines
2.5 KiB
C++

#pragma once
#include <functional>
#include <string>
#include <vector>
#include "canvas.h"
#include "dialog_model.h"
#include "line_editor.h"
#include "list_model.h"
#include "text_wrap.h"
#include "theme.h"
#include "toast_queue.h"
namespace roro {
struct StatusInfo {
std::string title;
int batteryPercent = -1; // -1: unknown
std::string clock = "--:--";
bool sdPresent = false;
int sdLevel = 0; // StorageMonitor level
char compose = 0; // pending Compose Key state
enum class Wifi { None, Searching, Connected, Monitoring } wifi = Wifi::None;
int wifiBars = 0; // 0..3 when Connected
int unread = 0; // unread messages across Services
enum class Gnss { None, Searching, TwoD, ThreeD } gnss = Gnss::None; // None: GNSS off (Q61)
int gnssSatellites = 0; // used in the Fix
bool tracking = false; // a Track is recording (Q63)
enum class Radio { None, Listening, Packet, Sweep } radio = Radio::None; // M3, Q101: Packet flashes
bool capturing = false; // a LoRa Capture is recording (Q97)
bool operator==(const StatusInfo& o) const {
return title == o.title && batteryPercent == o.batteryPercent && clock == o.clock &&
sdPresent == o.sdPresent && sdLevel == o.sdLevel && compose == o.compose && wifi == o.wifi &&
wifiBars == o.wifiBars && unread == o.unread && gnss == o.gnss && gnssSatellites == o.gnssSatellites &&
tracking == o.tracking && radio == o.radio && capturing == o.capturing;
}
bool operator!=(const StatusInfo& o) const { return !(*this == o); }
};
namespace widgets {
// Width in pixels of text in the body font.
MeasureText bodyMeasure(Canvas& canvas);
void statusBar(Canvas& c, const StatusInfo& info);
// A selectable list; `label(i)` gives row i's text and `value(i)`, if given, a right-aligned value.
void list(Canvas& c, const ListModel& model, theme::Rect area, const std::function<std::string(int)>& label,
const std::function<std::string(int)>& value = nullptr);
// Pre-wrapped lines starting at `firstLine`, with a scroll indicator when they don't all fit.
void textLines(Canvas& c, const std::vector<std::string>& lines, int firstLine, theme::Rect area);
// One line of editable text with a cursor; scrolls horizontally to keep the cursor visible.
void lineEditor(Canvas& c, const LineEditor& editor, theme::Rect area);
void dialog(Canvas& c, const std::string& title, const std::string& message, const DialogModel& model);
void toast(Canvas& c, const Toast& t);
} // namespace widgets
} // namespace roro