Repository navigation
fix: start the protocol server after onboarding over USB - #21
Merged
Merged
Conversation
A device set up with tedge-onboard kept serving zeros: the client connected, but the Modbus, OPC UA, or SNMP server and its simulation never started. With no stored network, main() waits for the network with no timeout, on net_connected_sem. The Wi-Fi settings from tedge-onboard go through app_net_switch_network(), which reset and waited on the same binary semaphore. When the device joined, the one give woke only the switch, and main() kept waiting. The switch now waits on its own semaphore, so both wake up. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem
A device set up with
tedge-onboardconnected to Cumulocity, but its Modbus, OPC UA, or SNMP server and its simulation never started. Every measurement read 0 until the device was restarted. Changes to the pump controls had no effect.Cause
With no stored network,
main()waits for the network with no timeout, onnet_connected_sem. The Wi-Fi settings fromtedge-onboardgo throughapp_net_switch_network(), which reset and waited on the same binary semaphore. When the device joined, the single give woke only the switch, andmain()kept waiting. The client runs on its own thread, so the device still looked healthy in Cumulocity.Introduced in #19 and released in v0.11.0. It affects all four apps, because they share
lib/common/net.c.Fix
app_net_switch_network()now waits on its own semaphore (switch_connected_sem), whichmark_connected()gives together withnet_connected_sem, so both waiters wake.Testing
modbus-server-tedge-full-esp32c6-devkitc0.11.0, set up withtedge-onboard. The app-status log showedmotor_temp_c = 0.00, which only happens if the simulation was never started (it starts at 25 °C). After a restart, the pump followed its controls.modbus-server-tedge-full-esp32c6-devkitcbuilds with the fix: +24 B static RAM, +40 B content, within the size baseline's tolerance.🤖 Generated with Claude Code