summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/clock.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c
index 1f91fc6100..0ce21455c2 100644
--- a/apps/plugins/clock.c
+++ b/apps/plugins/clock.c
@@ -21,6 +21,11 @@
21RELEASE NOTES ******************* 21RELEASE NOTES *******************
22********************************* 22*********************************
23 23
24*********************************
25VERSION 2.21 * STABLE ***********
26*********************************
27Changed the behaviour of F2
28
24******************************** 29********************************
25VERSION 2.2 * STABLE *********** 30VERSION 2.2 * STABLE ***********
26******************************** 31********************************
@@ -80,6 +85,8 @@ and a few options.
80 85
81#ifdef HAVE_LCD_BITMAP 86#ifdef HAVE_LCD_BITMAP
82 87
88#define CLOCK_VERSION "2.21"
89
83/* prototypes */ 90/* prototypes */
84void show_logo(bool animate, bool show_clock_text); 91void show_logo(bool animate, bool show_clock_text);
85void exit_logo(void); 92void exit_logo(void);
@@ -526,7 +533,7 @@ void load_settings(void)
526 533
527 rb->lcd_setfont(FONT_SYSFIXED); 534 rb->lcd_setfont(FONT_SYSFIXED);
528 535
529 rb->lcd_puts(0, 6, "Clock v2.2"); 536 rb->lcd_puts(0, 6, "Clock " CLOCK_VERSION);
530 537
531 if(fd >= 0) /* does file exist? */ 538 if(fd >= 0) /* does file exist? */
532 { 539 {
@@ -536,7 +543,7 @@ void load_settings(void)
536 rb->read(fd, &settings, sizeof(struct saved_settings)); 543 rb->read(fd, &settings, sizeof(struct saved_settings));
537 rb->close(fd); 544 rb->close(fd);
538 show_logo(true, true); 545 show_logo(true, true);
539 rb->lcd_puts(0, 6, "Clock v2.2"); 546 rb->lcd_puts(0, 6, "Clock " CLOCK_VERSION);
540 rb->lcd_puts(0, 7, "Loaded settings"); 547 rb->lcd_puts(0, 7, "Loaded settings");
541 } 548 }
542 else /* bail out */ 549 else /* bail out */
@@ -559,7 +566,7 @@ void load_settings(void)
559} 566}
560 567
561/************************************************************** 568/**************************************************************
562 * 7-Segment LED/LCD imitation code, by Linus Nielson Feltzing 569 * 7-Segment LED/LCD imitation code, by Linus Nielsen Feltzing
563 **************************************************************/ 570 **************************************************************/
564/* 571/*
565 a 0 b 572 a 0 b
@@ -997,7 +1004,7 @@ void show_logo(bool animate, bool show_clock_text)
997 rb->lcd_clearline(0, x_position/2+38, 111, x_position/2+38); 1004 rb->lcd_clearline(0, x_position/2+38, 111, x_position/2+38);
998 rb->lcd_bitmap(clogo, 0, x_position/2, 112, 37, true); 1005 rb->lcd_bitmap(clogo, 0, x_position/2, 112, 37, true);
999 if(show_clock_text) 1006 if(show_clock_text)
1000 rb->lcd_puts(0, 6, "Clock v2.2"); 1007 rb->lcd_puts(0, 6, "Clock " CLOCK_VERSION);
1001 rb->lcd_update(); 1008 rb->lcd_update();
1002 } 1009 }
1003 /* bounce back up a little */ 1010 /* bounce back up a little */
@@ -1007,7 +1014,7 @@ void show_logo(bool animate, bool show_clock_text)
1007 rb->lcd_clearline(0, x_position/2+38, 111, x_position/2+38); 1014 rb->lcd_clearline(0, x_position/2+38, 111, x_position/2+38);
1008 rb->lcd_bitmap(clogo, 0, x_position/2, 112, 37, true); 1015 rb->lcd_bitmap(clogo, 0, x_position/2, 112, 37, true);
1009 if(show_clock_text) 1016 if(show_clock_text)
1010 rb->lcd_puts(0, 6, "Clock v2.2"); 1017 rb->lcd_puts(0, 6, "Clock " CLOCK_VERSION);
1011 rb->lcd_update(); 1018 rb->lcd_update();
1012 } 1019 }
1013 /* and go back down again */ 1020 /* and go back down again */
@@ -1017,7 +1024,7 @@ void show_logo(bool animate, bool show_clock_text)
1017 rb->lcd_clearline(0, x_position/2+38, 111, x_position/2+38); 1024 rb->lcd_clearline(0, x_position/2+38, 111, x_position/2+38);
1018 rb->lcd_bitmap(clogo, 0, x_position/2, 112, 37, true); 1025 rb->lcd_bitmap(clogo, 0, x_position/2, 112, 37, true);
1019 if(show_clock_text) 1026 if(show_clock_text)
1020 rb->lcd_puts(0, 6, "Clock v2.2"); 1027 rb->lcd_puts(0, 6, "Clock " CLOCK_VERSION);
1021 rb->lcd_update(); 1028 rb->lcd_update();
1022 } 1029 }
1023 } 1030 }
@@ -1167,7 +1174,7 @@ bool show_credits(void)
1167 1174
1168 rb->lcd_clear_display(); 1175 rb->lcd_clear_display();
1169 1176
1170 /* show the logo with an animation and the clock 2.2 text */ 1177 /* show the logo with an animation and the clock version text */
1171 show_logo(true, true); 1178 show_logo(true, true);
1172 1179
1173 rb->lcd_puts(0, 7, "Credit Roll..."); 1180 rb->lcd_puts(0, 7, "Credit Roll...");
@@ -1204,7 +1211,7 @@ bool f1_screen(void)
1204 /* page one */ 1211 /* page one */
1205 if(screen == 1) 1212 if(screen == 1)
1206 { 1213 {
1207 rb->lcd_puts(0, 0, "Using Clock v2.2:"); 1214 rb->lcd_puts(0, 0, "Using Clock " CLOCK_VERSION ":");
1208 rb->lcd_puts(0, 1, "To navigate this"); 1215 rb->lcd_puts(0, 1, "To navigate this");
1209 rb->lcd_puts(0, 2, "help, use LEFT and"); 1216 rb->lcd_puts(0, 2, "help, use LEFT and");
1210 rb->lcd_puts(0, 3, "RIGHT. F1 returns"); 1217 rb->lcd_puts(0, 3, "RIGHT. F1 returns");
@@ -2087,6 +2094,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
2087 /* poweroff activated or not? */ 2094 /* poweroff activated or not? */
2088 bool reset_timer = false; 2095 bool reset_timer = false;
2089 2096
2097 bool f2_held = false;
2098
2090 struct tm* current_time; 2099 struct tm* current_time;
2091 2100
2092 TEST_PLUGIN_API(api); 2101 TEST_PLUGIN_API(api);
@@ -2334,24 +2343,31 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
2334 f1_screen(); 2343 f1_screen();
2335 break; 2344 break;
2336 2345
2337 case BUTTON_F2: /* start/stop counter */ 2346 case BUTTON_F2|BUTTON_REL: /* start/stop counter */
2338 if(settings.clock != 5) 2347 if(settings.clock != 5)
2339 { 2348 {
2340 if(counting) 2349 /* Ignore if the counter was reset */
2350 if(!f2_held)
2341 { 2351 {
2342 counting = false; 2352 if(counting)
2343 counter += passed_time; 2353 {
2344 } 2354 counting = false;
2345 else 2355 counter += passed_time;
2346 { 2356 }
2347 counting = true; 2357 else
2348 start_tick = *rb->current_tick; 2358 {
2359 counting = true;
2360 start_tick = *rb->current_tick;
2361 }
2349 } 2362 }
2363 f2_held = false;
2350 } 2364 }
2351 break; 2365 break;
2352 2366
2353 case BUTTON_F2 | BUTTON_REPEAT: /* reset counter */ 2367 case BUTTON_F2 | BUTTON_REPEAT: /* reset counter */
2368 f2_held = true; /* Ignore the release event */
2354 counter = 0; 2369 counter = 0;
2370 start_tick = *rb->current_tick;
2355 break; 2371 break;
2356 2372
2357 case BUTTON_F3: /* options */ 2373 case BUTTON_F3: /* options */