Skip to content

fix: start the protocol server after onboarding over USB - #21

Merged
reubenmiller merged 1 commit into
mainfrom
fix/onboarding-start-services
Nov 10, 2026
Merged

reubenmiller merged 1 commit into
mainfrom
fix/onboarding-start-services

Conversation

@reubenmiller

Copy link
Copy Markdown
Contributor

Problem

A device set up with tedge-onboard connected 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, 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 single give woke only the switch, and main() 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), which mark_connected() gives together with net_connected_sem, so both waiters wake.

Testing

  • Found on an ESP32-C6 running modbus-server-tedge-full-esp32c6-devkitc 0.11.0, set up with tedge-onboard. The app-status log showed motor_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-devkitc builds with the fix: +24 B static RAM, +40 B content, within the size baseline's tolerance.
  • Not yet tested on hardware from a fresh onboarding.

🤖 Generated with Claude Code

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]>
@reubenmiller
reubenmiller merged commit 6f9d3a9 into main Nov 10, 2026
20 checks passed
@reubenmiller
reubenmiller deleted the fix/onboarding-start-services branch November 10, 2026 14:18
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.

1 participant