Compare commits
7 Commits
2dfe165f22
...
legacy
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe5898e7ee | ||
|
|
5a3a99bb36 | ||
|
|
b98a2a0870 | ||
|
|
aeeb62eefd | ||
|
|
f1e78b5b4b | ||
|
|
0b58ac750e | ||
|
|
45583b3120 |
@@ -33,20 +33,20 @@ const char *words[12] = {
|
||||
" ",
|
||||
" 5",
|
||||
"10",
|
||||
"15",
|
||||
"CU",
|
||||
"20",
|
||||
"25",
|
||||
"30",
|
||||
"35",
|
||||
"Me",
|
||||
"ME",
|
||||
"mE",
|
||||
"40",
|
||||
"45",
|
||||
"50",
|
||||
"55",
|
||||
};
|
||||
|
||||
static const char *past_word = " P";
|
||||
static const char *to_word = " 2";
|
||||
static const char *oclock_word = "OC";
|
||||
static const char *past_word = " y";
|
||||
static const char *to_word = " -";
|
||||
static const char *oclock_word = "EP";
|
||||
|
||||
// sets when in the five minute period we switch
|
||||
// from "X past HH" to "X to HH+1"
|
||||
@@ -55,9 +55,9 @@ static const int hour_switch_index = 8;
|
||||
static void _update_alarm_indicator(bool settings_alarm_enabled, close_enough_clock_state_t *state) {
|
||||
state->alarm_enabled = settings_alarm_enabled;
|
||||
if (state->alarm_enabled) {
|
||||
watch_set_indicator(WATCH_INDICATOR_BELL);
|
||||
watch_set_indicator(WATCH_INDICATOR_SIGNAL);
|
||||
} else {
|
||||
watch_clear_indicator(WATCH_INDICATOR_BELL);
|
||||
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ bool close_enough_clock_face_loop(movement_event_t event, movement_settings_t *s
|
||||
int words_length = sizeof(words) / sizeof(words[0]);
|
||||
|
||||
strncpy(
|
||||
first_word,
|
||||
third_word,
|
||||
five_minute_period >= hour_switch_index ?
|
||||
words[words_length - five_minute_period] :
|
||||
words[five_minute_period],
|
||||
@@ -197,7 +197,7 @@ bool close_enough_clock_face_loop(movement_event_t event, movement_settings_t *s
|
||||
to_word : past_word,
|
||||
3
|
||||
);
|
||||
sprintf(third_word, "%2d", close_enough_hour);
|
||||
sprintf(first_word, "%2d", close_enough_hour);
|
||||
}
|
||||
|
||||
sprintf(
|
||||
|
||||
@@ -148,7 +148,7 @@ static void _alarm_update_alarm_enabled(movement_settings_t *settings, alarm_sta
|
||||
uint16_t now_minutes_of_day;
|
||||
uint16_t alarm_minutes_of_day;
|
||||
for (uint8_t i = 0; i < ALARM_ALARMS; i++) {
|
||||
if (state->alarm[i].enabled) {
|
||||
if (state->alarm[i].enabled && state->alarm[i].beeps != 0) {
|
||||
// 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) {
|
||||
active_alarms = true;
|
||||
@@ -235,7 +235,6 @@ void alarm_face_resign(movement_settings_t *settings, void *context) {
|
||||
alarm_state_t *state = (alarm_state_t *)context;
|
||||
state->is_setting = false;
|
||||
_alarm_update_alarm_enabled(settings, state);
|
||||
watch_set_led_off();
|
||||
state->alarm_quick_ticks = false;
|
||||
_wait_ticks = -1;
|
||||
movement_request_tick_frequency(1);
|
||||
|
||||
@@ -43,6 +43,15 @@ static void _moonrise_face_update(movement_settings_t *settings, moonrise_state_
|
||||
char buf[11];
|
||||
movement_location_t movement_location;
|
||||
|
||||
watch_clear_colon();
|
||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||
watch_clear_indicator(WATCH_INDICATOR_24H);
|
||||
// watch_display_string("__ _ ", 0);
|
||||
if(state->rise_index == 0)
|
||||
watch_display_string("M~ rise", 0);
|
||||
else
|
||||
watch_display_string("M_ set ", 0);
|
||||
|
||||
if (state->longLatToUse == 0 || _location_count <= 1)
|
||||
movement_location = (movement_location_t) watch_get_backup_data(1);
|
||||
else{
|
||||
@@ -60,8 +69,13 @@ static void _moonrise_face_update(movement_settings_t *settings, moonrise_state_
|
||||
watch_date_time scratch_time; // scratchpad, contains different values at different times
|
||||
scratch_time.reg = date_time.reg;
|
||||
|
||||
double lat = (double)movement_location.bit.latitude / 100.0;
|
||||
double lon = (double)movement_location.bit.longitude / 100.0;
|
||||
// Weird quirky unsigned things were happening when I tried to cast these directly to doubles below.
|
||||
// it looks redundant, but extracting them to local int16's seemed to fix it.
|
||||
int16_t lat_centi = (int16_t)movement_location.bit.latitude;
|
||||
int16_t lon_centi = (int16_t)movement_location.bit.longitude;
|
||||
|
||||
double lat = (double)lat_centi / 100.0;
|
||||
double lon = (double)lon_centi / 100.0;
|
||||
|
||||
uint32_t t = watch_utility_date_time_to_unix_time(date_time, movement_timezone_offsets[settings->bit.time_zone] * 60);
|
||||
MoonRise mr = MoonRise_calculate(lat, lon, t);
|
||||
@@ -78,6 +92,9 @@ static void _moonrise_face_update(movement_settings_t *settings, moonrise_state_
|
||||
watch_clear_indicator(WATCH_INDICATOR_24H);
|
||||
snprintf(buf, sizeof(buf), "%s%2d none ", state->rise_index ? "M_" : "M~", scratch_time.unit.day);
|
||||
watch_display_string(buf, 0);
|
||||
state->rise_set_expires = watch_utility_date_time_from_unix_time(
|
||||
watch_utility_offset_timestamp(t, MR_WINDOW, 0, 0),
|
||||
movement_timezone_offsets[settings->bit.time_zone] * 60);
|
||||
return;
|
||||
}
|
||||
watch_set_colon();
|
||||
|
||||
@@ -330,6 +330,5 @@ bool simon_face_loop(movement_event_t event, movement_settings_t *settings,
|
||||
void simon_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void)settings;
|
||||
(void)context;
|
||||
watch_set_led_off();
|
||||
watch_set_buzzer_off();
|
||||
}
|
||||
|
||||
@@ -60,10 +60,6 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
|
||||
case EVENT_ACTIVATE:
|
||||
// Do nothing; handled below.
|
||||
break;
|
||||
case EVENT_MODE_BUTTON_UP:
|
||||
watch_set_led_off();
|
||||
movement_move_to_next_face();
|
||||
return false;
|
||||
case EVENT_LIGHT_BUTTON_DOWN:
|
||||
current_page = (current_page + 1) % PREFERENCES_FACE_NUM_PREFERENCES;
|
||||
*((uint8_t *)context) = current_page;
|
||||
@@ -202,7 +198,6 @@ bool preferences_face_loop(movement_event_t event, movement_settings_t *settings
|
||||
return false;
|
||||
}
|
||||
|
||||
watch_set_led_off();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -183,6 +183,5 @@ bool set_time_face_loop(movement_event_t event, movement_settings_t *settings, v
|
||||
void set_time_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
(void) context;
|
||||
watch_set_led_off();
|
||||
watch_store_backup_data(settings->reg, 0);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "watch_utility.h"
|
||||
|
||||
const char * watch_utility_get_weekday(watch_date_time date_time) {
|
||||
static const char weekdays[7][3] = {"MO", "TU", "WE", "TH", "FR", "SA", "SU"};
|
||||
static const char weekdays[7][3] = {"LU", "MA", "MI", "JU", "VI", "SA", "do"};
|
||||
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];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user