-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
samples: dfu: report FW state and reboot from main thread
So far there were 3 threads involved: * Zephyr main * initialize network * start Golioth system client * Golioth system_client * handle incoming Golioth communication * report FW states * Zephyr sysworkq * trigger reboot This is overly complicated and makes callbacks implementation hard to read due to FW state reporting logic taking most of callback body. Change implementation to utilize only 2 threads instead, with following changes: * Zephyr main * initialize network (as before) * start Golioth system client (as before) * report FW reporting (new) * trigger reboot (new) * Golioth system_client * handle incoming Golioth communication There is little data shared among those threads and most important thing is to notify about state of FW download. For that reason use semaphores, which make main() execution continue step by step, making overall logic easy to follow. This change solves one of the issues with pytest scripts expecting a specific sequence of FW states. So far this sequence was not followed from time to time, due to UDP packets reordering. This issue is now partly solved by reporting FW states from Zephyr main thread and remaining fix will be a conversion from asynchronous to synchronous golioth_fw_report_state() API. Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
- Loading branch information
Showing
1 changed file
with
66 additions
and
55 deletions.
There are no files selected for viewing
This file contains 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