Skip to content

Commit cef8586

Browse files
committed
pbio/sys/status: Temporarily maintain Contiki broadcast on status change.
We have already updated the parts that handle status change events, but there are still some processes that await status changes by asynchronously polling. This change ensures we keep doing that until all processes have been converted to the new pattern.
1 parent d271817 commit cef8586

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/pbio/sys/status.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
#include <contiki.h>
1111

12+
#include <pbio/os.h>
13+
1214
#include <pbdrv/clock.h>
1315
#include <pbsys/status.h>
1416

@@ -38,6 +40,14 @@ static void pbsys_status_update_flag(pbio_pybricks_status_t status, bool set) {
3840
// directly. All other processes just poll the status as needed. If we ever
3941
// need more subscribers, we could register callbacks and call them here.
4042
pbsys_hmi_handle_status_change(set ? PBSYS_STATUS_CHANGE_SET : PBSYS_STATUS_CHANGE_CLEARED, status);
43+
44+
// Other processes may be awaiting status changes, so poll.
45+
pbio_os_request_poll();
46+
47+
// REVISIT: Can be deleted once all processes that poll the status are
48+
// updated to use the new pbio os event loop.
49+
process_post(PROCESS_BROADCAST, PROCESS_EVENT_COM, NULL);
50+
4151
}
4252

4353
/**

0 commit comments

Comments
 (0)