mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-16 15:30:38 +00:00
Compare commits
No commits in common. "5d4f58c91d242d4e05c360d2638e387f567c6e00" and "76d5f01e5b1084f1f2c31ed3f8598c5212dea058" have entirely different histories.
5d4f58c91d
...
76d5f01e5b
@ -1 +1 @@
|
||||
Subproject commit c55f120a9c1ce90c85e4826907a0b9bcb2d5f5a2
|
||||
Subproject commit 76f806e1bb1e2a7b157a14fadd095775f63db5e4
|
@ -69,11 +69,7 @@ bool MeshPacketQueue::enqueue(meshtastic_MeshPacket *p)
|
||||
{
|
||||
// no space - try to replace a lower priority packet in the queue
|
||||
if (queue.size() >= maxLen) {
|
||||
bool replaced = replaceLowerPriorityPacket(p);
|
||||
if (!replaced) {
|
||||
LOG_WARN("TX queue is full, and there is no lower-priority packet available to evict in favour of 0x%08x", p->id);
|
||||
}
|
||||
return replaced;
|
||||
return replaceLowerPriorityPacket(p);
|
||||
}
|
||||
|
||||
// Find the correct position using upper_bound to maintain a stable order
|
||||
@ -117,10 +113,7 @@ meshtastic_MeshPacket *MeshPacketQueue::remove(NodeNum from, PacketId id, bool t
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to find a lower-priority packet in the queue and replace it with the provided one.
|
||||
* @return True if the replacement succeeded, false otherwise
|
||||
*/
|
||||
/** Attempt to find and remove a packet from this queue. Returns the packet which was removed from the queue */
|
||||
bool MeshPacketQueue::replaceLowerPriorityPacket(meshtastic_MeshPacket *p)
|
||||
{
|
||||
|
||||
@ -129,12 +122,11 @@ bool MeshPacketQueue::replaceLowerPriorityPacket(meshtastic_MeshPacket *p)
|
||||
}
|
||||
|
||||
// Check if the packet at the back has a lower priority than the new packet
|
||||
auto *backPacket = queue.back();
|
||||
auto &backPacket = queue.back();
|
||||
if (!backPacket->tx_after && backPacket->priority < p->priority) {
|
||||
LOG_WARN("Dropping packet 0x%08x to make room in the TX queue for higher-priority packet 0x%08x", backPacket->id, p->id);
|
||||
// Remove the back packet
|
||||
queue.pop_back();
|
||||
packetPool.release(backPacket);
|
||||
queue.pop_back();
|
||||
// Insert the new packet in the correct order
|
||||
enqueue(p);
|
||||
return true;
|
||||
@ -147,12 +139,8 @@ bool MeshPacketQueue::replaceLowerPriorityPacket(meshtastic_MeshPacket *p)
|
||||
for (; refPacket->tx_after && it != queue.begin(); refPacket = *--it)
|
||||
;
|
||||
if (!refPacket->tx_after && refPacket->priority < p->priority) {
|
||||
LOG_WARN("Dropping non-late packet 0x%08x to make room in the TX queue for higher-priority packet 0x%08x",
|
||||
refPacket->id, p->id);
|
||||
queue.erase(it);
|
||||
packetPool.release(refPacket);
|
||||
// Insert the new packet in the correct order
|
||||
enqueue(p);
|
||||
enqueue(refPacket);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +271,6 @@ void RadioLibInterface::onNotify(uint32_t notification)
|
||||
uint32_t xmitMsec = getPacketTime(txp);
|
||||
airTime->logAirtime(TX_LOG, xmitMsec);
|
||||
}
|
||||
LOG_DEBUG("%d packets remain in the TX queue", txQueue.getMaxLen() - txQueue.getFree());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -298,8 +297,8 @@ void RadioLibInterface::setTransmitDelay()
|
||||
if (p->tx_after) {
|
||||
unsigned long add_delay = p->rx_rssi ? getTxDelayMsecWeighted(p->rx_snr) : getTxDelayMsec();
|
||||
unsigned long now = millis();
|
||||
p->tx_after = min(max(p->tx_after + add_delay, now + add_delay), now + 2 * getTxDelayMsecWeightedWorst(p->rx_snr));
|
||||
notifyLater(p->tx_after - now, TRANSMIT_DELAY_COMPLETED, false);
|
||||
p->tx_after = max(p->tx_after + add_delay, now + add_delay);
|
||||
notifyLater(now - p->tx_after, TRANSMIT_DELAY_COMPLETED, false);
|
||||
} else if (p->rx_snr == 0 && p->rx_rssi == 0) {
|
||||
/* We assume if rx_snr = 0 and rx_rssi = 0, the packet was generated locally.
|
||||
* This assumption is valid because of the offset generated by the radio to account for the noise
|
||||
|
@ -44,7 +44,11 @@ class BluetoothPhoneAPI : public PhoneAPI
|
||||
}
|
||||
|
||||
/// Check the current underlying physical link to see if the client is currently connected
|
||||
virtual bool checkIsConnected() override { return Bluefruit.connected(connectionHandle); }
|
||||
virtual bool checkIsConnected() override
|
||||
{
|
||||
BLEConnection *connection = Bluefruit.Connection(connectionHandle);
|
||||
return connection->connected();
|
||||
}
|
||||
};
|
||||
|
||||
static BluetoothPhoneAPI *bluetoothPhoneAPI;
|
||||
|
Loading…
Reference in New Issue
Block a user