@@ -14,7 +14,8 @@ static void timer_callback(void* context) {
14
14
uint32_t current_time = furi_get_tick () / 1000 ; // seconds
15
15
uint32_t elapsed_time = (furi_get_tick () - app -> start_time ) / 1000 ; // seconds
16
16
17
- if (elapsed_time >= app -> duration * 60 ) {
17
+ bool elapsed_time_passed = elapsed_time >= app -> duration * 60 ;
18
+ if (elapsed_time_passed ) {
18
19
app -> time_out = true;
19
20
elapsed_time = app -> duration * 60 ;
20
21
}
@@ -26,7 +27,11 @@ static void timer_callback(void* context) {
26
27
(elapsed_time * (app -> max_interval - app -> min_interval ) / (app -> duration * 60 ));
27
28
// Execute on first run and afterwards every 5 seconds.
28
29
// Do not run after 'duration' has passed, which means after time_out.
29
- if (app -> last_check == 0 || app -> last_check + 5 < current_time || app -> time_out == true) {
30
+
31
+ bool start = app -> last_check == 0 ;
32
+ bool time_for_new_check = app -> last_check + 5 < current_time ; // Run every 5 seconds
33
+
34
+ if (start || time_for_new_check || app -> time_out ) {
30
35
app -> last_check = current_time ;
31
36
32
37
// Equation: 1 minute in miliseconds divided by number of cycles,
@@ -56,7 +61,8 @@ static bool back_button_callback(void* context) {
56
61
furi_hal_light_set (LightBlue , 0 );
57
62
}
58
63
59
- if (app -> current_view != Main ) {
64
+ bool back_to_main_menu = app -> current_view != Main ;
65
+ if (back_to_main_menu ) {
60
66
app -> current_view = Main ;
61
67
view_dispatcher_switch_to_view (app -> view_dispatcher , Main );
62
68
return true;
@@ -103,6 +109,7 @@ static void number_picker_view(
103
109
uint32_t current ,
104
110
uint32_t min ,
105
111
uint32_t max ) {
112
+
106
113
number_input_set_header_text (app -> number_input , header );
107
114
number_input_set_result_callback (
108
115
app -> number_input , number_picker_callback , app , current , min , max );
0 commit comments