mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2025-05-08 01:25:09 -04:00
Adjusted preamble and airtime calculations
This commit is contained in:
parent
eb7b5c6c26
commit
9fd379486d
3 changed files with 27 additions and 13 deletions
12
Utilities.h
12
Utilities.h
|
@ -908,11 +908,10 @@ inline uint8_t packetSequence(uint8_t header) {
|
|||
void updateBitrate() {
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
if (radio_online) {
|
||||
// self.bitrate = self.r_sf * ( (4.0/self.r_cr) / (math.pow(2,self.r_sf)/(self.r_bandwidth/1000)) ) * 1000
|
||||
// self.bitrate_kbps = round(self.bitrate/1000.0, 2)
|
||||
lora_symbol_rate = (float)lora_bw/(float)(pow(2, lora_sf));
|
||||
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);
|
||||
us_per_byte = 1000000.0/((float)lora_bitrate/8.0);
|
||||
|
||||
lora_us_per_byte = 1000000.0/((float)lora_bitrate/8.0);
|
||||
} else {
|
||||
lora_bitrate = 0;
|
||||
}
|
||||
|
@ -929,6 +928,11 @@ void setCodingRate() {
|
|||
updateBitrate();
|
||||
}
|
||||
|
||||
void setPreamble() {
|
||||
if (radio_online) LoRa.setPreambleLength(lora_preamble_symbols);
|
||||
updateBitrate();
|
||||
}
|
||||
|
||||
void set_implicit_length(uint8_t len) {
|
||||
implicit_l = len;
|
||||
if (implicit_l != 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue