Keep noise history within small-board memory budgets

This commit is contained in:
mikecarper committed 2026-10-22 17:21:33 -07:00
1 parent a1b2d68115
commit 3d29a1d811
12 files changed
+217 -47

No files matched your search

+13 -16
View File
@@ -15,15 +15,7 @@
#include <RTClib.h>
#include <CayenneLPP.h>
#include <target.h>
#ifndef MESH_ENABLE_TELEMETRY_HISTORY
// LoRa-E5-class STM32 repeater images have less than 3 KB of spare flash.
#if defined(STM32_PLATFORM)
#define MESH_ENABLE_TELEMETRY_HISTORY 0
#else
#define MESH_ENABLE_TELEMETRY_HISTORY 1
#endif
#endif
#include <helpers/TelemetryHistoryConfig.h>
#ifndef MESH_ENABLE_TELEMETRY_GPS_HISTORY
// Builds without a GPS provider only collect missing GPS positions. Omit
@@ -299,18 +291,23 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks
#endif
{
struct ScheduledRadioSetting {
// RAM only: group aligned fields to keep each schedule within 32 bytes.
uint64_t hard_end_uptime_millis;
float freq;
float bw;
uint32_t start_time;
uint32_t end_time;
uint16_t preamble = 0;
uint8_t sf;
uint8_t cr;
bool active;
bool temporary;
bool started;
float freq;
float bw;
uint8_t sf;
uint8_t cr;
uint32_t start_time;
uint32_t end_time;
uint64_t hard_end_uptime_millis;
};
static_assert(sizeof(ScheduledRadioSetting) <= 32,
"Scheduled radio rows must retain their compact RAM layout");
static_assert(alignof(ScheduledRadioSetting) >= alignof(uint64_t),
"Scheduled radio uptime deadlines must remain naturally aligned");
FILESYSTEM* _fs;
#ifndef PORTABLE_MQTT_OBSERVER
+1 -8
View File
@@ -46,14 +46,7 @@
namespace mesh { class RoomJsonWriter; }
#ifndef MESH_ENABLE_TELEMETRY_HISTORY
// LoRa-E5-class STM32 room images do not have enough flash for history.
#if defined(STM32_PLATFORM)
#define MESH_ENABLE_TELEMETRY_HISTORY 0
#else
#define MESH_ENABLE_TELEMETRY_HISTORY 1
#endif
#endif
#include <helpers/TelemetryHistoryConfig.h>
#ifndef MESH_ENABLE_TELEMETRY_GPS_HISTORY
#if ENV_INCLUDE_GPS == 1
+4 -3
View File
@@ -11,6 +11,7 @@
#include <helpers/AGCResetScheduler.h>
#include <helpers/BeaconConfig.h>
#include <helpers/RegulatorMode.h>
#include <helpers/TelemetryHistoryConfig.h>
#ifndef RADIO_LIVENESS_SOFT_ONLY
#include <helpers/RadioLivenessTracker.h>
#endif
@@ -215,13 +216,13 @@ public:
// Only successfully published estimates have a timestamp. Unsupported
// transports and disabled/unmeasured profiles return false, not a zero dBm
// reading. millis() may legitimately be zero or wrap between publications.
virtual bool getNoiseFloorReading(uint8_t profile, float& dbm,
uint32_t& published_at_ms) const {
MESH_TELEMETRY_HISTORY_VIRTUAL bool getNoiseFloorReading(
uint8_t profile, float& dbm, uint32_t& published_at_ms) const {
(void)profile; (void)dbm; (void)published_at_ms; return false;
}
// Join a bounded idle-RX collection without discarding a valid estimate or
// interrupting reception, transmission, or another owner of the radio.
virtual void requestNoiseFloorMeasurement() { }
MESH_TELEMETRY_HISTORY_VIRTUAL void requestNoiseFloorMeasurement() { }
// A zero result means there is no active sampled calibration window (or
// that this transport does not expose one). The estimate itself may remain
+7 -2
View File
@@ -24,6 +24,7 @@ public:
static constexpr uint32_t BAD_INTERVAL_MS = 12UL * 60UL * 60UL * 1000UL;
static constexpr uint32_t RECOVERY_MS = 7UL * 24UL * 60UL * 60UL * 1000UL;
static constexpr uint8_t HASH_SLOTS = 11; // maximum normal allowance + evidence of excess
static_assert(HASH_SLOTS <= 15, "Advert hash count must fit its four-bit field");
static constexpr uint8_t PREFIX_BYTES = 6; // first 12 public-key hex characters
enum class Decision : uint8_t { Allow, Duplicate, Quota, BadList, Capacity };
@@ -37,8 +38,10 @@ public:
uint32_t last_heard;
uint16_t forwarded;
uint8_t min_hops;
uint8_t count;
uint8_t flags;
// RAM-only state: count is 0..11 and the four flags are independent.
// Sharing one byte also removes tail padding without shortening history.
uint8_t count : 4;
uint8_t flags : 4;
};
enum LimitReason : uint8_t { WindowQuota = 1, ReceiveHistory = 2, BadListRule = 4 };
@@ -77,6 +80,8 @@ protected:
private:
enum : uint8_t { ACTIVE = 1, PREVIOUS_OVER = 2, BAD = 4, HAS_FORWARDED = 8 };
static_assert((ACTIVE | PREVIOUS_OVER | BAD | HAS_FORWARDED) <= 15,
"Advert flags must fit their four-bit field");
Entry* _entries;
size_t _capacity;
uint32_t _last_sweep = 0;
+20
View File
@@ -0,0 +1,20 @@
#pragma once
// STM32 images omit diagnostic history to preserve their existing flash limit.
// Share this default with radio wrappers so unused publication tracking is
// omitted too. A build may explicitly enable or disable the complete feature.
#ifndef MESH_ENABLE_TELEMETRY_HISTORY
#if defined(STM32_PLATFORM)
#define MESH_ENABLE_TELEMETRY_HISTORY 0
#else
#define MESH_ENABLE_TELEMETRY_HISTORY 1
#endif
#endif
// Disabled builds retain callable unsupported defaults without enlarging each
// radio vtable or retaining unused publication/request implementations.
#if MESH_ENABLE_TELEMETRY_HISTORY
#define MESH_TELEMETRY_HISTORY_VIRTUAL virtual
#else
#define MESH_TELEMETRY_HISTORY_VIRTUAL
#endif
+14
View File
@@ -271,7 +271,9 @@ void RadioLibWrapper::begin() {
_noise_floor_secondary_centi_dbm = 0;
_noise_floor_valid = false;
_noise_floor_secondary_valid = false;
#if MESH_ENABLE_TELEMETRY_HISTORY
_nf_published_valid = 0;
#endif
_threshold = 0;
_cad_enabled = false;
_rx_mode_checked_at = millis();
@@ -920,7 +922,9 @@ void RadioLibWrapper::serviceProfileScan() {
// values from two frequencies are never blended into one estimate.
_noise_floor_valid = false;
_noise_floor_secondary_valid = false;
#if MESH_ENABLE_TELEMETRY_HISTORY
_nf_published_valid = 0;
#endif
_nf_refresh_requested = true;
_nf_last_calib = 0;
_nf_calib_deadline = 0;
@@ -966,7 +970,9 @@ void RadioLibWrapper::serviceProfileScan() {
// the first visit on the replacement tuples.
_noise_floor_valid = false;
_noise_floor_secondary_valid = false;
#if MESH_ENABLE_TELEMETRY_HISTORY
_nf_published_valid = 0;
#endif
_nf_refresh_requested = true;
_nf_last_calib = 0;
_nf_calib_deadline = 0;
@@ -1265,7 +1271,9 @@ void RadioLibWrapper::recalibrateNoiseFloor() {
// available while discarding the old samples and rise-hold history.
_noise_floor_valid = false;
_noise_floor_secondary_valid = false;
#if MESH_ENABLE_TELEMETRY_HISTORY
_nf_published_valid = 0;
#endif
_nf_refresh_requested = true;
_nf_last_calib = 0;
_nf_lazy_refresh = _nf_refresh_attempted = false;
@@ -2083,17 +2091,21 @@ void RadioLibWrapper::loop() {
&& _secondary_floor_estimator.complete()) {
if (_floor_estimator.publish(_noise_floor_centi_dbm, _noise_floor_valid)) {
_noise_floor_valid = true;
#if MESH_ENABLE_TELEMETRY_HISTORY
_nf_published_at[0] = static_cast<uint32_t>(now);
_nf_published_generation[0] = _profiles.generation[0];
_nf_published_valid |= 1U;
#endif
_noise_floor = (_noise_floor_centi_dbm - 50) / 100;
}
if (_secondary_floor_estimator.publish(_noise_floor_secondary_centi_dbm,
_noise_floor_secondary_valid)) {
_noise_floor_secondary_valid = true;
#if MESH_ENABLE_TELEMETRY_HISTORY
_nf_published_at[1] = static_cast<uint32_t>(now);
_nf_published_generation[1] = _profiles.generation[1];
_nf_published_valid |= 2U;
#endif
}
_nf_refresh_requested = false;
_nf_last_calib = now;
@@ -2153,9 +2165,11 @@ void RadioLibWrapper::loop() {
_nf_lazy_refresh = _floor_estimator.publish(_noise_floor_centi_dbm, _noise_floor_valid);
if (_nf_lazy_refresh) {
_noise_floor_valid = true;
#if MESH_ENABLE_TELEMETRY_HISTORY
_nf_published_at[0] = static_cast<uint32_t>(now);
_nf_published_generation[0] = _profiles.generation[0];
_nf_published_valid |= 1U;
#endif
// Retain the whole-dB API/wire format and the fractional display value.
_noise_floor = (_noise_floor_centi_dbm - 50) / 100;
}
+5
View File
@@ -1,6 +1,7 @@
#pragma once
#include "NoiseFloorEstimator.h"
#include "../TelemetryHistoryConfig.h"
#include "../CarrierTools.h"
#include <Mesh.h>
@@ -56,9 +57,11 @@ protected:
uint32_t _cad_scan_timeout_override_ms;
bool _noise_floor_valid;
bool _noise_floor_secondary_valid = false;
#if MESH_ENABLE_TELEMETRY_HISTORY
uint32_t _nf_published_at[2] = {};
uint32_t _nf_published_generation[2] = {};
uint8_t _nf_published_valid = 0;
#endif
bool _nf_refresh_requested;
NoiseFloorEstimator _floor_estimator;
NoiseFloorEstimator _secondary_floor_estimator;
@@ -555,6 +558,7 @@ public:
}
return getNoiseFloorDbm();
}
#if MESH_ENABLE_TELEMETRY_HISTORY
bool getNoiseFloorReading(uint8_t profile, float& dbm,
uint32_t& published_at_ms) const override {
if (profile > 1 || (profile == 1 && !_profiles.enabled())
@@ -566,6 +570,7 @@ public:
return true;
}
void requestNoiseFloorMeasurement() override { requestNoiseFloorRefresh(); }
#endif
float getNoiseFloorCalibrationSecondsRemaining() const override {
const float primary = profileNoiseFloorSecondsRemaining(0);
if (!_profiles.enabled()) return primary;
@@ -45,7 +45,45 @@ TEST_F(FloodAdvertLimit, EveryHopAllowanceAndSaturation) {
EXPECT_EQ(Decision::Quota, receive(expected[hops], hops, 0));
}
EXPECT_EQ(2, Limiter::allowance(63));
EXPECT_EQ(144U, sizeof(Limiter::Entry));
EXPECT_EQ(140U, sizeof(Limiter::Entry));
}
TEST(FloodAdvertPacking, EveryFlagCombinationAndCountRetainsAllHistoryFields) {
Limiter::Entry entry{};
memset(entry.key, 0xa5, sizeof(entry.key));
memset(entry.hashes, 0x5a, sizeof(entry.hashes));
entry.window_start = UINT32_MAX;
entry.last_violation = UINT32_MAX - 1;
entry.last_forwarded = UINT32_MAX - 2;
entry.last_heard = UINT32_MAX - 3;
entry.forwarded = uint16_t((1U << Limiter::HASH_SLOTS) - 1U);
entry.min_hops = 255;
for (uint8_t count = 0; count <= Limiter::HASH_SLOTS; ++count) {
for (uint8_t flags = 0; flags < 16; ++flags) {
entry.flags = flags;
entry.count = count;
EXPECT_EQ(flags, entry.flags);
EXPECT_EQ(count, entry.count);
entry.flags ^= 15;
EXPECT_EQ(uint8_t(flags ^ 15), entry.flags);
EXPECT_EQ(count, entry.count);
entry.flags &= ~8;
entry.flags |= 8;
EXPECT_EQ(uint8_t((flags ^ 15) | 8), entry.flags);
EXPECT_EQ(count, entry.count);
}
}
EXPECT_EQ(UINT32_MAX, entry.window_start);
EXPECT_EQ(UINT32_MAX - 1, entry.last_violation);
EXPECT_EQ(UINT32_MAX - 2, entry.last_forwarded);
EXPECT_EQ(UINT32_MAX - 3, entry.last_heard);
EXPECT_EQ(2047, entry.forwarded);
EXPECT_EQ(255, entry.min_hops);
for (uint8_t byte : entry.key) EXPECT_EQ(0xa5, byte);
for (const auto& hash : entry.hashes) for (uint8_t byte : hash) EXPECT_EQ(0x5a, byte);
EXPECT_EQ(4U, alignof(Limiter::Entry));
EXPECT_EQ(140U * 128U, sizeof(Limiter::Entry[128]));
EXPECT_EQ(140U * 96U, sizeof(Limiter::Entry[96]));
}
TEST_F(FloodAdvertLimit, PrefixIsSixBytesAndCollisionsShareQuota) {
+67 -7
View File
@@ -2,6 +2,7 @@
from pathlib import Path
import os
import re
import subprocess
import sys
import tempfile
@@ -183,6 +184,39 @@ int main(int argc, char** argv) {
}
'''
DISABLED_FIXTURE = r'''
#include <type_traits>
template<class T,class=void> struct HasPublicationState:std::false_type {};
template<class T> struct HasPublicationState<T,
std::void_t<decltype(T::_nf_published_at)>>:std::true_type {};
static_assert(!HasPublicationState<RadioLibWrapper>::value,
"disabled history must not reserve publication timestamp RAM");
static_assert(!std::is_polymorphic<PublicRadio>::value && sizeof(PublicRadio)==1,
"disabled defaults must not add radio vtable slots");
static_assert(std::is_same<decltype(&RadioLibWrapper::getNoiseFloorReading),
bool(PublicRadio::*)(uint8_t,float&,uint32_t&)const>::value,
"disabled history must inherit the unsupported reading API");
static_assert(std::is_same<decltype(&RadioLibWrapper::requestNoiseFloorMeasurement),
void(PublicRadio::*)()>::value,
"disabled history must inherit the no-op request API");
int main() {
RadioLibWrapper w;
w._noise_floor_valid=false;
for (unsigned i=0;i<NoiseFloorEstimator::SAMPLE_COUNT;++i) {
now_ms+=NoiseFloorEstimator::SAMPLE_INTERVAL_MS;
assert(w._floor_estimator.add(-120,now_ms));
}
w.loop();
assert(w._noise_floor_valid && w._noise_floor==-120); // ordinary calibration remains
float dbm=123;uint32_t stamp=456;
assert(!w.getNoiseFloorReading(0,dbm,stamp) && dbm==123 && stamp==456);
w._nf_refresh_requested=false;
w.requestNoiseFloorMeasurement();
assert(!w._nf_refresh_requested && !w.arms && !w.stops);
puts("PASS: disabled");
}
'''
class NoiseFloorReadingTests(unittest.TestCase):
@classmethod
@@ -196,7 +230,19 @@ class NoiseFloorReadingTests(unittest.TestCase):
harness = transition_harness(source).split("struct LegacyRadio {", 1)[0]
api = "\n".join(method(header, signature).replace(" override", "") for signature in (
"bool getNoiseFloorReading(", "void requestNoiseFloorMeasurement("))
api = "#if MESH_ENABLE_TELEMETRY_HISTORY\n" + api + "\n#endif\n"
harness = harness.replace(" bool tryResetAGC();", api + "\n bool tryResetAGC();")
# Use the production field gate too: disabled variants must compile the
# actual radio loop without either the storage or wrapper overrides.
start = header.index("#if MESH_ENABLE_TELEMETRY_HISTORY\n uint32_t _nf_published_at")
state = header[start:header.index("#endif", start) + len("#endif")]
harness = re.sub(r" uint32_t _nf_published_at\[2\][^;]+;\n"
r" uint8_t _nf_published_valid[^;]+;", state, harness)
defaults = "\n".join(method(dispatcher, signature) for signature in (
"MESH_TELEMETRY_HISTORY_VIRTUAL bool getNoiseFloorReading(",
"MESH_TELEMETRY_HISTORY_VIRTUAL void requestNoiseFloorMeasurement("))
harness = harness.replace("struct RadioLibWrapper {",
"struct PublicRadio {\n" + defaults + "\n};\nstruct RadioLibWrapper:PublicRadio {")
harness = harness.replace("#include <cassert>", "#include <cassert>\n#include <cstring>")
harness = harness.replace("bool serviceCarrierWave() { return false; }",
"bool _morse_owned = false, _morse_rx_owned = false, _beacon_owned = false;\n"
@@ -206,22 +252,29 @@ class NoiseFloorReadingTests(unittest.TestCase):
"#define MESH_ENABLE_TX_BEACONS 1\n#define MESH_ENABLE_CARRIER_TOOLS 1\n"
+ loop + "\n#undef MESH_ENABLE_TX_BEACONS\n#undef MESH_ENABLE_CARRIER_TOOLS\n")
fixture = FIXTURE.replace("@DEFAULT_GETTER@", method(dispatcher,
"virtual bool getNoiseFloorReading(")).replace("@DEFAULT_REQUEST@", method(dispatcher,
"virtual void requestNoiseFloorMeasurement("))
"MESH_TELEMETRY_HISTORY_VIRTUAL bool getNoiseFloorReading("))
fixture = fixture.replace("@DEFAULT_REQUEST@", method(dispatcher,
"MESH_TELEMETRY_HISTORY_VIRTUAL void requestNoiseFloorMeasurement("))
cls.binaries = {}
flags = [] if not sys.platform.startswith("linux") else [
"-fsanitize=address,undefined", "-fno-sanitize-recover=all", "-fno-pie", "-no-pie"]
for family in ("sx1262", "other"):
variants = (("sx1262", ["-DUSE_SX1262=1"]), ("other", []),
("stm32_opt_in", ["-DSTM32_PLATFORM=1", "-DMESH_ENABLE_TELEMETRY_HISTORY=1"]),
("stm32_default", ["-DSTM32_PLATFORM=1"]),
("explicit_off", ["-DMESH_ENABLE_TELEMETRY_HISTORY=0"]))
cls.disabled_binaries = {}
for family, defines in variants:
disabled = family in ("stm32_default", "explicit_off")
cpp, binary = work / (family + ".cpp"), work / family
cpp.write_text((harness + fixture).replace("\u2014", "-"), encoding="ascii")
cpp.write_text((harness + (DISABLED_FIXTURE if disabled else fixture))
.replace("\u2014", "-"), encoding="ascii")
built = subprocess.run([os.environ.get("CXX", "g++"), "-std=c++17", "-O1", "-g",
"-Wall", "-Wextra", "-Werror", *flags,
*(["-DUSE_SX1262=1"] if family == "sx1262" else []),
"-Wall", "-Wextra", "-Werror", *flags, *defines,
"-I", str(ROOT / "src"), str(cpp), "-o", str(binary)],
capture_output=True, text=True, timeout=60)
if built.returncode:
raise AssertionError(built.stdout + built.stderr)
cls.binaries[family] = binary
(cls.disabled_binaries if disabled else cls.binaries)[family] = binary
def run_case(self, scenario):
for family, binary in self.binaries.items():
@@ -249,6 +302,13 @@ class NoiseFloorReadingTests(unittest.TestCase):
def test_requests_join_collection_without_interrupting_radio_owners(self):
self.run_case("request")
def test_disabled_history_omits_tracking_and_keeps_ordinary_calibration(self):
for family, binary in self.disabled_binaries.items():
with self.subTest(family=family):
result = subprocess.run([str(binary)], capture_output=True, text=True, timeout=20)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertIn("PASS: disabled", result.stdout)
if __name__ == "__main__":
unittest.main()
+1
View File
@@ -24,6 +24,7 @@ HARNESS = r'''
#include <RadioProfiles.h>
#include <helpers/radiolib/RadioInterruptEvents.h>
#include <helpers/radiolib/NoiseFloorEstimator.h>
#include <helpers/TelemetryHistoryConfig.h>
#define STATE_IDLE 0
#define STATE_RX 1
#define STATE_TX_WAIT 3
+43 -9
View File
@@ -19,6 +19,11 @@ def method(text, signature):
return text[start:end]
SCHEDULED_SETTING = method(
(ROOT / "examples/simple_repeater/MyMesh.h").read_text(encoding="utf-8"),
"struct ScheduledRadioSetting {") + ";"
HARNESS = r'''
#include <cassert>
#include <cstdio>
@@ -106,14 +111,7 @@ struct Radio { uint32_t last_rx = 0; uint32_t getLastRecvMillis() { return last_
// separate Morse loop-policy suite executes the real ownership predicate.
namespace mesh { bool morseTimingActive(const Radio*) { return false; } }
struct Barrier { bool held = false; bool waiting() const { return held; } void clear() { held = false; } };
struct ScheduledRadioSetting {
bool active = false, temporary = false, started = false;
float freq = 0, bw = 0;
uint8_t sf = 0, cr = 0;
uint16_t preamble = 0;
uint32_t start_time = 0, end_time = 0;
uint64_t hard_end_uptime_millis = 0;
};
@SCHEDULED_SETTING@
class MyMesh {
public:
RadioPrefs _prefs;
@@ -128,7 +126,7 @@ public:
bool radio_reply_secondary = false;
mesh::RxInactivityWatchdog rx_inactivity_watchdog;
mesh::RepeaterRadioTiming radio_timing;
ScheduledRadioSetting scheduled_radio_settings[MAX_SCHEDULED_RADIO_SETTINGS];
ScheduledRadioSetting scheduled_radio_settings[MAX_SCHEDULED_RADIO_SETTINGS]{};
uint64_t uptime_millis = 1;
uint32_t last_millis = 1;
uint32_t next_local_advert = 0, next_flood_advert = 0;
@@ -456,6 +454,7 @@ int main() {
puts("Production scheduler, storage-backoff, watchdog and advert scenarios passed");
}
'''
HARNESS = HARNESS.replace("@SCHEDULED_SETTING@", SCHEDULED_SETTING)
CLI_HARNESS = r'''
#include <cassert>
@@ -531,6 +530,41 @@ class RepeaterRadioTimingIntegrationTest(unittest.TestCase):
str(cpp), "-o", str(exe)], check=True)
subprocess.run([str(exe)], check=True)
def test_actual_schedule_rows_are_32_bytes_with_aligned_full_width_fields(self):
self.compile_and_run(r'''
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <type_traits>
@SETTING@
static_assert(sizeof(ScheduledRadioSetting) == 32, "schedule padding increased");
static_assert(alignof(ScheduledRadioSetting) >= alignof(uint64_t), "unaligned deadline");
static_assert(offsetof(ScheduledRadioSetting, hard_end_uptime_millis) == 0, "deadline moved");
static_assert(offsetof(ScheduledRadioSetting, freq) % alignof(float) == 0, "unaligned frequency");
static_assert(offsetof(ScheduledRadioSetting, bw) % alignof(float) == 0, "unaligned bandwidth");
static_assert(offsetof(ScheduledRadioSetting, start_time) % alignof(uint32_t) == 0, "unaligned start");
static_assert(offsetof(ScheduledRadioSetting, end_time) % alignof(uint32_t) == 0, "unaligned end");
static_assert(offsetof(ScheduledRadioSetting, preamble) % alignof(uint16_t) == 0, "unaligned preamble");
static_assert(std::is_standard_layout<ScheduledRadioSetting>::value, "schedule layout changed");
static_assert(std::is_trivially_copyable<ScheduledRadioSetting>::value, "schedule copies changed");
int main() {
ScheduledRadioSetting rows[6]{};
static_assert(sizeof(rows) == 192, "all six schedules must retain their capacity");
assert(rows[0].preamble == 0 && !rows[0].active && !rows[0].temporary && !rows[0].started);
rows[0].hard_end_uptime_millis = 0xFEDCBA9876543210ULL;
rows[0].freq = 911.150f; rows[0].bw = 250;
rows[0].start_time = 0xFFFFFFFEUL; rows[0].end_time = 0xFFFFFFFFUL;
rows[0].preamble = 65535; rows[0].sf = 12; rows[0].cr = 8;
rows[0].active = rows[0].temporary = rows[0].started = true;
rows[5] = rows[0];
assert(rows[5].hard_end_uptime_millis == 0xFEDCBA9876543210ULL);
assert(rows[5].freq == 911.150f && rows[5].bw == 250);
assert(rows[5].start_time == 0xFFFFFFFEUL && rows[5].end_time == 0xFFFFFFFFUL);
assert(rows[5].preamble == 65535 && rows[5].sf == 12 && rows[5].cr == 8);
assert(rows[5].active && rows[5].temporary && rows[5].started);
}
'''.replace("@SETTING@", SCHEDULED_SETTING))
def test_production_scheduler_and_services(self):
source = (ROOT / "examples/simple_repeater/MyMesh.cpp").read_text(encoding="utf-8")
signatures = [
+3 -1
View File
@@ -372,7 +372,9 @@ class SolarXiaoRoomTests(unittest.TestCase):
settings = setup[start:setup.index("#ifdef DISPLAY_CLASS", start)]
start = loop.index("mesh::power::serviceRegulatorSettings();")
periodic = loop[start:loop.index("board.loop();", start) + len("board.loop();")]
history = conditional_block((ROOM / "MyMesh.h").read_text(), "#ifndef MESH_ENABLE_TELEMETRY_HISTORY")
self.assertIn("#include <helpers/TelemetryHistoryConfig.h>", (ROOM / "MyMesh.h").read_text())
history = conditional_block((ROOT / "src/helpers/TelemetryHistoryConfig.h").read_text(),
"#ifndef MESH_ENABLE_TELEMETRY_HISTORY")
self.assertLess(setup.index("board.begin()"), setup.index("mesh::solar::beginSettings"))
self.assertLess(setup.index("mesh::solar::beginSettings"), setup.index("sensors.begin()"))
self.assertLess(setup.index("mesh::solar::beginSettings"), setup.index("radio_init()"))