mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2024-12-26 07:59:40 -05:00
Adjusted CSMA parameters and P-curve. Added dynamic CSMA slot time.
This commit is contained in:
parent
8639765679
commit
2ede362cb3
8
Config.h
8
Config.h
@ -20,7 +20,7 @@
|
||||
#define CONFIG_H
|
||||
|
||||
#define MAJ_VERS 0x01
|
||||
#define MIN_VERS 0x4d
|
||||
#define MIN_VERS 0x4e
|
||||
|
||||
#define MODE_HOST 0x11
|
||||
#define MODE_TNC 0x12
|
||||
@ -74,9 +74,11 @@
|
||||
#define LORA_PREAMBLE_SYMBOLS_MIN 18
|
||||
#define LORA_PREAMBLE_TARGET_MS 15
|
||||
#define LORA_CAD_SYMBOLS 3
|
||||
#define CSMA_SLOT_MAX_MS 100
|
||||
#define CSMA_SLOT_MIN_MS 24
|
||||
int csma_slot_ms = 50;
|
||||
float csma_p_min = 0.08;
|
||||
float csma_p_max = 0.75;
|
||||
float csma_p_min = 0.15;
|
||||
float csma_p_max = 0.333;
|
||||
float csma_b_speed = 0.15;
|
||||
uint8_t csma_p = 85;
|
||||
|
||||
|
@ -1298,10 +1298,10 @@ void validate_status() {
|
||||
|
||||
#if MCU_VARIANT == MCU_ESP32 || MCU_VARIANT == MCU_NRF52
|
||||
#define _e 2.71828183
|
||||
#define _S 10.0
|
||||
#define _S 12.5
|
||||
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);
|
||||
csma_p = (uint8_t)((1.0-(csma_p_min+(csma_p_max-csma_p_min)*csma_slope(airtime+csma_b_speed)))*255.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1047,7 +1047,9 @@ void updateBitrate() {
|
||||
lora_symbol_time_ms = (1.0/lora_symbol_rate)*1000.0;
|
||||
lora_bitrate = (uint32_t)(lora_sf * ( (4.0/(float)lora_cr) / ((float)(pow(2, lora_sf))/((float)lora_bw/1000.0)) ) * 1000.0);
|
||||
lora_us_per_byte = 1000000.0/((float)lora_bitrate/8.0);
|
||||
// csma_slot_ms = lora_symbol_time_ms*10;
|
||||
csma_slot_ms = lora_symbol_time_ms*12;
|
||||
if (csma_slot_ms > CSMA_SLOT_MAX_MS) { csma_slot_ms = CSMA_SLOT_MAX_MS; }
|
||||
if (csma_slot_ms < CSMA_SLOT_MIN_MS) { csma_slot_ms = CSMA_SLOT_MIN_MS; }
|
||||
float target_preamble_symbols = (LORA_PREAMBLE_TARGET_MS/lora_symbol_time_ms)-LORA_PREAMBLE_SYMBOLS_HW;
|
||||
if (target_preamble_symbols < LORA_PREAMBLE_SYMBOLS_MIN) {
|
||||
target_preamble_symbols = LORA_PREAMBLE_SYMBOLS_MIN;
|
||||
|
Loading…
Reference in New Issue
Block a user