summaryrefslogtreecommitdiff
path: root/apps/plugins/clock/clock.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/clock/clock.c')
-rw-r--r--apps/plugins/clock/clock.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/apps/plugins/clock/clock.c b/apps/plugins/clock/clock.c
index f06f3e15e4..8a1a55e17f 100644
--- a/apps/plugins/clock/clock.c
+++ b/apps/plugins/clock/clock.c
@@ -22,6 +22,7 @@
22#include "plugin.h" 22#include "plugin.h"
23#include "time.h" 23#include "time.h"
24#include "lib/pluginlib_actions.h" 24#include "lib/pluginlib_actions.h"
25#include "lib/pluginlib_exit.h"
25#include "lib/xlcd.h" 26#include "lib/xlcd.h"
26 27
27#include "clock.h" 28#include "clock.h"
@@ -30,7 +31,7 @@
30#include "clock_menu.h" 31#include "clock_menu.h"
31#include "clock_settings.h" 32#include "clock_settings.h"
32 33
33PLUGIN_HEADER 34
34 35
35/* Keymaps */ 36/* Keymaps */
36const struct button_mapping* plugin_contexts[]={ 37const struct button_mapping* plugin_contexts[]={
@@ -56,9 +57,8 @@ const struct button_mapping* plugin_contexts[]={
56/************************** 57/**************************
57 * Cleanup on plugin return 58 * Cleanup on plugin return
58 *************************/ 59 *************************/
59void cleanup(void *parameter) 60void cleanup(void)
60{ 61{
61 (void)parameter;
62 clock_draw_restore_colors(); 62 clock_draw_restore_colors();
63 if(clock_settings.general.save_settings == 1) 63 if(clock_settings.general.save_settings == 1)
64 save_settings(); 64 save_settings();
@@ -115,6 +115,7 @@ enum plugin_status plugin_start(const void* parameter){
115 struct counter counter; 115 struct counter counter;
116 bool exit_clock = false; 116 bool exit_clock = false;
117 (void)parameter; 117 (void)parameter;
118 atexit(cleanup);
118 119
119#if LCD_DEPTH > 1 120#if LCD_DEPTH > 1
120 rb->lcd_set_backdrop(NULL); 121 rb->lcd_set_backdrop(NULL);
@@ -174,9 +175,7 @@ enum plugin_status plugin_start(const void* parameter){
174 exit_clock=main_menu(); 175 exit_clock=main_menu();
175 break; 176 break;
176 default: 177 default:
177 if(rb->default_event_handler_ex(button, cleanup, NULL) 178 exit_on_usb(button);
178 == SYS_USB_CONNECTED)
179 return PLUGIN_USB_CONNECTED;
180 if(time.second != last_second){ 179 if(time.second != last_second){
181 last_second=time.second; 180 last_second=time.second;
182 redraw=true; 181 redraw=true;
@@ -193,6 +192,5 @@ enum plugin_status plugin_start(const void* parameter){
193 } 192 }
194 } 193 }
195 194
196 cleanup(NULL);
197 return PLUGIN_OK; 195 return PLUGIN_OK;
198} 196}