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, 7 insertions, 5 deletions
diff --git a/apps/plugins/clock/clock.c b/apps/plugins/clock/clock.c
index 8a1a55e17f..f06f3e15e4 100644
--- a/apps/plugins/clock/clock.c
+++ b/apps/plugins/clock/clock.c
@@ -22,7 +22,6 @@
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"
26#include "lib/xlcd.h" 25#include "lib/xlcd.h"
27 26
28#include "clock.h" 27#include "clock.h"
@@ -31,7 +30,7 @@
31#include "clock_menu.h" 30#include "clock_menu.h"
32#include "clock_settings.h" 31#include "clock_settings.h"
33 32
34 33PLUGIN_HEADER
35 34
36/* Keymaps */ 35/* Keymaps */
37const struct button_mapping* plugin_contexts[]={ 36const struct button_mapping* plugin_contexts[]={
@@ -57,8 +56,9 @@ const struct button_mapping* plugin_contexts[]={
57/************************** 56/**************************
58 * Cleanup on plugin return 57 * Cleanup on plugin return
59 *************************/ 58 *************************/
60void cleanup(void) 59void cleanup(void *parameter)
61{ 60{
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,7 +115,6 @@ 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);
119 118
120#if LCD_DEPTH > 1 119#if LCD_DEPTH > 1
121 rb->lcd_set_backdrop(NULL); 120 rb->lcd_set_backdrop(NULL);
@@ -175,7 +174,9 @@ enum plugin_status plugin_start(const void* parameter){
175 exit_clock=main_menu(); 174 exit_clock=main_menu();
176 break; 175 break;
177 default: 176 default:
178 exit_on_usb(button); 177 if(rb->default_event_handler_ex(button, cleanup, NULL)
178 == SYS_USB_CONNECTED)
179 return PLUGIN_USB_CONNECTED;
179 if(time.second != last_second){ 180 if(time.second != last_second){
180 last_second=time.second; 181 last_second=time.second;
181 redraw=true; 182 redraw=true;
@@ -192,5 +193,6 @@ enum plugin_status plugin_start(const void* parameter){
192 } 193 }
193 } 194 }
194 195
196 cleanup(NULL);
195 return PLUGIN_OK; 197 return PLUGIN_OK;
196} 198}