Skip to content

Fix a bug where the espnow peer list gets out of sync with the maintained PeerListClass. - #20

Merged
gmag11 merged 1 commit into
gmag11:mainfrom
blakethepatton:main
Sep 24, 2025
Merged

gmag11 merged 1 commit into
gmag11:mainfrom
blakethepatton:main

Conversation

@blakethepatton

@blakethepatton blakethepatton commented May 13, 2025 •

Copy link
Copy Markdown
Contributor

Fixes an issue with stopping and starting quickespnow.

I suspect it's mentioned here: #19 (comment)

Personally, I'm experiencing an issue where when you stop espnow in order to enter light sleep and then resume espnow after waking back up, when you attempt to send a message to a peer that you've talked to before, an exception is thrown and the system reboots.

I think it'd be more beneficial to remove all peers with a call to quickespnow stop, however with message encryption perhaps that would throw a wrench into things.

@blakethepatton

Copy link
Copy Markdown
Contributor Author

Pinging @gmag11 @blazoncek

Any word on this? Do you want something changed about it?

@blazoncek

Copy link
Copy Markdown
Contributor

I don't use peer list. I only use broadcasts.

@gmag11 gmag11 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you @blakethepatton. It makes sense.

@gmag11
gmag11 merged commit f28cdee into gmag11:main Sep 24, 2025
oe1wkl added a commit to oe1wkl/Morserino-32 that referenced this pull request May 22, 2026
The released QuickEspNow 0.8.1 has two problems that bite when ESP-NOW is
brought up and down repeatedly (as the M32 does when alternating between
WiFi Trx and ESP-NOW games):

  - addPeer() calls ESP_ERROR_CHECK(esp_now_get_peer(...)) on a peer that
    its own peer_list still tracks but esp_now_deinit() already removed,
    so the second ESP-NOW session abort()s. This is why entering a game
    after a WiFi session currently forces a memory-clearing reboot.
  - stop() never frees the tx/rx queues it created, leaking a few KB per
    cycle.

The crash is already fixed on upstream main (PR gmag11/QuickESPNow#20,
addPeer self-heals a stale peer) but unreleased. The leak fix is our
PR gmag11/QuickESPNow#25. Pin lib_deps to our fork at the commit that
carries both until upstream publishes a release containing them.

No source/behaviour change here — the rebootIfWifiAlreadyUsed() guards
stay in place for now; removing them is a separate, hardware-validated
follow-up. Builds clean on pocketwroom and heltec_wifi_lora_32_V2.

Co-authored-by: Claude Opus 4.7 <[email protected]>
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.

3 participants