Skip to content

Commit 4af839f

Browse files
committed
pbio/sys/main: Set shutdown status in the right place.
Shutdown begins when the drivers are being deinitialized. This also ensures that the shutdown animation completes when the system (including the HMI) is done.
1 parent e1d0567 commit 4af839f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/pbio/sys/main.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,12 @@ int main(int argc, char **argv) {
139139
// Stop system processes and selected drivers in reverse order. This will
140140
// also save user data to flash,
141141
pbsys_deinit();
142+
pbsys_status_set(PBIO_PYBRICKS_STATUS_SHUTDOWN);
142143

143144
// Now lower-level processes may shutdown and/or power off.
144145
pbio_deinit();
145146
pbdrv_deinit();
146147

147-
// REVISIT: We should use the deinit hooks above to gracefully request exit
148-
// instead of having the drivers rely on system statuses.
149-
pbsys_status_set(PBIO_PYBRICKS_STATUS_SHUTDOWN);
150-
151148
// The power could be held on due to someone pressing the center button
152149
// so we have this loop to keep handling events to drive processes that
153150
// turn off some of the peripherals.

0 commit comments

Comments
 (0)