summaryrefslogtreecommitdiffstats
path: root/app/state.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/state.c')
-rw-r--r--app/state.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/state.c b/app/state.c
index 0c23260..eb033ac 100644
--- a/app/state.c
+++ b/app/state.c
@@ -1,6 +1,6 @@
#include "project.h"
-uint32_t up_time, down_time,usb_up_time,usb_down_time;
+uint32_t up_time, down_time, usb_up_time, usb_down_time;
int locked;
@@ -77,6 +77,11 @@ state_tick (void)
key_wipe ();
}
+ if ((usb_up_time > USB_LOCK_TIME) && !locked)
+ locked = 1;
+ if ((up_time > POWER_LOCK_TIME) && !locked)
+ locked = 1;
+
state_show ();
}
@@ -87,5 +92,8 @@ state_init (void)
{
down_time = 0;
up_time = 0;
+ usb_down_time = 0;
+ usb_up_time = 0;
+ up_time = 0;
locked = 0;
}