mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-24 17:32:18 +00:00
Re-compute correct timeslot on applyModemConfig (#4469)
* Re-compute correct timeslot on applyModemConfig * Cap contention window max at 7
This commit is contained in:
parent
ef56fae976
commit
6f1dae1b1b
@ -520,6 +520,7 @@ void RadioInterface::applyModemConfig()
|
|||||||
saveChannelNum(channel_num);
|
saveChannelNum(channel_num);
|
||||||
saveFreq(freq + loraConfig.frequency_offset);
|
saveFreq(freq + loraConfig.frequency_offset);
|
||||||
|
|
||||||
|
slotTimeMsec = computeSlotTimeMsec(bw, sf);
|
||||||
preambleTimeMsec = getPacketTime((uint32_t)0);
|
preambleTimeMsec = getPacketTime((uint32_t)0);
|
||||||
maxPacketTimeMsec = getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN + sizeof(PacketHeader));
|
maxPacketTimeMsec = getPacketTime(meshtastic_Constants_DATA_PAYLOAD_LEN + sizeof(PacketHeader));
|
||||||
|
|
||||||
|
@ -71,18 +71,20 @@ class RadioInterface
|
|||||||
- roundtrip air propagation time (assuming max. 30km between nodes);
|
- roundtrip air propagation time (assuming max. 30km between nodes);
|
||||||
- Tx/Rx turnaround time (maximum of SX126x and SX127x);
|
- Tx/Rx turnaround time (maximum of SX126x and SX127x);
|
||||||
- MAC processing time (measured on T-beam) */
|
- MAC processing time (measured on T-beam) */
|
||||||
uint32_t slotTimeMsec = 8.5 * pow(2, sf) / bw + 0.2 + 0.4 + 7;
|
uint32_t slotTimeMsec = computeSlotTimeMsec(bw, sf);
|
||||||
uint16_t preambleLength = 16; // 8 is default, but we use longer to increase the amount of sleep time when receiving
|
uint16_t preambleLength = 16; // 8 is default, but we use longer to increase the amount of sleep time when receiving
|
||||||
uint32_t preambleTimeMsec = 165; // calculated on startup, this is the default for LongFast
|
uint32_t preambleTimeMsec = 165; // calculated on startup, this is the default for LongFast
|
||||||
uint32_t maxPacketTimeMsec = 3246; // calculated on startup, this is the default for LongFast
|
uint32_t maxPacketTimeMsec = 3246; // calculated on startup, this is the default for LongFast
|
||||||
const uint32_t PROCESSING_TIME_MSEC =
|
const uint32_t PROCESSING_TIME_MSEC =
|
||||||
4500; // time to construct, process and construct a packet again (empirically determined)
|
4500; // time to construct, process and construct a packet again (empirically determined)
|
||||||
const uint8_t CWmin = 2; // minimum CWsize
|
const uint8_t CWmin = 2; // minimum CWsize
|
||||||
const uint8_t CWmax = 8; // maximum CWsize
|
const uint8_t CWmax = 7; // maximum CWsize
|
||||||
|
|
||||||
meshtastic_MeshPacket *sendingPacket = NULL; // The packet we are currently sending
|
meshtastic_MeshPacket *sendingPacket = NULL; // The packet we are currently sending
|
||||||
uint32_t lastTxStart = 0L;
|
uint32_t lastTxStart = 0L;
|
||||||
|
|
||||||
|
uint32_t computeSlotTimeMsec(float bw, float sf) { return 8.5 * pow(2, sf) / bw + 0.2 + 0.4 + 7; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A temporary buffer used for sending/receiving packets, sized to hold the biggest buffer we might need
|
* A temporary buffer used for sending/receiving packets, sized to hold the biggest buffer we might need
|
||||||
* */
|
* */
|
||||||
|
Loading…
Reference in New Issue
Block a user