summaryrefslogtreecommitdiffstats
path: root/launcher/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/widgets')
-rw-r--r--launcher/widgets/clock/simple_clock_widget.c6
-rw-r--r--launcher/widgets/clock/simple_clock_widget.h2
-rw-r--r--launcher/widgets/fake_widget_1.c6
-rw-r--r--launcher/widgets/fake_widget_1.h2
-rw-r--r--launcher/widgets/fake_widget_2.c6
-rw-r--r--launcher/widgets/fake_widget_2.h2
-rw-r--r--launcher/widgets/settings/preferences_widget.c24
-rw-r--r--launcher/widgets/settings/preferences_widget.h2
8 files changed, 29 insertions, 21 deletions
diff --git a/launcher/widgets/clock/simple_clock_widget.c b/launcher/widgets/clock/simple_clock_widget.c
index 427793f3..83b5a713 100644
--- a/launcher/widgets/clock/simple_clock_widget.c
+++ b/launcher/widgets/clock/simple_clock_widget.c
@@ -17,7 +17,7 @@ void simple_clock_widget_activate(LauncherSettings *settings, void *context) {
*((uint32_t *)context) = 0xFFFFFFFF;
}
-void simple_clock_widget_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
+bool simple_clock_widget_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
printf("simple_clock_widget_loop\n");
const char weekdays[7][3] = {"SA", "SU", "MO", "TU", "WE", "TH", "FR"};
char buf[11];
@@ -64,7 +64,7 @@ void simple_clock_widget_loop(LauncherEvent event, LauncherSettings *settings, v
break;
case EVENT_MODE_BUTTON_UP:
launcher_move_to_next_widget();
- return;
+ return false;
case EVENT_LIGHT_BUTTON_UP:
launcher_illuminate_led();
break;
@@ -73,6 +73,8 @@ void simple_clock_widget_loop(LauncherEvent event, LauncherSettings *settings, v
default:
break;
}
+
+ return true;
}
void simple_clock_widget_resign(LauncherSettings *settings, void *context) {
diff --git a/launcher/widgets/clock/simple_clock_widget.h b/launcher/widgets/clock/simple_clock_widget.h
index 42b0d3c5..739c942b 100644
--- a/launcher/widgets/clock/simple_clock_widget.h
+++ b/launcher/widgets/clock/simple_clock_widget.h
@@ -5,7 +5,7 @@
void simple_clock_widget_setup(LauncherSettings *settings, void ** context_ptr);
void simple_clock_widget_activate(LauncherSettings *settings, void *context);
-void simple_clock_widget_loop(LauncherEvent event, LauncherSettings *settings, void *context);
+bool simple_clock_widget_loop(LauncherEvent event, LauncherSettings *settings, void *context);
void simple_clock_widget_resign(LauncherSettings *settings, void *context);
uint8_t simple_clock_widget_get_weekday(uint16_t day, uint16_t month, uint16_t year);
diff --git a/launcher/widgets/fake_widget_1.c b/launcher/widgets/fake_widget_1.c
index 65324095..bdc964e2 100644
--- a/launcher/widgets/fake_widget_1.c
+++ b/launcher/widgets/fake_widget_1.c
@@ -11,7 +11,7 @@ void fake_widget_1_activate(LauncherSettings *settings, void *context) {
(void) context;
}
-void fake_widget_1_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
+bool fake_widget_1_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
printf("fake_widget_1_loop\n");
(void) settings;
(void) context;
@@ -20,13 +20,15 @@ void fake_widget_1_loop(LauncherEvent event, LauncherSettings *settings, void *c
switch (event.bit.event_type) {
case EVENT_MODE_BUTTON_UP:
launcher_move_to_next_widget();
- return;
+ return false;
case EVENT_LIGHT_BUTTON_UP:
launcher_illuminate_led();
break;
default:
break;
}
+
+ return true;
}
void fake_widget_1_resign(LauncherSettings *settings, void *context) {
diff --git a/launcher/widgets/fake_widget_1.h b/launcher/widgets/fake_widget_1.h
index 24704f23..d033b49a 100644
--- a/launcher/widgets/fake_widget_1.h
+++ b/launcher/widgets/fake_widget_1.h
@@ -5,7 +5,7 @@
void fake_widget_1_setup(LauncherSettings *settings, void ** context_ptr);
void fake_widget_1_activate(LauncherSettings *settings, void *context);
-void fake_widget_1_loop(LauncherEvent event, LauncherSettings *settings, void *context);
+bool fake_widget_1_loop(LauncherEvent event, LauncherSettings *settings, void *context);
void fake_widget_1_resign(LauncherSettings *settings, void *context);
#define fake_widget_1 { \
diff --git a/launcher/widgets/fake_widget_2.c b/launcher/widgets/fake_widget_2.c
index a6eafb7b..46772222 100644
--- a/launcher/widgets/fake_widget_2.c
+++ b/launcher/widgets/fake_widget_2.c
@@ -11,7 +11,7 @@ void fake_widget_2_activate(LauncherSettings *settings, void *context) {
(void) context;
}
-void fake_widget_2_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
+bool fake_widget_2_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
printf("fake_widget_2_loop\n");
(void) settings;
(void) context;
@@ -20,13 +20,15 @@ void fake_widget_2_loop(LauncherEvent event, LauncherSettings *settings, void *c
switch (event.bit.event_type) {
case EVENT_MODE_BUTTON_UP:
launcher_move_to_next_widget();
- return;
+ return false;
case EVENT_LIGHT_BUTTON_UP:
launcher_illuminate_led();
break;
default:
break;
}
+
+ return true;
}
void fake_widget_2_resign(LauncherSettings *settings, void *context) {
diff --git a/launcher/widgets/fake_widget_2.h b/launcher/widgets/fake_widget_2.h
index 945e28fa..cf01969d 100644
--- a/launcher/widgets/fake_widget_2.h
+++ b/launcher/widgets/fake_widget_2.h
@@ -5,7 +5,7 @@
void fake_widget_2_setup(LauncherSettings *settings, void ** context_ptr);
void fake_widget_2_activate(LauncherSettings *settings, void *context);
-void fake_widget_2_loop(LauncherEvent event, LauncherSettings *settings, void *context);
+bool fake_widget_2_loop(LauncherEvent event, LauncherSettings *settings, void *context);
void fake_widget_2_resign(LauncherSettings *settings, void *context);
#define fake_widget_2 { \
diff --git a/launcher/widgets/settings/preferences_widget.c b/launcher/widgets/settings/preferences_widget.c
index d4abeb8e..878b775b 100644
--- a/launcher/widgets/settings/preferences_widget.c
+++ b/launcher/widgets/settings/preferences_widget.c
@@ -16,15 +16,16 @@ void preferences_widget_activate(LauncherSettings *settings, void *context) {
launcher_request_tick_frequency(4); // we need to manually blink some pixels
}
-void preferences_widget_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
+bool preferences_widget_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
(void) settings;
(void) context;
printf("preferences_widget_loop\n");
uint8_t current_page = *((uint8_t *)context);
switch (event.bit.event_type) {
case EVENT_MODE_BUTTON_UP:
+ watch_set_led_off();
launcher_move_to_next_widget();
- return;
+ return false;
case EVENT_LIGHT_BUTTON_UP:
current_page = (current_page + 1) % PREFERENCES_WIDGET_NUM_PREFEFENCES;
*((uint8_t *)context) = current_page;
@@ -54,16 +55,8 @@ void preferences_widget_loop(LauncherEvent event, LauncherSettings *settings, vo
watch_clear_display();
watch_display_string((char *)preferences_widget_titles[current_page], 0);
- if (current_page > 2) {
- // this is a hack, launcher should be able to illumate with a custom color.
- launcher_illuminate_led();
- watch_set_led_color(settings->bit.led_red_color ? (0xF | settings->bit.led_red_color << 4) : 0,
- settings->bit.led_green_color ? (0xF | settings->bit.led_green_color << 4) : 0);
- } else {
- watch_set_led_off();
- }
- if (event.bit.subsecond % 2) return;
+ if (event.bit.subsecond % 2) return current_page <= 2;
char buf[3];
switch (current_page) {
case 0:
@@ -111,6 +104,15 @@ void preferences_widget_loop(LauncherEvent event, LauncherSettings *settings, vo
watch_display_string(buf, 8);
break;
}
+
+ if (current_page > 2) {
+ watch_set_led_color(settings->bit.led_red_color ? (0xF | settings->bit.led_red_color << 4) : 0,
+ settings->bit.led_green_color ? (0xF | settings->bit.led_green_color << 4) : 0);
+ return false;
+ }
+
+ watch_set_led_off();
+ return true;
}
void preferences_widget_resign(LauncherSettings *settings, void *context) {
diff --git a/launcher/widgets/settings/preferences_widget.h b/launcher/widgets/settings/preferences_widget.h
index e2e27fc7..11a189f8 100644
--- a/launcher/widgets/settings/preferences_widget.h
+++ b/launcher/widgets/settings/preferences_widget.h
@@ -5,7 +5,7 @@
void preferences_widget_setup(LauncherSettings *settings, void ** context_ptr);
void preferences_widget_activate(LauncherSettings *settings, void *context);
-void preferences_widget_loop(LauncherEvent event, LauncherSettings *settings, void *context);
+bool preferences_widget_loop(LauncherEvent event, LauncherSettings *settings, void *context);
void preferences_widget_resign(LauncherSettings *settings, void *context);
#define preferences_widget { \