Public Access
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
68 lines
2.4 KiB
C++
68 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "app.h"
|
|
#include "list_model.h"
|
|
#include "services/clock_service.h"
|
|
#include "services/lora_capture_service.h"
|
|
#include "services/radio_service.h"
|
|
#include "settings.h"
|
|
#include "ui/theme.h"
|
|
|
|
namespace roro {
|
|
|
|
// The LoRa Scanner (docs/milestones/M3.md). Sniffer: the packets the radio hears, newest first,
|
|
// with the Meshtastic header read (Q96) and a hex dump on Enter; p picks the preset (Q95), c starts
|
|
// or stops a Capture (Q97). The radio listens while the App is open (Q100). Tab: Sweep, the band's
|
|
// RSSI as bars with peak hold and a waterfall (Q98); it pauses the Sniffer while shown (Q99).
|
|
class LoraScannerApp : public App {
|
|
public:
|
|
LoraScannerApp(RadioService& radio, LoraCaptureService& capture, Settings& settings, ClockService& clock)
|
|
: radio_(radio), capture_(capture), settings_(settings), clock_(clock) {}
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
bool onKey(const KeyEvent& e) override;
|
|
void update(uint32_t nowMs) override;
|
|
void draw(Canvas& c) override;
|
|
|
|
private:
|
|
enum class View { Packets, Details, Presets, Sweep };
|
|
static constexpr int kListRows = 7;
|
|
|
|
void drawPackets(Canvas& c);
|
|
void drawDetails(Canvas& c);
|
|
void drawPresets(Canvas& c);
|
|
void drawSweep(Canvas& c);
|
|
void showSweep(bool on);
|
|
void openDetails();
|
|
std::string timeOf(const RadioPacket& p) const;
|
|
bool meshtasticSettings() const;
|
|
void say(const std::string& text); // a line in the footer for a few seconds
|
|
|
|
RadioService& radio_;
|
|
LoraCaptureService& capture_;
|
|
Settings& settings_;
|
|
ClockService& clock_;
|
|
View view_ = View::Packets;
|
|
ListModel packets_{kListRows};
|
|
ListModel presets_{kListRows + 1};
|
|
uint32_t shownSeq_ = 0; // the newest packet at the last redraw
|
|
uint32_t selectedSeq_ = 0; // what the selection points at, kept as packets arrive
|
|
bool followNewest_ = true; // until the user moves the selection off the top
|
|
std::vector<std::string> details_;
|
|
int detailsTop_ = 0;
|
|
uint32_t lastDrawMs_ = 0;
|
|
std::string message_;
|
|
uint32_t messageMs_ = 0;
|
|
// Sweep, only while shown: peak hold per step, and the waterfall, newest row first.
|
|
static constexpr int kWaterfallRows = 36;
|
|
uint32_t shownSweep_ = 0;
|
|
std::vector<int8_t> peak_;
|
|
std::vector<int8_t> waterfall_; // kWaterfallRows x steps
|
|
uint16_t sweepSteps_ = 0;
|
|
};
|
|
|
|
} // namespace roro
|