]> git.earman.xyz Git - sensor-watch.git/commitdiff
preferences face: removed in favor of new settings face
authorJoey Castillo <joeycastillo@utexas.edu>
Wed, 21 May 2025 05:19:29 +0000 (01:19 -0400)
committerJoey Castillo <joeycastillo@utexas.edu>
Wed, 21 May 2025 05:19:29 +0000 (01:19 -0400)
movement_faces.h
watch-faces.mk
watch-faces/settings/preferences_face.c [deleted file]
watch-faces/settings/preferences_face.h [deleted file]

index 246f4945c212bf268add9c35b031f37ac248135f..7baa7145572dc910f7588db1debb1026312c89a0 100644 (file)
@@ -43,7 +43,6 @@
 #include "light_meter_face.h"
 #include "voltage_face.h"
 #include "set_time_face.h"
-#include "preferences_face.h"
 #include "settings_face.h"
 #include "light_sensor_face.h"
 #include "irda_upload_face.h"
index 20c881be446b8280bfa491fe7f4879de04f8c445..610c51ac4598c2ca1840e265808daf6db3e80a45 100644 (file)
@@ -19,7 +19,6 @@ SRCS += \
   ./watch-faces/sensor/activity_logging_face.c \
   ./watch-faces/sensor/voltage_face.c \
   ./watch-faces/settings/set_time_face.c \
-  ./watch-faces/settings/preferences_face.c \
   ./watch-faces/settings/settings_face.c \
   ./watch-faces/settings/finetune_face.c \
   ./watch-faces/settings/nanosec_face.c \
diff --git a/watch-faces/settings/preferences_face.c b/watch-faces/settings/preferences_face.c
deleted file mode 100644 (file)
index 03fc767..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2022-2024 Joey Castillo
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdlib.h>
-#include "preferences_face.h"
-#include "watch.h"
-
-const char preferences_face_titles[PREFERENCES_PAGE_NUM_PREFERENCES][11] = {
-    "CL        K",   // Clock: 12 or 24 hour
-    "BT   beep N",   // Mode button: how loud should it beep?
-    "TO        U",   // Timeout: how long before we snap back to the clock face?
-    "LE        M",   // Low Energy mode: how long before it engages?
-    "LT        D",   // Light: duration
-    "LT   red  C",   // Light: red component
-    "LT   greenC",   // Light: green component
-    "LT   blue C",   // Light: blue component (for watches with blue LED)
-};
-
-void preferences_face_setup(uint8_t watch_face_index, void ** context_ptr) {
-    (void) watch_face_index;
-    if (*context_ptr == NULL) {
-        *context_ptr = malloc(sizeof(preferences_state_t));
-        preferences_state_t *state = (preferences_state_t *)*context_ptr;
-        for (int i = 0; i < PREFERENCES_PAGE_NUM_PREFERENCES; i++) {
-            state->setting_enabled[i] = true;
-        }
-#ifndef WATCH_RED_TCC_CHANNEL
-        state->setting_enabled[PREFERENCES_PAGE_LED_RED] = false;
-#endif
-#ifndef WATCH_GREEN_TCC_CHANNEL
-        state->setting_enabled[PREFERENCES_PAGE_LED_GREEN] = false;
-#endif
-#ifndef WATCH_BLUE_TCC_CHANNEL
-        state->setting_enabled[PREFERENCES_PAGE_LED_BLUE] = false;
-#endif
-
-    }
-}
-
-void preferences_face_activate(void *context) {
-    preferences_state_t *state = (preferences_state_t *)context;
-    state->current_page = 0;
-    movement_request_tick_frequency(4); // we need to manually blink some pixels
-}
-
-bool preferences_face_loop(movement_event_t event, void *context) {
-    preferences_state_t *state = (preferences_state_t *)context;
-    movement_color_t color; // to use in the switch if we need it
-
-    switch (event.event_type) {
-        case EVENT_TICK:
-        case EVENT_ACTIVATE:
-            watch_display_text(WATCH_POSITION_FULL, (char *)preferences_face_titles[state->current_page]);
-            watch_clear_all_indicators();
-            watch_clear_colon();
-
-            // blink active setting on even-numbered quarter-seconds
-            if (event.subsecond % 2) {
-                char buf[8];
-                switch (state->current_page) {
-                    case PREFERENCES_PAGE_CLOCK_MODE:
-                        if (movement_clock_mode_24h()) watch_display_text(WATCH_POSITION_BOTTOM, "24h");
-                        else watch_display_text(WATCH_POSITION_BOTTOM, "12h");
-                        break;
-                    case PREFERENCES_PAGE_BUTTON_SOUND:
-                        if (movement_button_should_sound()) {
-                            watch_display_text(WATCH_POSITION_TOP_RIGHT, " Y");
-                        } else {
-                            watch_display_text(WATCH_POSITION_TOP_RIGHT, " N");
-                        }
-                        break;
-                    case PREFERENCES_PAGE_TIMEOUT:
-                        switch (movement_get_fast_tick_timeout()) {
-                            case 0:
-                                watch_display_text(WATCH_POSITION_BOTTOM, "60 SeC");
-                                break;
-                            case 1:
-                                watch_display_text(WATCH_POSITION_BOTTOM, "2 n&in");
-                                break;
-                            case 2:
-                                watch_display_text(WATCH_POSITION_BOTTOM, "5 n&in");
-                                break;
-                            case 3:
-                                watch_display_text(WATCH_POSITION_BOTTOM, "30n&in");
-                                break;
-                        }
-                        break;
-                    case PREFERENCES_PAGE_LOW_ENERGY:
-                        switch (movement_get_low_energy_timeout()) {
-                            case 0:
-                                watch_display_text(WATCH_POSITION_BOTTOM, " Never");
-                                break;
-                            case 1:
-                                watch_display_text(WATCH_POSITION_BOTTOM, "10n&in");
-                                break;
-                            case 2:
-                                watch_display_text(WATCH_POSITION_BOTTOM, "1 hour");
-                                break;
-                            case 3:
-                                watch_display_text(WATCH_POSITION_BOTTOM, "2 hour");
-                                break;
-                            case 4:
-                                watch_display_text(WATCH_POSITION_BOTTOM, "6 hour");
-                                break;
-                            case 5:
-                                watch_display_text(WATCH_POSITION_BOTTOM, "12 hr");
-                                break;
-                            case 6:
-                                watch_display_text(WATCH_POSITION_BOTTOM, " 1 day");
-                                break;
-                            case 7:
-                                watch_display_text(WATCH_POSITION_BOTTOM, " 7 day");
-                                break;
-                        }
-                        break;
-                    case PREFERENCES_PAGE_LED_DURATION:
-                        if (movement_get_backlight_dwell() == 0) {
-                            watch_display_text(WATCH_POSITION_BOTTOM, "instnt");
-                        } else if (movement_get_backlight_dwell() == 0b111) {
-                            watch_display_text(WATCH_POSITION_BOTTOM, "no LEd");
-                        } else {
-                            sprintf(buf, " %1d SeC", (movement_get_backlight_dwell() * 2 - 1) % 10);
-                            watch_display_text(WATCH_POSITION_BOTTOM, buf);
-                        }
-                        break;
-                    case PREFERENCES_PAGE_LED_RED:
-                        color = movement_backlight_color();
-                        sprintf(buf, "%2d", color.red);
-                        watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
-                        break;
-                    case PREFERENCES_PAGE_LED_GREEN:
-                        color = movement_backlight_color();
-                        sprintf(buf, "%2d", color.green);
-                        watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
-                        break;
-                    case PREFERENCES_PAGE_LED_BLUE:
-                        color = movement_backlight_color();
-                        sprintf(buf, "%2d", color.blue);
-                        watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
-                        break;
-                    case PREFERENCES_PAGE_NUM_PREFERENCES:
-                        // nothing to do here, just silencing the warning
-                        break;
-                }
-            }
-            break;
-        case EVENT_MODE_BUTTON_UP:
-            movement_force_led_off();
-            movement_move_to_next_face();
-            return false;
-        case EVENT_LIGHT_BUTTON_DOWN:
-            state->current_page = (state->current_page + 1) % PREFERENCES_PAGE_NUM_PREFERENCES;
-            while (!state->setting_enabled[state->current_page]) {
-                state->current_page = (state->current_page + 1) % PREFERENCES_PAGE_NUM_PREFERENCES;
-            }
-            break;
-        case EVENT_ALARM_BUTTON_UP:
-            switch (state->current_page) {
-                case PREFERENCES_PAGE_CLOCK_MODE:
-                    movement_set_clock_mode_24h(((movement_clock_mode_24h() + 1) % MOVEMENT_NUM_CLOCK_MODES));
-                    break;
-                case PREFERENCES_PAGE_BUTTON_SOUND:
-                    movement_set_button_should_sound(!movement_button_should_sound());
-                    break;
-                case PREFERENCES_PAGE_TIMEOUT:
-                    movement_set_fast_tick_timeout((movement_get_fast_tick_timeout() + 1));
-                    break;
-                case PREFERENCES_PAGE_LOW_ENERGY:
-                    movement_set_low_energy_timeout((movement_get_low_energy_timeout() + 1));
-                    break;
-                case PREFERENCES_PAGE_LED_DURATION:
-                    movement_set_backlight_dwell(movement_get_backlight_dwell() + 1);
-                    if (movement_get_backlight_dwell() > 3) {
-                        // set all bits to disable the LED
-                        movement_set_backlight_dwell(0b111);
-                    }
-                    break;
-                case PREFERENCES_PAGE_LED_RED:
-                    color = movement_backlight_color();
-                    color.red++;
-                    movement_set_backlight_color(color);
-                    break;
-                case PREFERENCES_PAGE_LED_GREEN:
-                    color = movement_backlight_color();
-                    color.green++;
-                    movement_set_backlight_color(color);
-                    break;
-                case PREFERENCES_PAGE_LED_BLUE:
-                    color = movement_backlight_color();
-                    color.blue++;
-                    movement_set_backlight_color(color);
-                    break;
-                case PREFERENCES_PAGE_NUM_PREFERENCES:
-                    // nothing to do here, just silencing the warning
-                    break;
-            }
-            break;
-        case EVENT_TIMEOUT:
-            movement_move_to_face(0);
-            break;
-        default:
-            return movement_default_loop_handler(event);
-    }
-
-    if (state->current_page == PREFERENCES_PAGE_LED_RED ||
-        state->current_page == PREFERENCES_PAGE_LED_GREEN ||
-        state->current_page == PREFERENCES_PAGE_LED_BLUE) {
-        movement_color_t color = movement_backlight_color();
-        // this bitwise math turns #000 into #000000, #111 into #111111, etc.
-        movement_force_led_on(color.red | color.red << 4,
-                              color.green | color.green << 4,
-                              color.blue | color.blue << 4);
-        return false;
-    } else {
-        movement_force_led_off();
-        return true;
-    }
-}
-
-void preferences_face_resign(void *context) {
-    (void) context;
-    movement_force_led_off();
-    movement_store_settings();
-}
diff --git a/watch-faces/settings/preferences_face.h b/watch-faces/settings/preferences_face.h
deleted file mode 100644 (file)
index 77f6409..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2022-2024 Joey Castillo
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#pragma once
-
-/*
- * Legacy PREFERENCES face
- *
- * This face is deprecated and will be removed in a future release.
- * Please use the Settings watch face instead.
- *
- * The Preferences watch face allows you to configure various options on your
- * Sensor Watch. Like all other screens, you advance the field you’re setting
- * with the Light button, and advance its value with the Alarm button. The
- * Preferences watch face labels each setting with a two-letter code on the
- * top row; the following list describes each setting and their options:
- *
- *  CL - Clock mode.
- *      This setting allows you to select a 12-or 24-hour clock display. All
- *      watch faces that support displaying the time will respect this setting;
- *      for example, both Simple Clock, World Clock and Sunrise/Sunset will
- *      display the time in 24 hour format if the 24 hour clock is selected here.
- *
- *  MO - Mode button.
- *      This setting allows you to choose whether the Mode button should emit
- *      a beep when pressed, and if so, how loud it should be. Options are
- *      "-" (no beep), "L" (low volume) and "H" (high volume).
- *
- *  MO - Mode button.
- *      This setting allows you to choose whether the Mode button should emit
- *      a beep when pressed, and if so, how loud it should be. Options are
- *      "-" (no beep), "L" (low volume) and "H" (high volume).
- *
- *  TO - Timeout.
- *      Sets the time until screens that time out (like Settings and Time Set)
- *      snap back to the first screen. 60 seconds is a good default for the
- *      stock firmware, but if you choose a custom firmware with faces that
- *      you’d like to keep on screen for longer, you can set that here.
- *
- *  LE - Low Energy mode.
- *      Sets the time until the watch enters its low energy sleep mode.
- *      Options range from 1 hour to 7 days, or Never. The more often Sensor
- *      Watch goes to sleep, the longer its battery will last — but you will
- *      lose the seconds indicator while it is asleep. This setting allows
- *      you to make a tradeoff between the device’s responsiveness and its
- *      longevity.
- *
- *  LT - Light.
- *      This setting has three screens.
- *      The first lets you choose how long the LED should stay lit when the
- *       LIGHT button is pressed. Options are 1 second, 3 seconds and 5
- *       seconds, or “No LED” to disable the LED entirely.
- *      The second screen, titled “blu” or “grn”, sets the intensity of the
- *       blue or green LED depending on the target Sensor Board hardware.
- *       Values range from 0 (off) to 15 (full intensity).
- *      The third screen, “red”, sets the intensity of the red LED, again
- *       from 0 to 15.
- *      On the last two screens, the LED remains on so that you can see the
- *      effect of mixing the two LED colors. On the Special Edition boards,
- *      you’ll have red, blue and a variety of shades of pink and purple to
- *      experiment with!
- */
-
-#include "movement.h"
-
-typedef enum {
-    PREFERENCES_PAGE_CLOCK_MODE = 0,
-    PREFERENCES_PAGE_BUTTON_SOUND,
-    PREFERENCES_PAGE_TIMEOUT,
-    PREFERENCES_PAGE_LOW_ENERGY,
-    PREFERENCES_PAGE_LED_DURATION,
-    PREFERENCES_PAGE_LED_RED,
-    PREFERENCES_PAGE_LED_GREEN,
-    PREFERENCES_PAGE_LED_BLUE,
-    PREFERENCES_PAGE_NUM_PREFERENCES,
-} preferences_page_t;
-
-
-typedef struct {
-    bool setting_enabled[PREFERENCES_PAGE_NUM_PREFERENCES];
-    preferences_page_t current_page;
-} preferences_state_t;
-
-void preferences_face_setup(uint8_t watch_face_index, void ** context_ptr);
-void preferences_face_activate(void *context);
-bool preferences_face_loop(movement_event_t event, void *context);
-void preferences_face_resign(void *context);
-
-#define preferences_face ((const watch_face_t){ \
-    preferences_face_setup, \
-    preferences_face_activate, \
-    preferences_face_loop, \
-    preferences_face_resign, \
-    NULL, \
-})