Skip to content

Commit 64fdcbd

Browse files
committed
pbio/sys/main: Delay poweroff until button released properly.
1 parent 0f065bb commit 64fdcbd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/pbio/sys/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ int main(int argc, char **argv) {
166166
pbdrv_reset(PBDRV_RESET_ACTION_RESET);
167167
}
168168
}
169+
#else
170+
// Delay poweroff until we are definitively sure that the button has been
171+
// released. This prevent the hub from unintentionally powering back on.
172+
pbio_os_timer_t timer;
173+
pbio_os_timer_set(&timer, 100);
174+
while (!pbio_os_timer_is_expired(&timer)) {
175+
pbio_os_run_processes_and_wait_for_event();
176+
}
169177
#endif
170178

171179
// Platform-specific power off.

0 commit comments

Comments
 (0)