Skip to content

Fix the bug where no information can be received the first time after…#1753

Closed
MGJ520 wants to merge 3 commits intomeshcore-dev:devfrom
MGJ520:dev
Closed

Fix the bug where no information can be received the first time after…#1753
MGJ520 wants to merge 3 commits intomeshcore-dev:devfrom
MGJ520:dev

Conversation

@MGJ520
Copy link
Copy Markdown
Contributor

@MGJ520 MGJ520 commented Feb 20, 2026

Fix issue where no messages can be received after reconfiguring the radio, specifically on the first receive attempt.

For example: 1. First, after the two devices successfully communicate through direct connection, they simultaneously modify the radio configuration.

  1. After modification, only one side is allowed to send information, while the other side will be unable to receive it.


radio_set_params(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
//You need to clear the old registers, otherwise the LoRa module won't receive any information the first time.
_radio->onSendFinished();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Calling _radio->onSendFinished() unconditionally from app-layer reconfiguration code is unsafe when a TX is still in progress. In the dispatcher flow, send completion drives packet accounting/release (src/Dispatcher.cpp:62-79). For radios like ESP-NOW, onSendFinished() just flips completion state (src/helpers/esp32/ESPNOWRadio.cpp:90-92), so this can mark an unsent/unfinished packet as sent and release it prematurely on the next dispatcher cycle.
Why this matters:
This is a correctness issue (possible packet loss with false success accounting) and can be timing-dependent, making field failures hard to reproduce.
Suggested direction:
Use a dedicated “re-enter RX after reconfigure” API that does not mutate TX-completion state, or gate reconfiguration on “no outbound TX in progress” before forcing RX restart.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok,I understand, thank you for reviewing.

@MGJ520 MGJ520 closed this by deleting the head repository Mar 9, 2026
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