Compare commits

..

No commits in common. "main" and "moonrise" have entirely different histories.

12 changed files with 59 additions and 54 deletions

View File

@ -25,6 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "wyoscan_face.h" #include "wyoscan_face.h"
#include "watch_private_display.h"
/* /*
Slowly render the current time from left to right, Slowly render the current time from left to right,
@ -114,7 +115,7 @@ bool wyoscan_face_loop(movement_event_t event, void *context) {
break; break;
case EVENT_TICK: case EVENT_TICK:
if (!state->animate) { if (!state->animate) {
date_time = movement_get_local_date_time(); date_time = watch_rtc_get_date_time();
state->start = 0; state->start = 0;
state->end = 0; state->end = 0;
state->animation = 0; state->animation = 0;

View File

@ -79,5 +79,4 @@
#include "higher_lower_game_face.h" #include "higher_lower_game_face.h"
#include "lander_face.h" #include "lander_face.h"
#include "simon_face.h" #include "simon_face.h"
#include "wyoscan_face.h"
// New includes go above this line. // New includes go above this line.

View File

@ -54,5 +54,4 @@ SRCS += \
./watch-faces/complication/higher_lower_game_face.c \ ./watch-faces/complication/higher_lower_game_face.c \
./watch-faces/complication/lander_face.c \ ./watch-faces/complication/lander_face.c \
./watch-faces/complication/simon_face.c \ ./watch-faces/complication/simon_face.c \
./watch-faces/clock/wyoscan_face.c \
# New watch faces go above this line. # New watch faces go above this line.

View File

@ -40,20 +40,20 @@ static const char *words[12] = {
" ", " ",
" 5", " 5",
"10", "10",
"CU", "15",
"20", "20",
"Me", "25",
"ME", "30",
"mE", "35",
"40", "40",
"45", "45",
"50", "50",
"55", "55",
}; };
static const char *past_word = " y"; static const char *past_word = " P";
static const char *to_word = " -"; static const char *to_word = " 2";
static const char *oclock_word = "EP"; static const char *oclock_word = "OC";
// sets when in the five minute period we switch // sets when in the five minute period we switch
// from "X past HH" to "X to HH+1" // from "X past HH" to "X to HH+1"
@ -87,7 +87,7 @@ void close_enough_face_activate(void *context) {
clock_stop_tick_tock_animation(); clock_stop_tick_tock_animation();
clock_indicate(WATCH_INDICATOR_SIGNAL, movement_alarm_enabled()); clock_indicate(WATCH_INDICATOR_BELL, movement_alarm_enabled());
clock_indicate(WATCH_INDICATOR_24H, !!movement_clock_mode_24h()); clock_indicate(WATCH_INDICATOR_24H, !!movement_clock_mode_24h());
// this ensures that none of the five_minute_periods will match, so we always rerender when the face activates // this ensures that none of the five_minute_periods will match, so we always rerender when the face activates
@ -189,14 +189,14 @@ bool close_enough_face_loop(movement_event_t event, void *context) {
char second_word[3]; char second_word[3];
char third_word[3]; char third_word[3];
if (five_minute_period == 0) { // " HH OC", if (five_minute_period == 0) { // " HH OC",
sprintf(first_word, "%2d", close_enough_hour); sprintf(first_word, " ");
sprintf(second_word, " "); sprintf(second_word, "%2d", close_enough_hour);
strncpy(third_word, oclock_word, 3); strncpy(third_word, oclock_word, 3);
} else { // "MM P HH" or "MM 2 HH+1" } else { // "MM P HH" or "MM 2 HH+1"
int words_length = sizeof(words) / sizeof(words[0]); int words_length = sizeof(words) / sizeof(words[0]);
strncpy( strncpy(
third_word, first_word,
show_next_hour ? show_next_hour ?
words[words_length - five_minute_period] : words[words_length - five_minute_period] :
words[five_minute_period], words[five_minute_period],
@ -207,7 +207,7 @@ bool close_enough_face_loop(movement_event_t event, void *context) {
show_next_hour ? to_word : past_word, show_next_hour ? to_word : past_word,
3 3
); );
sprintf(first_word, "%2d", close_enough_hour); sprintf(third_word, "%2d", close_enough_hour);
} }
watch_display_text_with_fallback( watch_display_text_with_fallback(

View File

@ -169,7 +169,7 @@ static void _alarm_update_alarm_enabled(alarm_state_t *state) {
uint16_t now_minutes_of_day; uint16_t now_minutes_of_day;
uint16_t alarm_minutes_of_day; uint16_t alarm_minutes_of_day;
for (uint8_t i = 0; i < ALARM_ALARMS; i++) { for (uint8_t i = 0; i < ALARM_ALARMS; i++) {
if (state->alarm[i].enabled && state->alarm[i].beeps != 0) { if (state->alarm[i].enabled) {
// figure out if alarm is to go off in the next 24 h // figure out if alarm is to go off in the next 24 h
if (state->alarm[i].day == ALARM_DAY_EACH_DAY || state->alarm[i].day == ALARM_DAY_ONE_TIME) { if (state->alarm[i].day == ALARM_DAY_EACH_DAY || state->alarm[i].day == ALARM_DAY_ONE_TIME) {
active_alarms = true; active_alarms = true;
@ -263,6 +263,7 @@ void advanced_alarm_face_resign(void *context) {
alarm_state_t *state = (alarm_state_t *)context; alarm_state_t *state = (alarm_state_t *)context;
state->is_setting = false; state->is_setting = false;
_alarm_update_alarm_enabled(state); _alarm_update_alarm_enabled(state);
watch_set_led_off();
state->alarm_quick_ticks = false; state->alarm_quick_ticks = false;
_wait_ticks = -1; _wait_ticks = -1;
movement_request_tick_frequency(1); movement_request_tick_frequency(1);

View File

@ -72,41 +72,41 @@ static void _update(moon_phase_state_t *state, uint32_t offset) {
switch (phase_index) { switch (phase_index) {
case 0: case 0:
case 8: case 8:
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "NE!J ", " NUEVA"); watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "NE!J ", " Neu ");
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, " ", " "); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, " ", " ");
break; break;
case 1: case 1:
watch_display_text(WATCH_POSITION_BOTTOM, "Crecie"); watch_display_text(WATCH_POSITION_BOTTOM, "CresNt");
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAX", " "); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAX", " ");
if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) { if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) {
watch_set_pixel(0, 14); watch_set_pixel(2, 13);
watch_set_pixel(0, 13); watch_set_pixel(2, 15);
if (currentfrac > 0.125) watch_set_pixel(2, 14); if (currentfrac > 0.125) watch_set_pixel(1, 13);
} }
break; break;
case 2: case 2:
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "1stQtr", "4#Crec"); watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "1stQtr", " 1st q");
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAX", " "); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAX", " ");
if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) { if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) {
watch_set_pixel(2, 13);
watch_set_pixel(2, 15);
watch_set_pixel(1, 13);
watch_set_pixel(1, 14); watch_set_pixel(1, 14);
watch_set_pixel(2, 14);
watch_set_pixel(0, 14);
watch_set_pixel(0, 13);
} }
break; break;
case 3: case 3:
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "GbboUs", " GibCr"); watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "GbboUs", " Gibb ");
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAX", " "); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAX", " ");
if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) { if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) {
watch_set_pixel(2, 13);
watch_set_pixel(2, 15);
watch_set_pixel(1, 14); watch_set_pixel(1, 14);
watch_set_pixel(2, 14); watch_set_pixel(1, 13);
watch_set_pixel(1, 15); watch_set_pixel(1, 15);
watch_set_pixel(0, 14);
watch_set_pixel(0, 13);
} }
break; break;
case 4: case 4:
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "FULL ", "LLENA "); watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "FULL ", " FULL ");
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, " ", " "); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, " ", " ");
if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) { if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) {
watch_set_pixel(2, 13); watch_set_pixel(2, 13);
@ -120,33 +120,33 @@ static void _update(moon_phase_state_t *state, uint32_t offset) {
} }
break; break;
case 5: case 5:
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "GbboUs", " GibMe"); watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "GbboUs", " Gibb ");
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAN", " "); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAN", " ");
if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) { if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) {
watch_set_pixel(2, 13);
watch_set_pixel(2, 15);
watch_set_pixel(1, 14); watch_set_pixel(1, 14);
watch_set_pixel(1, 13); watch_set_pixel(2, 14);
watch_set_pixel(1, 15); watch_set_pixel(1, 15);
watch_set_pixel(0, 14);
watch_set_pixel(0, 13);
} }
break; break;
case 6: case 6:
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "3rdQtr", "4#meng"); watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "3rdQtr", " 3rd q");
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAN", " "); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAN", " ");
if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) { if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) {
watch_set_pixel(2, 13);
watch_set_pixel(2, 15);
watch_set_pixel(1, 13);
watch_set_pixel(1, 14); watch_set_pixel(1, 14);
watch_set_pixel(2, 14);
watch_set_pixel(0, 14);
watch_set_pixel(0, 13);
} }
break; break;
case 7: case 7:
watch_display_text(WATCH_POSITION_BOTTOM, "MENGUA"); watch_display_text(WATCH_POSITION_BOTTOM, "CresNt");
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAN", " "); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "WAN", " ");
if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) { if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) {
watch_set_pixel(2, 13); watch_set_pixel(0, 14);
watch_set_pixel(2, 15); watch_set_pixel(0, 13);
if (currentfrac < 0.875) watch_set_pixel(1, 13); if (currentfrac < 0.875) watch_set_pixel(2, 14);
} }
break; break;
} }

View File

@ -331,5 +331,6 @@ bool simon_face_loop(movement_event_t event,
void simon_face_resign(void *context) { void simon_face_resign(void *context) {
(void)context; (void)context;
watch_set_led_off();
watch_set_buzzer_off(); watch_set_buzzer_off();
} }

View File

@ -108,7 +108,7 @@ static void _sunrise_sunset_face_update(sunrise_sunset_state_t *state) {
watch_clear_indicator(WATCH_INDICATOR_24H); watch_clear_indicator(WATCH_INDICATOR_24H);
if (result == 1) watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "SET", "SE"); if (result == 1) watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "SET", "SE");
else watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "RIS", "rI"); else watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "RIS", "rI");
snprintf(buf, sizeof(buf), "%2d", scratch_time.unit.day); sprintf(buf, "%2d", scratch_time.unit.day);
watch_display_text(WATCH_POSITION_TOP_RIGHT, buf); watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
watch_display_text(WATCH_POSITION_BOTTOM, "None "); watch_display_text(WATCH_POSITION_BOTTOM, "None ");
return; return;
@ -149,9 +149,9 @@ static void _sunrise_sunset_face_update(sunrise_sunset_state_t *state) {
else watch_clear_indicator(WATCH_INDICATOR_PM); else watch_clear_indicator(WATCH_INDICATOR_PM);
} }
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "RIS", "rI"); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "RIS", "rI");
snprintf(buf, sizeof(buf), "%2d", scratch_time.unit.day); sprintf(buf, "%2d", scratch_time.unit.day);
watch_display_text(WATCH_POSITION_TOP_RIGHT, buf); watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
snprintf(buf, sizeof(buf), "%2d%02d%2s", scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name); sprintf(buf, "%2d%02d%2s", scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
watch_display_text(WATCH_POSITION_BOTTOM, buf); watch_display_text(WATCH_POSITION_BOTTOM, buf);
return; return;
} else { } else {
@ -188,9 +188,9 @@ static void _sunrise_sunset_face_update(sunrise_sunset_state_t *state) {
else watch_clear_indicator(WATCH_INDICATOR_PM); else watch_clear_indicator(WATCH_INDICATOR_PM);
} }
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "SET", "SE"); watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "SET", "SE");
snprintf(buf, sizeof(buf), "%2d", scratch_time.unit.day); sprintf(buf, "%2d", scratch_time.unit.day);
watch_display_text(WATCH_POSITION_TOP_RIGHT, buf); watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
snprintf(buf, sizeof(buf), "%2d%02d%2s", scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name); sprintf(buf, "%2d%02d%2s", scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
watch_display_text(WATCH_POSITION_BOTTOM, buf); watch_display_text(WATCH_POSITION_BOTTOM, buf);
return; return;
} else { } else {
@ -274,7 +274,7 @@ static void _sunrise_sunset_face_update_settings_display(movement_event_t event,
if (state->active_digit == 4) watch_display_character(' ', 9); if (state->active_digit == 4) watch_display_character(' ', 9);
} }
} else { } else {
snprintf(buf, sizeof(buf), "%c %04d", state->working_latitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_latitude))); sprintf(buf, "%c %04d", state->working_latitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_latitude)));
if (event.subsecond % 2) buf[state->active_digit] = ' '; if (event.subsecond % 2) buf[state->active_digit] = ' ';
watch_display_text(WATCH_POSITION_BOTTOM, buf); watch_display_text(WATCH_POSITION_BOTTOM, buf);
} }
@ -301,7 +301,7 @@ static void _sunrise_sunset_face_update_settings_display(movement_event_t event,
if (state->active_digit == 4) watch_display_character(' ', 9); if (state->active_digit == 4) watch_display_character(' ', 9);
} }
} else { } else {
snprintf(buf, sizeof(buf), "%c%05d", state->working_longitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_longitude))); sprintf(buf, "%c%05d", state->working_longitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_longitude)));
if (event.subsecond % 2) buf[state->active_digit] = ' '; if (event.subsecond % 2) buf[state->active_digit] = ' ';
watch_display_text(WATCH_POSITION_BOTTOM, buf); watch_display_text(WATCH_POSITION_BOTTOM, buf);
} }

View File

@ -187,5 +187,6 @@ bool set_time_face_loop(movement_event_t event, void *context) {
void set_time_face_resign(void *context) { void set_time_face_resign(void *context) {
(void) context; (void) context;
watch_set_led_off();
movement_store_settings(); movement_store_settings();
} }

View File

@ -311,9 +311,6 @@ bool settings_face_loop(movement_event_t event, void *context) {
settings_state_t *state = (settings_state_t *)context; settings_state_t *state = (settings_state_t *)context;
switch (event.event_type) { switch (event.event_type) {
case EVENT_LIGHT_LONG_PRESS:
movement_illuminate_led();
break;
case EVENT_LIGHT_BUTTON_DOWN: case EVENT_LIGHT_BUTTON_DOWN:
state->current_page = (state->current_page + 1) % state->num_settings; state->current_page = (state->current_page + 1) % state->num_settings;
// fall through // fall through
@ -322,6 +319,10 @@ bool settings_face_loop(movement_event_t event, void *context) {
watch_clear_display(); watch_clear_display();
state->settings_screens[state->current_page].display(event.subsecond); state->settings_screens[state->current_page].display(event.subsecond);
break; break;
case EVENT_MODE_BUTTON_UP:
movement_force_led_off();
movement_move_to_next_face();
return false;
case EVENT_ALARM_BUTTON_UP: case EVENT_ALARM_BUTTON_UP:
state->settings_screens[state->current_page].advance(); state->settings_screens[state->current_page].advance();
break; break;
@ -340,11 +341,13 @@ bool settings_face_loop(movement_event_t event, void *context) {
color.blue | color.blue << 4); color.blue | color.blue << 4);
return false; return false;
} else { } else {
movement_force_led_off();
return true; return true;
} }
} }
void settings_face_resign(void *context) { void settings_face_resign(void *context) {
(void) context; (void) context;
movement_force_led_off();
movement_store_settings(); movement_store_settings();
} }

View File

@ -28,12 +28,12 @@
#include "zones.h" #include "zones.h"
const char * watch_utility_get_weekday(watch_date_time_t date_time) { const char * watch_utility_get_weekday(watch_date_time_t date_time) {
static const char weekdays[7][3] = {"LU", "MA", "MI", "JU", "VI", "SA", "do"}; static const char weekdays[7][3] = {"MO", "TU", "WE", "TH", "FR", "SA", "SU"};
return weekdays[watch_utility_get_iso8601_weekday_number(date_time.unit.year + WATCH_RTC_REFERENCE_YEAR, date_time.unit.month, date_time.unit.day) - 1]; return weekdays[watch_utility_get_iso8601_weekday_number(date_time.unit.year + WATCH_RTC_REFERENCE_YEAR, date_time.unit.month, date_time.unit.day) - 1];
} }
const char * watch_utility_get_long_weekday(watch_date_time_t date_time) { const char * watch_utility_get_long_weekday(watch_date_time_t date_time) {
static const char weekdays[7][4] = {"LUN", "MAR", "MIE", "JUE", "VIE", "SAB", "DOM"}; static const char weekdays[7][4] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
return weekdays[watch_utility_get_iso8601_weekday_number(date_time.unit.year + WATCH_RTC_REFERENCE_YEAR, date_time.unit.month, date_time.unit.day) - 1]; return weekdays[watch_utility_get_iso8601_weekday_number(date_time.unit.year + WATCH_RTC_REFERENCE_YEAR, date_time.unit.month, date_time.unit.day) - 1];
} }