This commit is contained in:
Mark Qvist 2023-09-15 09:10:46 +02:00
parent b61bead60a
commit 5ad3c07f4b
2 changed files with 10 additions and 6 deletions

View File

@ -443,7 +443,9 @@ void update_airtime() {
}
longterm_channel_util = (float)longterm_channel_util_sum/(float)AIRTIME_BINS;
update_csma_p();
#if MCU_VARIANT == MCU_ESP32
update_csma_p();
#endif
kiss_indicate_channel_stats();
#endif
}
@ -1097,12 +1099,14 @@ void validate_status() {
}
}
#define _e 2.71828183
#define _S 10.0
float csma_slope(float u) { return (pow(_e,_S*u-_S/2.0))/(pow(_e,_S*u-_S/2.0)+1.0); }
void update_csma_p() {
csma_p = (uint8_t)((1.0-(csma_p_min+(csma_p_max-csma_p_min)*csma_slope(airtime)))*255.0);
#if MCU_VARIANT == MCU_ESP32
#define _e 2.71828183
#define _S 10.0
float csma_slope(float u) { return (pow(_e,_S*u-_S/2.0))/(pow(_e,_S*u-_S/2.0)+1.0); }
void update_csma_p() {
csma_p = (uint8_t)((1.0-(csma_p_min+(csma_p_max-csma_p_min)*csma_slope(airtime)))*255.0);
}
#endif
void loop() {
if (radio_online) {

Binary file not shown.