* added Radio::loop() virtual function

* RadioLibWrapper:  new isChannelActive() based on current RSSI being above noise_floor + THRESHOLD
This commit is contained in:
Scott Powell
2025-05-24 21:24:44 +10:00
parent 2f8d9cf96a
commit f2243b78ae
10 changed files with 60 additions and 9 deletions

View File

@@ -8,11 +8,15 @@ protected:
PhysicalLayer* _radio;
mesh::MainBoard* _board;
uint32_t n_recv, n_sent;
int16_t _noise_floor;
uint16_t _num_floor_samples;
int32_t _floor_sample_sum;
void idle();
void startRecv();
float packetScoreInt(float snr, int sf, int packet_len);
virtual bool isReceivingPacket() =0;
virtual float getCurrentRSSI() =0;
public:
RadioLibWrapper(PhysicalLayer& radio, mesh::MainBoard& board) : _radio(&radio), _board(&board) { n_recv = n_sent = 0; }
@@ -32,6 +36,8 @@ public:
return isChannelActive();
}
void loop() override;
uint32_t getPacketsRecv() const { return n_recv; }
uint32_t getPacketsSent() const { return n_sent; }
void resetStats() { n_recv = n_sent = 0; }