diff options
author | James McKenzie <james.mckenzie@hp.com> | 2024-04-08 02:53:44 +0100 |
---|---|---|
committer | James McKenzie <james.mckenzie@hp.com> | 2024-04-08 02:53:44 +0100 |
commit | 70fa5961a87c57ecaf862dd485158d09d9bb69cd (patch) | |
tree | cd493d3d0bd24b4c2513f275309182d3d8d086ab | |
parent | cbbc273360db37849eff7258cb27998f3e217445 (diff) | |
download | Sensor-Watch-pq-70fa5961a87c57ecaf862dd485158d09d9bb69cd.tar.gz Sensor-Watch-pq-70fa5961a87c57ecaf862dd485158d09d9bb69cd.tar.bz2 Sensor-Watch-pq-70fa5961a87c57ecaf862dd485158d09d9bb69cd.zip |
fix day-night
-rw-r--r-- | main/countdown-default-5min.patch | 13 | ||||
-rw-r--r-- | main/day-night-percent.patch | 73 | ||||
-rw-r--r-- | main/fix-emscripten.patch | 12 | ||||
-rw-r--r-- | main/fix-tuning.patch | 9 | ||||
-rw-r--r-- | main/jmm.patch | 5 | ||||
-rw-r--r-- | main/series | 3 |
6 files changed, 108 insertions, 7 deletions
diff --git a/main/countdown-default-5min.patch b/main/countdown-default-5min.patch new file mode 100644 index 0000000..8248e28 --- /dev/null +++ b/main/countdown-default-5min.patch @@ -0,0 +1,13 @@ +diff --git a/movement/watch_faces/complication/countdown_face.c b/movement/watch_faces/complication/countdown_face.c +index be04040..9d67936 100644 +--- a/movement/watch_faces/complication/countdown_face.c ++++ b/movement/watch_faces/complication/countdown_face.c +@@ -30,7 +30,7 @@ + #include "watch_utility.h" + + #define CD_SELECTIONS 3 +-#define DEFAULT_MINUTES 3 ++#define DEFAULT_MINUTES 5 + + static bool quick_ticks_running; + diff --git a/main/day-night-percent.patch b/main/day-night-percent.patch new file mode 100644 index 0000000..5593cd6 --- /dev/null +++ b/main/day-night-percent.patch @@ -0,0 +1,73 @@ +diff --git a/movement/watch_faces/clock/day_night_percentage_face.c b/movement/watch_faces/clock/day_night_percentage_face.c +index 86f07f9..76265ff 100644 +--- a/movement/watch_faces/clock/day_night_percentage_face.c ++++ b/movement/watch_faces/clock/day_night_percentage_face.c +@@ -53,6 +53,7 @@ static void recalculate(watch_date_time utc_now, day_night_percentage_state_t *s + state->daylen = day_length(utc_now.unit.year + WATCH_RTC_REFERENCE_YEAR, utc_now.unit.month, utc_now.unit.day, lon, lat); + + state->result = sun_rise_set(utc_now.unit.year + WATCH_RTC_REFERENCE_YEAR, utc_now.unit.month, utc_now.unit.day, lon, lat, &state->rise, &state->set); ++ state->last_min = utc_now.unit.minute; + } + + void day_night_percentage_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) { +@@ -68,8 +69,10 @@ void day_night_percentage_face_setup(movement_settings_t *settings, uint8_t watc + } + + void day_night_percentage_face_activate(movement_settings_t *settings, void *context) { ++ day_night_percentage_state_t *state = (day_night_percentage_state_t *)context; + (void) settings; +- (void) context; ++ ++ state->last_min=-1; + } + + bool day_night_percentage_face_loop(movement_event_t event, movement_settings_t *settings, void *context) { +@@ -83,7 +86,8 @@ bool day_night_percentage_face_loop(movement_event_t event, movement_settings_t + case EVENT_ACTIVATE: + case EVENT_TICK: + case EVENT_LOW_ENERGY_UPDATE: +- if ((utc_now.unit.hour == 0 && utc_now.unit.minute == 0 && utc_now.unit.second == 0) || state->result == -2) { ++ if ((utc_now.unit.hour == 0 && utc_now.unit.minute == 0 && utc_now.unit.second == 0) || (state->result == -2) || (state->last_min ++!= utc_now.unit.minute)) { + recalculate(utc_now, state); + } + +@@ -106,6 +110,7 @@ bool day_night_percentage_face_loop(movement_event_t event, movement_settings_t + + double day_percentage = (24.0 - better_fmod(state->rise - day_hours_decimal, 24.0)) / state->daylen; + double night_percentage = (24.0 - better_fmod(state->set - day_hours_decimal, 24.0)) / (24 - state->daylen); ++ bool day = true; + + uint16_t percentage; + if (day_percentage > 0.0 && day_percentage < 1.0) { +@@ -113,13 +118,15 @@ bool day_night_percentage_face_loop(movement_event_t event, movement_settings_t + watch_clear_indicator(WATCH_INDICATOR_PM); + } else { + percentage = night_percentage * 10000; +- watch_set_indicator(WATCH_INDICATOR_PM); ++ //watch_set_indicator(WATCH_INDICATOR_PM); ++ watch_clear_indicator(WATCH_INDICATOR_PM); ++ day = false; + } + if (event.event_type == EVENT_LOW_ENERGY_UPDATE) { + if (!watch_tick_animation_is_running()) watch_start_tick_animation(500); +- sprintf(buf, "%s%2d %02d ", weekday, date_time.unit.day, percentage / 100); ++ sprintf(buf, "%s%2d%s%02d ", weekday, date_time.unit.day, day ? " d":"ni", percentage / 100); + } else { +- sprintf(buf, "%s%2d %04d", weekday, date_time.unit.day, percentage); ++ sprintf(buf, "%s%2d%s%04d", weekday, date_time.unit.day, day ? " d":"ni", percentage); + } + watch_display_string(buf, 0); + } +diff --git a/movement/watch_faces/clock/day_night_percentage_face.h b/movement/watch_faces/clock/day_night_percentage_face.h +index d172c74..f6d9a54 100644 +--- a/movement/watch_faces/clock/day_night_percentage_face.h ++++ b/movement/watch_faces/clock/day_night_percentage_face.h +@@ -44,6 +44,7 @@ + + typedef struct { + int result; // -1, 0, 1: result from sun_rise_set, -2: no location set ++ int8_t last_min; + double rise; + double set; + double daylen; diff --git a/main/fix-emscripten.patch b/main/fix-emscripten.patch new file mode 100644 index 0000000..4534c21 --- /dev/null +++ b/main/fix-emscripten.patch @@ -0,0 +1,12 @@ +diff --git a/movement/shell.c b/movement/shell.c +index 8f146e5..6168f89 100644 +--- a/movement/shell.c ++++ b/movement/shell.c +@@ -33,6 +33,7 @@ + + #if __EMSCRIPTEN__ + #include <emscripten.h> ++#include <stdlib.h> + #endif + + #include "watch.h" diff --git a/main/fix-tuning.patch b/main/fix-tuning.patch index 0ad8582..003980d 100644 --- a/main/fix-tuning.patch +++ b/main/fix-tuning.patch @@ -1,5 +1,5 @@ diff --git a/movement/watch_faces/complication/tuning_tones_face.c b/movement/watch_faces/complication/tuning_tones_face.c -index a139427..4ab8dfe 100644 +index a139427..525b3eb 100644 --- a/movement/watch_faces/complication/tuning_tones_face.c +++ b/movement/watch_faces/complication/tuning_tones_face.c @@ -38,23 +38,23 @@ @@ -39,7 +39,7 @@ index a139427..4ab8dfe 100644 }; static size_t note_count = sizeof notes / sizeof *notes; -@@ -80,12 +80,22 @@ void tuning_tones_face_activate(movement_settings_t *settings, void *context) { +@@ -80,12 +80,21 @@ void tuning_tones_face_activate(movement_settings_t *settings, void *context) { (void) context; } @@ -60,11 +60,10 @@ index a139427..4ab8dfe 100644 watch_set_buzzer_off(); - watch_set_buzzer_period(NotePeriods[notes[state->note_ind].note]); - watch_set_buzzer_on(); -+ watch_disable_buzzer(); } } -@@ -110,11 +120,8 @@ bool tuning_tones_face_loop(movement_event_t event, movement_settings_t *setting +@@ -110,11 +119,8 @@ bool tuning_tones_face_loop(movement_event_t event, movement_settings_t *setting break; case EVENT_ALARM_BUTTON_DOWN: state->playing = !state->playing; @@ -78,7 +77,7 @@ index a139427..4ab8dfe 100644 case EVENT_ALARM_BUTTON_UP: break; case EVENT_TIMEOUT: -@@ -135,6 +142,6 @@ void tuning_tones_face_resign(movement_settings_t *settings, void *context) { +@@ -135,6 +141,6 @@ void tuning_tones_face_resign(movement_settings_t *settings, void *context) { if (state->playing) { state->playing = false; diff --git a/main/jmm.patch b/main/jmm.patch index 6cf4c0f..b5dd9a6 100644 --- a/main/jmm.patch +++ b/main/jmm.patch @@ -1,9 +1,9 @@ diff --git a/movement/alt_fw/jmm.h b/movement/alt_fw/jmm.h new file mode 100644 -index 0000000..e184f54 +index 0000000..0767298 --- /dev/null +++ b/movement/alt_fw/jmm.h -@@ -0,0 +1,30 @@ +@@ -0,0 +1,31 @@ +#ifndef MOVEMENT_CONFIG_H_ +#define MOVEMENT_CONFIG_H_ + @@ -21,6 +21,7 @@ index 0000000..e184f54 + sunrise_sunset_face, + day_night_percentage_face, + tuning_tones_face, ++ countdown_face, + decimal_time_face, + beats_face, + astronomy_face, diff --git a/main/series b/main/series index 83498bd..aeefff5 100644 --- a/main/series +++ b/main/series @@ -7,7 +7,10 @@ metric.patch siderial.patch moon.patch fix-tuning.patch +day-night-percent.patch +countdown-default-5min.patch #debug-compile.patch #set-time.patch #dont_set_time_if_no_debugger.patch +fix-emscripten.patch endstop |