* new ESPNOWRadio driver

* refactored the examples/*/main.cpp modules, moving radio specifics to variants/*/target modules
* new Generic_ESPNOW_* target envs
This commit is contained in:
Scott Powell
2025-03-27 19:34:16 +11:00
parent 9c165add61
commit 2224bddcb5
39 changed files with 568 additions and 249 deletions

View File

@@ -7,12 +7,6 @@
#include <SPIFFS.h>
#endif
#ifdef WRAPPER_CLASS
#define RADIOLIB_STATIC_ONLY 1
#include <RadioLib.h>
#include <helpers/RadioLibWrappers.h>
#endif
#include <helpers/ArduinoHelpers.h>
#include <helpers/StaticPoolPacketManager.h>
#include <helpers/SimpleMeshTables.h>
@@ -269,12 +263,7 @@ protected:
}
public:
#ifdef WRAPPER_CLASS
MyMesh(RadioLibWrapper& radio, StdRNG& rng, mesh::RTCClock& rtc, SimpleMeshTables& tables)
#else
MyMesh(mesh::Radio& radio, StdRNG& rng, mesh::RTCClock& rtc, SimpleMeshTables& tables)
#endif
: BaseChatMesh(radio, *new ArduinoMillis(), rng, rtc, *new StaticPoolPacketManager(16), tables)
{
// defaults
@@ -534,12 +523,7 @@ public:
StdRNG fast_rng;
SimpleMeshTables tables;
#ifdef WRAPPER_CLASS
MyMesh the_mesh(*new WRAPPER_CLASS(radio, board), fast_rng, *new VolatileRTCClock(), tables);
#else
MyMesh the_mesh(radio, fast_rng, *new VolatileRTCClock(), tables);
#endif
MyMesh the_mesh(radio_driver, fast_rng, *new VolatileRTCClock(), tables);
void halt() {
while (1) ;
@@ -552,11 +536,7 @@ void setup() {
if (!radio_init()) { halt(); }
#ifdef WRAPPER_CLASS
fast_rng.begin(radio.random(0x7FFFFFFF));
#else
fast_rng.begin(millis());
#endif
fast_rng.begin(radio_get_rng_seed());
#if defined(NRF52_PLATFORM)
InternalFS.begin();
@@ -568,14 +548,8 @@ void setup() {
#error "need to define filesystem"
#endif
#ifdef WRAPPER_CLASS
if (LORA_FREQ != the_mesh.getFreqPref()) {
radio.setFrequency(the_mesh.getFreqPref());
}
if (LORA_TX_POWER != the_mesh.getTxPowerPref()) {
radio.setOutputPower(the_mesh.getTxPowerPref());
}
#endif
radio_set_params(the_mesh.getFreqPref(), LORA_BW, LORA_SF, LORA_CR);
radio_set_tx_power(the_mesh.getTxPowerPref());
the_mesh.showWelcome();