summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPietro F. Maggi <pfm@pietromaggi.com>2024-01-07 12:40:42 +0100
committerPietro F. Maggi <pfm@pietromaggi.com>2024-01-07 12:43:18 +0100
commit8e0e942573407ffe9901cb1a2ee5ac4cf911f37c (patch)
tree51f34ee80c382f2a327a51a0279b7f89464c5879
parent63d6bc6aa0ddf4cc1ce1918ef7650852a25e581b (diff)
downloadSensor-Watch-8e0e942573407ffe9901cb1a2ee5ac4cf911f37c.tar.gz
Sensor-Watch-8e0e942573407ffe9901cb1a2ee5ac4cf911f37c.tar.bz2
Sensor-Watch-8e0e942573407ffe9901cb1a2ee5ac4cf911f37c.zip
Handle visibility for tomato watchface
(cherry picked from commit 547e8248ba3538693ee8c587a92ffece7b40d1a2)
-rw-r--r--movement/watch_faces/complication/tomato_face.c10
-rw-r--r--movement/watch_faces/complication/tomato_face.h1
2 files changed, 9 insertions, 2 deletions
diff --git a/movement/watch_faces/complication/tomato_face.c b/movement/watch_faces/complication/tomato_face.c
index 698301e1..3d46ba94 100644
--- a/movement/watch_faces/complication/tomato_face.c
+++ b/movement/watch_faces/complication/tomato_face.c
@@ -84,8 +84,10 @@ static void tomato_draw(tomato_state_t *state) {
sec = 0;
break;
}
- sprintf(buf, "TO %c%2d%02d%2d", kind, min, sec, state->done_count);
- watch_display_string(buf, 0);
+ if (state->visible) {
+ sprintf(buf, "TO %c%2d%02d%2d", kind, min, sec, state->done_count);
+ watch_display_string(buf, 0);
+ }
}
static void tomato_reset(tomato_state_t *state) {
@@ -116,6 +118,7 @@ void tomato_face_setup(movement_settings_t *settings, uint8_t watch_face_index,
state->mode=tomato_ready;
state->kind= tomato_focus;
state->done_count = 0;
+ state->visible = true;
}
}
@@ -127,6 +130,7 @@ void tomato_face_activate(movement_settings_t *settings, void *context) {
watch_set_indicator(WATCH_INDICATOR_BELL);
}
watch_set_colon();
+ state->visible = true;
}
bool tomato_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
@@ -184,6 +188,8 @@ bool tomato_face_loop(movement_event_t event, movement_settings_t *settings, voi
}
void tomato_face_resign(movement_settings_t *settings, void *context) {
+ tomato_state_t *state = (tomato_state_t *)context;
+ state->visible = false;
(void) settings;
(void) context;
}
diff --git a/movement/watch_faces/complication/tomato_face.h b/movement/watch_faces/complication/tomato_face.h
index 33a086c6..25f7db0e 100644
--- a/movement/watch_faces/complication/tomato_face.h
+++ b/movement/watch_faces/complication/tomato_face.h
@@ -64,6 +64,7 @@ typedef struct {
tomato_mode mode;
tomato_kind kind;
uint8_t done_count;
+ bool visible;
} tomato_state_t;
void tomato_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);