Repository navigation
Conversation
clonea1
force-pushed
the
contrib/wifi-no-11b
branch
from
October 10, 2026 05:16
b1c25ba to
04784d6
Compare
…ill the channel
When a node's link degrades, the WiFi driver's rate control can settle on
1-2 Mbps 802.11b and stay there for hours. Every CSI datagram then costs
tens of times the airtime, the shared channel fills up, and every node's
frame rate slides. The TX queue also backs up behind the slow link, which
shows as deep free-heap dips and send_fail bursts that look like a leak.
- main.c: esp_wifi_config_11b_rate(WIFI_IF_STA, true) after esp_wifi_init()
and before esp_wifi_start(), so rate control cannot drop below 6 Mbps
OFDM, whatever rates the AP advertises.
- c6_sync_espnow.c: set the ESP-NOW broadcast peer to 11g 6 Mbps OFDM right
after esp_now_add_peer(). ESP-NOW defaults to 1 Mbps 802.11b, which is not
sendable once 11b is disabled on the STA; OFDM also carries the LTF that
CSI is computed from.
- nvs_config.{c,h}: NVS u8 key "allow_11b" (default 0). Setting it to 1
restores the previous behaviour on the next boot, as a no-reflash
rollback.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clonea1
force-pushed
the
contrib/wifi-no-11b
branch
from
October 10, 2026 21:15
04784d6 to
5fd4be4
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
A node whose WiFi link degrades can fall back to 1-2 Mbps 802.11b and stay there for hours. Each CSI datagram then costs tens of times the airtime, so one or two slow nodes fill the shared 2.4 GHz channel and every node's frame rate slides. The TX queue also backs up behind the slow link, which looks like a memory leak (deep free-heap dips,
send_failbursts) when it is not.This PR stops the node's own rate control from using 802.11b rates, so it cannot go below 6 Mbps OFDM, whatever rates the AP advertises. It may explain part of #978 (WiFi disruption when the full fleet powers on) and #1183 (ENOMEM backoff under a weak uplink).
Changes (4 files, +60)
main.c:esp_wifi_config_11b_rate(WIFI_IF_STA, true)afteresp_wifi_init()and beforeesp_wifi_start(). Non-fatal: if the driver refuses, the node logs it and runs as before.c6_sync_espnow.c: the ESP-NOW broadcast peer is set to 11g 6 Mbps OFDM right afteresp_now_add_peer(). ESP-NOW defaults to 1 Mbps 802.11b, which is not sendable once 11b is off; OFDM also carries the LTF that CSI is computed from.nvs_config.{c,h}: NVS u8 keyallow_11b, default 0. Setting it to 1 restores the previous behaviour on the next boot, a rollback that needs no reflash.This changes default behaviour for every node. That is deliberate (the old default is the failure mode), and
allow_11b=1is the way back for a deployment that needs 802.11b.Evidence (9 x ESP32-C6, IDF v5.4, one AP, channel 11; measured from the AP's per-client stats and AP-side captures)
Overnight since: the first night still had 134 node-minutes at <= 2 Mbps (dips that recovered on their own, see below); the second had none and the channel never went above 56% busy, although no rejoin trigger fired that night. No rollbacks or crash reboots on either.
Caveats, stated plainly:
esp_wifi_set_protocolreturnsESP_ERR_INVALID_ARGon IDF 5.4.0, 5.4.4 and 5.5.5), so this API is the strongest lever firmware has.Tested
Upstream CI's three variants, built in
espressif/idf:v5.4exactly asfirmware-ci.ymldoes, against unmodifiedmainfor comparison:mainThe 8mb variant is already over the 1100 KB soft warning on
main(1163.5 KB); this adds 2.4 KB and stays under the hard limit.Host tests (
test/Makefile host_tests): identical results onmainand on this branch (adr110 21/21, vitals 30/30, mmwave 8/8, thermal, csi_sanitize, c6_antenna, serial_onboarding, delivery_contract 3/3).Every API used (
esp_wifi_config_11b_rate,esp_now_set_peer_rate_config,esp_now_rate_config_t,WIFI_PHY_RATE_6M) checked in the IDF v5.4 headers; none is target-gated.On hardware: the same change has run on all 9 C6 nodes since 2026-09-30. Not run on S3 hardware.
If your fleet's frame rate decays with uptime
Worth checking before blaming firmware:
minrate_ng_advertising_rates: false), and clients keep using them.🤖 Generated with Claude Code