Public Access
The radio's noise: the GNSS receiver costs 8 dB; a setting pauses it (#20)
Debug Builds: `lora noise test` changes one thing at a time, Sweeps the band, and reports the floor under each condition; it runs on the device by itself, since one condition pauses Wi-Fi (not saved, so a restart brings it back). Result, at 125 kHz: -117 dBm with the antenna switched off, -106 with the GNSS receiver in standby, -98 with it running. The receiver's serial line isn't it (one sentence a second changes nothing), and neither are the main loop, the CPU frequency, Wi-Fi, the screen or the radio's own regulator, all within 1 dB. Settings > "Pause GNSS for LoRa", off by default: the receiver waits in standby while the radio listens or sweeps, except during a Track, and has a Fix again about 7 s after. The GNSS App says it's paused. 11 dB remain between the antenna with GNSS quiet and the chip alone, untouched by anything that can be switched from the firmware. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "services/gnss_service.h"
|
||||
#include "services/power_service.h"
|
||||
#include "services/lora_capture_service.h"
|
||||
#include "services/noise_test.h"
|
||||
#include "services/radio_service.h"
|
||||
#include "services/storage_service.h"
|
||||
#include "services/update_service.h"
|
||||
@@ -66,6 +67,9 @@ static ClockService* clockService;
|
||||
static GnssService* gnssService;
|
||||
static RadioService* radioService;
|
||||
static LoraCaptureService* loraCapture;
|
||||
#ifdef RORO_DEBUG
|
||||
static NoiseTest* noiseTest;
|
||||
#endif
|
||||
static GeminiService* geminiService;
|
||||
static SavedNetworks* savedNetworks;
|
||||
static WifiService* wifi;
|
||||
@@ -180,6 +184,9 @@ void setup() {
|
||||
services.add(*gnssService);
|
||||
services.add(*radioService);
|
||||
loraCapture = new LoraCaptureService(*radioService, *storageService, *clockService, bus);
|
||||
#ifdef RORO_DEBUG
|
||||
noiseTest = new NoiseTest(*radioService);
|
||||
#endif
|
||||
services.add(*loraCapture);
|
||||
services.add(*storageService);
|
||||
services.add(*wifi);
|
||||
@@ -414,6 +421,7 @@ static const char* const kHelp =
|
||||
"lora capture start|stop a LoRa Capture to /captures/lora (pcap, LoRaTap)\n"
|
||||
"lora sweep on [from MHz] [to MHz] [step kHz] | off | dump RSSI across a band (863 870 100)\n"
|
||||
"lora custom <MHz> <BW kHz> <SF> <CR 5-8> <sync hex> [preamble] e.g. 868.1 125 7 5 34 8 (LoRaWAN)\n"
|
||||
"gnss quiet on|off pause the GNSS receiver while the LoRa radio listens (it costs the radio 8 dB)\n"
|
||||
"gnss status | gnss restart | gnss track start|stop | gnss nmea on|off | gnss send <sentence without $ and checksum>\n"
|
||||
"crash the last crash: firmware, reason, task, backtrace\n"
|
||||
"coredump erase forget the core dump in flash\n"
|
||||
@@ -429,6 +437,7 @@ static const char* const kHelp =
|
||||
"crash abort|wdt crash on purpose (to test crash reports and Safe Mode)\n"
|
||||
"wifi ip ... try <seconds> | wifi ip keep a trial IP setting: back to the previous one unless kept\n"
|
||||
"loop spin on|off make the main loop spin without resting, to compare load and radio noise\n"
|
||||
"lora noise test [gnss|quiet] | lora noise report Sweep under one changed condition at a time (Wi-Fi goes off for a moment)\n"
|
||||
"lora inject <hex> [rssi] [snr] a packet into the LoRa Scanner as if received (nothing is sent)\n"
|
||||
"coredump get (Debug Console only) send the raw core dump: use scripts/rdbg.py coredump\n"
|
||||
"reset (Debug Console only) restart at once, even if the main loop is stuck\n"
|
||||
@@ -503,6 +512,72 @@ static void runCommand(String line) {
|
||||
if (line == "lora probe" && radioService) radioService->probe(console);
|
||||
if (line == "lora status" && radioService) radioService->printStatus(console);
|
||||
if ((line == "lora rx on" || line == "lora rx off") && radioService) radioService->setEcho(line.endsWith("on"));
|
||||
#ifdef RORO_DEBUG
|
||||
if (line == "lora noise report" && noiseTest) noiseTest->printReport(console);
|
||||
if (line == "lora noise test" && noiseTest && !noiseTest->running()) {
|
||||
// One thing changed at a time, each put back before the next (issue #20). Wi-Fi off cuts the
|
||||
// Debug Console: the report prints when it's over, and `lora noise report` shows it again.
|
||||
using C = NoiseTest::Condition;
|
||||
auto radioOptions = [](bool ldo, bool boosted) { return [=]() { radioService->debugOptions(ldo, boosted); }; };
|
||||
std::vector<C> conditions = {
|
||||
{"as it is", nullptr, nullptr},
|
||||
{"loop spinning", []() { loopSpin = true; }, []() { loopSpin = false; }},
|
||||
{"GNSS in standby", []() { gnssService->send("PCAS12,30"); }, []() { gnssService->restart(millis()); }, 2500},
|
||||
{"CPU at 160 MHz", []() { setCpuFrequencyMhz(160); }, []() { setCpuFrequencyMhz(240); }},
|
||||
{"CPU at 80 MHz", []() { setCpuFrequencyMhz(80); }, []() { setCpuFrequencyMhz(240); }},
|
||||
{"radio regulator: LDO", radioOptions(true, true), radioOptions(false, true)},
|
||||
{"radio gain not boosted", radioOptions(false, false), radioOptions(false, true)},
|
||||
{"as it is, again", nullptr, nullptr},
|
||||
{"Wi-Fi off", []() { wifi->debugPause(true); }, []() { wifi->debugPause(false); }, 4000},
|
||||
{"screen on", []() { power->onKey(millis()); }, nullptr, 1000},
|
||||
{"as it is, at the end", nullptr, nullptr, 8000},
|
||||
};
|
||||
noiseTest->start(std::move(conditions));
|
||||
}
|
||||
if (line == "lora noise test quiet" && noiseTest && !noiseTest->running()) {
|
||||
// The same conditions as the first test, with the GNSS receiver in standby throughout: with
|
||||
// the loudest source out of the way, what else shows?
|
||||
using C = NoiseTest::Condition;
|
||||
auto radioOptions = [](bool ldo, bool boosted) { return [=]() { radioService->debugOptions(ldo, boosted); }; };
|
||||
std::vector<C> conditions = {
|
||||
{"GNSS on (reference)", nullptr, nullptr},
|
||||
{"GNSS in standby", []() { gnssService->send("PCAS12,300"); }, nullptr, 2500},
|
||||
{"+ loop spinning", []() { loopSpin = true; }, []() { loopSpin = false; }},
|
||||
{"+ CPU at 160 MHz", []() { setCpuFrequencyMhz(160); }, []() { setCpuFrequencyMhz(240); }},
|
||||
{"+ CPU at 80 MHz", []() { setCpuFrequencyMhz(80); }, []() { setCpuFrequencyMhz(240); }},
|
||||
{"+ radio regulator: LDO", radioOptions(true, true), radioOptions(false, true)},
|
||||
{"+ radio gain not boosted", radioOptions(false, false), radioOptions(false, true)},
|
||||
{"GNSS in standby, again", nullptr, nullptr},
|
||||
{"+ Wi-Fi off", []() { wifi->debugPause(true); }, []() { wifi->debugPause(false); }, 4000},
|
||||
{"+ screen on", []() { power->onKey(millis()); }, nullptr, 1000},
|
||||
{"+ antenna switched off", []() { radioService->debugAntenna(false); }, []() { radioService->debugAntenna(true); }},
|
||||
{"+ antenna off, gain not boosted", []() { radioService->debugAntenna(false); radioService->debugOptions(false, false); },
|
||||
[]() { radioService->debugAntenna(true); radioService->debugOptions(false, true); }},
|
||||
{"GNSS in standby, at the end", nullptr, []() { gnssService->restart(millis()); }, 8000},
|
||||
};
|
||||
noiseTest->start(std::move(conditions));
|
||||
}
|
||||
if (line == "lora noise test gnss" && noiseTest && !noiseTest->running()) {
|
||||
// The first test pointed at the GNSS receiver. Is it the receiver working, or its serial
|
||||
// line (about 20 sentences a second, next to the antenna)? Standby stops both; one sentence
|
||||
// a second quietens the line and leaves the receiver tracking. PCAS03 picks the sentences:
|
||||
// GGA, GLL, GSA, GSV, RMC, VTG, ZDA, ANT; all eight are on by default.
|
||||
using C = NoiseTest::Condition;
|
||||
auto standby = []() { gnssService->send("PCAS12,30"); };
|
||||
auto wake = []() { gnssService->restart(millis()); };
|
||||
std::vector<C> conditions = {
|
||||
{"as it is", nullptr, nullptr},
|
||||
{"GNSS in standby", standby, wake, 2500},
|
||||
{"GNSS on again", nullptr, nullptr, 5000},
|
||||
{"GNSS: RMC only", []() { gnssService->send("PCAS03,0,0,0,0,1,0,0,0,0,0,,,0,0"); },
|
||||
[]() { gnssService->send("PCAS03,1,1,1,1,1,1,1,1,0,0,,,0,0"); }, 2500},
|
||||
{"GNSS: all sentences again", nullptr, nullptr, 3000},
|
||||
{"GNSS in standby, again", standby, wake, 2500},
|
||||
{"GNSS on again", nullptr, nullptr, 5000},
|
||||
};
|
||||
noiseTest->start(std::move(conditions));
|
||||
}
|
||||
#endif
|
||||
if (line.startsWith("lora sweep") && radioService) { // on [from MHz] [to MHz] [step kHz] | off | dump
|
||||
if (line == "lora sweep dump") radioService->printSweep(console);
|
||||
else if (line == "lora sweep off") {
|
||||
@@ -550,6 +625,10 @@ static void runCommand(String line) {
|
||||
if (p) radioService->setPreset(*p);
|
||||
console.printf("lora preset: %s\n", p ? p->name : "unknown (LongFast LongSlow MediumSlow MediumFast ShortSlow ShortFast LongMod)");
|
||||
}
|
||||
if (line == "gnss quiet on" || line == "gnss quiet off") { // Settings > Pause GNSS for LoRa (issue #20)
|
||||
settings.setBool(Setting::GnssQuietForLora, line.endsWith("on"));
|
||||
console.printf("gnss quiet: %s\n", line.endsWith("on") ? "GNSS pauses while the LoRa radio listens" : "GNSS stays on");
|
||||
}
|
||||
if (line == "gnss status" && gnssService) gnssService->printStatus(console, millis());
|
||||
if ((line == "gnss nmea on" || line == "gnss nmea off") && gnssService) gnssService->setEcho(line.endsWith("on"));
|
||||
if (line == "gnss restart" && gnssService) gnssService->restart(millis());
|
||||
@@ -830,6 +909,7 @@ static void loopPass() {
|
||||
tasksStep();
|
||||
#ifdef RORO_DEBUG
|
||||
ipTrialStep();
|
||||
if (noiseTest) noiseTest->step(now);
|
||||
#endif
|
||||
noteStableOnce(now);
|
||||
uploadStep();
|
||||
@@ -843,6 +923,10 @@ static void loopPass() {
|
||||
for (auto& e : events) apps->handleKey(e);
|
||||
}
|
||||
|
||||
// Issue #20: the GNSS receiver costs the LoRa radio 8 dB while it runs. If the user chose so,
|
||||
// it waits in standby while the radio listens or sweeps; never while a Track is recording.
|
||||
gnssService->holdForLora(settings.getBool(Setting::GnssQuietForLora) && !gnssService->tracking() &&
|
||||
(radioService->listening() || radioService->sweeping()));
|
||||
services.tick(now);
|
||||
bus.dispatch();
|
||||
notifier->update(now);
|
||||
|
||||
Reference in New Issue
Block a user