fix(openthread): restore ot_network_auto_start() call in ot_br example (IDFGH-17984)#18845
Open
cnicc wants to merge 1 commit into
Open
fix(openthread): restore ot_network_auto_start() call in ot_br example (IDFGH-17984)#18845cnicc wants to merge 1 commit into
cnicc wants to merge 1 commit into
Conversation
esp_openthread_border_router_start() only brings up Wi-Fi and the border-routing services; it never enables the Thread interface. The call to ot_network_auto_start(), which reapplies the persisted Active Dataset and enables Thread, was dropped from ot_br's app_main() in 0697295 ("optimized the autostart macro") while CONFIG_OPENTHREAD_BORDER_ROUTER_AUTO_START and CONFIG_OPENTHREAD_NETWORK_AUTO_START were consolidated into a single Kconfig option. As a result, "ot state" stays "disabled" after a cold boot even though a valid dataset is persisted in NVS. ot_cli's app_main still calls ot_network_auto_start() and is unaffected by this regression; this restores the same call in ot_br.
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.
Description
On cold boot,
ot statestays disabled in the ot_br example even whenCONFIG_OPENTHREAD_NETWORK_AUTO_START=yand a valid Active Dataset is already persisted in NVS. Wi-Fi connects and the border-routing services start correctly, but the Thread interface itself is never enabled: the device only attaches after manually re-enteringot dataset ... commit active+ot ifconfig up+ot thread startover serial on every reboot.esp_openthread_border_router_start()only brings up Wi-Fi and the border-routing services, but it never calls otIp6SetEnabled/otThreadSetEnabled.The call that does this,
ot_network_auto_start(), was dropped from ot_br'sapp_main()in 0697295 ("optimized the autostart macro"), whileCONFIG_OPENTHREAD_BORDER_ROUTER_AUTO_STARTandCONFIG_OPENTHREAD_NETWORK_AUTO_STARTwere being consolidated into a single Kconfig option. ot_cli'sapp_main()was not touched by that commit and still callsot_network_auto_start().This PR restores the
ot_network_auto_start()call inot_br'sapp_main(),matching
ot_cli. No Kconfig/sdkconfig changes are needed.Related
No existing issue or PR found for this.
Regression introduced in 0697295.
Testing
Tested on an ESP32-C6, standalone single-chip Thread Border Router,
ot_brexample, ESP-IDF v6.0.2.Before,
ot dataset active -xconfirms the Active Dataset persists correctly, butot stateoutput wasdisabledafter a cold boot.After the fix, the device auto-attaches on boot with no serial commands.
No automated test added: verifying
ot stateafter a cold boot requires hardware-in-the-loop testing, which the existingsdkconfig.ci.br_autostartCI config doesn't cover.Checklist
Before submitting a Pull Request, please ensure the following:
Note
Low Risk
Single guarded call in an example app that restores prior autostart behavior; no Kconfig or core stack API changes.
Overview
Restores
ot_network_auto_start()in theot_brexample’sapp_main()whenCONFIG_OPENTHREAD_NETWORK_AUTO_STARTis enabled, aligning startup withot_cli.Border-router startup (
esp_openthread_border_router_start()) only brings up Wi‑Fi and border-routing services; it does not enable the Thread stack from a persisted Active Dataset. Without this call, cold boot leavesot statedisabled until manual CLI steps, even when auto-start is configured in Kconfig.Reviewed by Cursor Bugbot for commit 381b477. Bugbot is set up for automated code reviews on this repo. Configure here.