diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 737ead06..d57cff7a 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -377,7 +377,7 @@ public: uint8_t getCRPref() const { return _prefs.cr; } float getBWPref() const { return _prefs.bw; } - void begin(FILESYSTEM& fs, BaseSerialInterface& serial) { + void begin(FILESYSTEM& fs, BaseSerialInterface& serial, mesh::RNG& trng) { _fs = &fs; _serial = &serial; @@ -385,7 +385,7 @@ public: IdentityStore store(fs, "/identity"); if (!store.load("_main", self_id)) { - self_id = mesh::LocalIdentity(getRNG()); // create new random identity + self_id = mesh::LocalIdentity(&trng); // create new random identity store.save("_main", self_id); } @@ -696,10 +696,12 @@ void setup() { fast_rng.begin(radio.random(0x7FFFFFFF)); + RadioNoiseListener trng(radio); + #if defined(NRF52_PLATFORM) InternalFS.begin(); - the_mesh.begin(InternalFS, serial_interface); + the_mesh.begin(InternalFS, serial_interface, trng); #elif defined(ESP32) SPIFFS.begin(true); @@ -710,7 +712,7 @@ void setup() { #endif serial_interface.enable(); - the_mesh.begin(SPIFFS, serial_interface); + the_mesh.begin(SPIFFS, serial_interface, trng); #else #error "need to define filesystem" #endif diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index e7f852f3..e803a815 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -563,6 +563,8 @@ void setup() { radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); #endif + fast_rng.begin(radio.random(0x7FFFFFFF)); + FILESYSTEM* fs; #if defined(NRF52_PLATFORM) InternalFS.begin(); @@ -576,7 +578,8 @@ void setup() { #error "need to define filesystem" #endif if (!store.load("_main", the_mesh.self_id)) { - the_mesh.self_id = mesh::LocalIdentity(the_mesh.getRNG()); // create new random identity + RadioNoiseListener rng(radio); + the_mesh.self_id = mesh::LocalIdentity(&rng); // create new random identity store.save("_main", the_mesh.self_id); } diff --git a/examples/simple_room_server/main.cpp b/examples/simple_room_server/main.cpp index b905a7a2..3d84796a 100644 --- a/examples/simple_room_server/main.cpp +++ b/examples/simple_room_server/main.cpp @@ -19,7 +19,7 @@ /* ------------------------------ Config -------------------------------- */ -#define FIRMWARE_VER_TEXT "v4 (build: 31 Jan 2025)" +#define FIRMWARE_VER_TEXT "v4 (build: 2 Feb 2025)" #ifndef LORA_FREQ #define LORA_FREQ 915.0 @@ -721,6 +721,8 @@ void setup() { radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH); #endif + fast_rng.begin(radio.random(0x7FFFFFFF)); + FILESYSTEM* fs; #if defined(NRF52_PLATFORM) InternalFS.begin(); @@ -734,7 +736,8 @@ void setup() { #error "need to define filesystem" #endif if (!store.load("_main", the_mesh.self_id)) { - the_mesh.self_id = mesh::LocalIdentity(the_mesh.getRNG()); // create new random identity + RadioNoiseListener rng(radio); + the_mesh.self_id = mesh::LocalIdentity(&rng); // create new random identity store.save("_main", the_mesh.self_id); }