Merge pull request #3166 from recrof/debug-noise-floor-flag

move RadioLibWrapper noise_floor level message under special debug flag
This commit is contained in:
Liam Cottle
2026-08-11 03:07:31 +12:00
committed by GitHub
+6 -4
View File
@@ -15,7 +15,7 @@ static volatile uint8_t state = STATE_IDLE;
// this function is called when a complete packet
// is transmitted by the module
static
static
#if defined(ESP8266) || defined(ESP32)
ICACHE_RAM_ATTR
#endif
@@ -100,7 +100,9 @@ void RadioLibWrapper::loop() {
}
_floor_sample_sum = 0;
#ifdef MESH_DEBUG_NOISE_FLOOR
MESH_DEBUG_PRINTLN("RadioLibWrapper: noise_floor = %d", (int)_noise_floor);
#endif
}
}
@@ -224,10 +226,10 @@ static float snr_threshold[] = {
-17.5,// SF11 needs at least -17.5 dB SNR
-20 // SF12 needs at least -20 dB SNR
};
float RadioLibWrapper::packetScoreInt(float snr, int sf, int packet_len) {
if (sf < 7) return 0.0f;
if (snr < snr_threshold[sf - 7]) return 0.0f; // Below threshold, no chance of success
auto success_rate_based_on_snr = (snr - snr_threshold[sf - 7]) / 10.0;
@@ -243,7 +245,7 @@ PacketMillis RadioLibWrapper::calcMaxPacketMillis(uint8_t sf, float bw, uint8_t
// preamble + syncword + sfd + header
uint32_t preamble_us = (((preambleSymbols + 8) * 4 + sfCoeff1_x4) * tsym_us) / 4;
// airtime for max packet at current radio settings
uint32_t total_us = _radio->getTimeOnAir(MAX_TRANS_UNIT);
// airtime for payload only (no preamble, header or SOF)