mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-27 21:26:37 +00:00
move RadioLibWrapper noise_floor level message under special debug flag
This commit is contained in:
@@ -15,7 +15,7 @@ static volatile uint8_t state = STATE_IDLE;
|
|||||||
|
|
||||||
// this function is called when a complete packet
|
// this function is called when a complete packet
|
||||||
// is transmitted by the module
|
// is transmitted by the module
|
||||||
static
|
static
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
#if defined(ESP8266) || defined(ESP32)
|
||||||
ICACHE_RAM_ATTR
|
ICACHE_RAM_ATTR
|
||||||
#endif
|
#endif
|
||||||
@@ -100,7 +100,9 @@ void RadioLibWrapper::loop() {
|
|||||||
}
|
}
|
||||||
_floor_sample_sum = 0;
|
_floor_sample_sum = 0;
|
||||||
|
|
||||||
|
#ifdef MESH_DEBUG_NOISE_FLOOR
|
||||||
MESH_DEBUG_PRINTLN("RadioLibWrapper: noise_floor = %d", (int)_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
|
-17.5,// SF11 needs at least -17.5 dB SNR
|
||||||
-20 // SF12 needs at least -20 dB SNR
|
-20 // SF12 needs at least -20 dB SNR
|
||||||
};
|
};
|
||||||
|
|
||||||
float RadioLibWrapper::packetScoreInt(float snr, int sf, int packet_len) {
|
float RadioLibWrapper::packetScoreInt(float snr, int sf, int packet_len) {
|
||||||
if (sf < 7) return 0.0f;
|
if (sf < 7) return 0.0f;
|
||||||
|
|
||||||
if (snr < snr_threshold[sf - 7]) return 0.0f; // Below threshold, no chance of success
|
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;
|
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
|
// preamble + syncword + sfd + header
|
||||||
uint32_t preamble_us = (((preambleSymbols + 8) * 4 + sfCoeff1_x4) * tsym_us) / 4;
|
uint32_t preamble_us = (((preambleSymbols + 8) * 4 + sfCoeff1_x4) * tsym_us) / 4;
|
||||||
|
|
||||||
// airtime for max packet at current radio settings
|
// airtime for max packet at current radio settings
|
||||||
uint32_t total_us = _radio->getTimeOnAir(MAX_TRANS_UNIT);
|
uint32_t total_us = _radio->getTimeOnAir(MAX_TRANS_UNIT);
|
||||||
// airtime for payload only (no preamble, header or SOF)
|
// airtime for payload only (no preamble, header or SOF)
|
||||||
|
|||||||
Reference in New Issue
Block a user