Skip to content

Peek & pop separately when pushing messages to BLE client#1902

Open
weebl2000 wants to merge 1 commit intomeshcore-dev:devfrom
weebl2000:no-fire-and-forget-ble-message-popping
Open

Peek & pop separately when pushing messages to BLE client#1902
weebl2000 wants to merge 1 commit intomeshcore-dev:devfrom
weebl2000:no-fire-and-forget-ble-message-popping

Conversation

@weebl2000
Copy link
Contributor

@weebl2000 weebl2000 commented Mar 2, 2026

I've noticed very often that the first few messages can get lost after reconnecting with BLE. This should fix that.

Try for yourself by building here

if ((out_len = getFromOfflineQueue(out_frame)) > 0) {
_serial->writeFrame(out_frame, out_len);
if ((out_len = peekOfflineQueue(out_frame)) > 0) {
if (_serial->writeFrame(out_frame, out_len) > 0) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should a partial write (writeFrame(...) > 0 and less than out_len) be considered success, eg enough to pop the frame from the queue?

I've noticed very often that the first few messages can get lost after
reconnecting with BLE. This should fix that.
@weebl2000 weebl2000 force-pushed the no-fire-and-forget-ble-message-popping branch from c520542 to 782118d Compare March 3, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants