File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -434,16 +434,23 @@ int sys_user_shutdown(void)
434434 }
435435 if (use_shutdown )
436436 {
437+ start_time = k_uptime_get ();
437438 LOG_INF ("User shutdown requested" );
438439 set_led (SYS_LED_PATTERN_ONESHOT_POWEROFF , SYS_LED_PRIORITY_HIGHEST );
439- k_msleep (1500 );
440- reboot_counter_write (0 );
440+ reboot_counter_write (0 ); // shutdown flag
441+ while (!button_read ()) // waiting for pattern, if button is pressed again reboot immedately
442+ {
443+ if (k_uptime_get () - start_time > 1500 ) // length of pattern elapsed
444+ {
445+ set_led (SYS_LED_PATTERN_OFF_FORCE , SYS_LED_PRIORITY_HIGHEST );
446+ sys_request_system_off (false);
447+ return 0 ;
448+ }
449+ k_msleep (1 );
450+ }
441451 }
442452 set_led (SYS_LED_PATTERN_OFF_FORCE , SYS_LED_PRIORITY_HIGHEST );
443- if (use_shutdown )
444- sys_request_system_off (false);
445- else
446- sys_request_system_reboot (false);
453+ sys_request_system_reboot (false);
447454 return 0 ;
448455}
449456
You can’t perform that action at this time.
0 commit comments