diff options
-rw-r--r-- | apps/screens.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/apps/screens.c b/apps/screens.c index d9cfc11d00..b27dae1916 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -981,34 +981,31 @@ bool shutdown_screen(void) | |||
981 | { | 981 | { |
982 | int button; | 982 | int button; |
983 | bool done = false; | 983 | bool done = false; |
984 | long time_entered = current_tick; | ||
984 | 985 | ||
985 | lcd_stop_scroll(); | 986 | lcd_stop_scroll(); |
986 | 987 | ||
987 | gui_syncsplash(0, true, str(LANG_CONFIRM_SHUTDOWN)); | 988 | gui_syncsplash(0, true, str(LANG_CONFIRM_SHUTDOWN)); |
988 | 989 | ||
989 | while(!done) | 990 | while(!done && TIME_BEFORE(current_tick,time_entered+HZ*2)) |
990 | { | 991 | { |
991 | button = get_action(CONTEXT_STD,HZ*2); | 992 | button = get_action(CONTEXT_STD,HZ); |
992 | switch(button) | 993 | switch(button) |
993 | { | 994 | { |
994 | case ACTION_STD_CANCEL: | 995 | case ACTION_STD_CANCEL: |
995 | sys_poweroff(); | 996 | sys_poweroff(); |
996 | break; | 997 | break; |
997 | 998 | ||
999 | /* do nothing here, because ACTION_UNKNOWN might be caused | ||
1000 | * by timeout or button release. In case of timeout the loop | ||
1001 | * is terminated by TIME_BEFORE */ | ||
1002 | case ACTION_UNKNOWN: | ||
1003 | break; | ||
1004 | |||
998 | default: | 1005 | default: |
999 | if(default_event_handler(button) == SYS_USB_CONNECTED) | 1006 | if(default_event_handler(button) == SYS_USB_CONNECTED) |
1000 | return true; | 1007 | return true; |
1001 | 1008 | done = true; | |
1002 | /* Return if any other button was pushed, or if there | ||
1003 | was a timeout. We ignore RELEASE events, since we may | ||
1004 | have been called by a button down event, and the user might | ||
1005 | not have released the button yet. | ||
1006 | We also ignore REPEAT events, since we don't want to | ||
1007 | remove the splash when the user holds OFF to shut down. */ | ||
1008 | /* Is this still needed? commenting out so it compiles.. | ||
1009 | CHECK ME!! | ||
1010 | if(!(button & (BUTTON_REL | BUTTON_REPEAT))) | ||
1011 | */ done = true; | ||
1012 | break; | 1009 | break; |
1013 | } | 1010 | } |
1014 | } | 1011 | } |