mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-23 17:13:38 +00:00
Move some actions to after startTransmit()
(#5383)
To minimize the time between channel scan and actual transmit
This commit is contained in:
parent
1a06f88dfb
commit
0d1f9e915f
@ -601,8 +601,6 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p)
|
|||||||
// LOG_DEBUG("Send queued packet on mesh (txGood=%d,rxGood=%d,rxBad=%d)", rf95.txGood(), rf95.rxGood(), rf95.rxBad());
|
// LOG_DEBUG("Send queued packet on mesh (txGood=%d,rxGood=%d,rxBad=%d)", rf95.txGood(), rf95.rxGood(), rf95.rxBad());
|
||||||
assert(p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag); // It should have already been encoded by now
|
assert(p->which_payload_variant == meshtastic_MeshPacket_encrypted_tag); // It should have already been encoded by now
|
||||||
|
|
||||||
lastTxStart = millis();
|
|
||||||
|
|
||||||
radioBuffer.header.from = p->from;
|
radioBuffer.header.from = p->from;
|
||||||
radioBuffer.header.to = p->to;
|
radioBuffer.header.to = p->to;
|
||||||
radioBuffer.header.id = p->id;
|
radioBuffer.header.id = p->id;
|
||||||
|
@ -278,7 +278,8 @@ void RadioLibInterface::onNotify(uint32_t notification)
|
|||||||
startReceive(); // try receiving this packet, afterwards we'll be trying to transmit again
|
startReceive(); // try receiving this packet, afterwards we'll be trying to transmit again
|
||||||
setTransmitDelay();
|
setTransmitDelay();
|
||||||
} else {
|
} else {
|
||||||
// Send any outgoing packets we have ready
|
// Send any outgoing packets we have ready as fast as possible to keep the time between channel scan and
|
||||||
|
// actual transmission as short as possible
|
||||||
meshtastic_MeshPacket *txp = txQueue.dequeue();
|
meshtastic_MeshPacket *txp = txQueue.dequeue();
|
||||||
assert(txp);
|
assert(txp);
|
||||||
bool sent = startSend(txp);
|
bool sent = startSend(txp);
|
||||||
@ -470,7 +471,8 @@ void RadioLibInterface::setStandby()
|
|||||||
/** start an immediate transmit */
|
/** start an immediate transmit */
|
||||||
bool RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
|
bool RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
|
||||||
{
|
{
|
||||||
printPacket("Start low level send", txp);
|
/* NOTE: Minimize the actions before startTransmit() to keep the time between
|
||||||
|
channel scan and actual transmit as low as possible to avoid collisions. */
|
||||||
if (disabled || !config.lora.tx_enabled) {
|
if (disabled || !config.lora.tx_enabled) {
|
||||||
LOG_WARN("Drop Tx packet because LoRa Tx disabled");
|
LOG_WARN("Drop Tx packet because LoRa Tx disabled");
|
||||||
packetPool.release(txp);
|
packetPool.release(txp);
|
||||||
@ -489,6 +491,9 @@ bool RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
|
|||||||
completeSending();
|
completeSending();
|
||||||
powerMon->clearState(meshtastic_PowerMon_State_Lora_TXOn); // Transmitter off now
|
powerMon->clearState(meshtastic_PowerMon_State_Lora_TXOn); // Transmitter off now
|
||||||
startReceive(); // Restart receive mode (because startTransmit failed to put us in xmit mode)
|
startReceive(); // Restart receive mode (because startTransmit failed to put us in xmit mode)
|
||||||
|
} else {
|
||||||
|
lastTxStart = millis();
|
||||||
|
printPacket("Started Tx", txp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must be done AFTER, starting transmit, because startTransmit clears (possibly stale) interrupt pending register
|
// Must be done AFTER, starting transmit, because startTransmit clears (possibly stale) interrupt pending register
|
||||||
|
Loading…
Reference in New Issue
Block a user