set time: zone first, then date, then time
This commit is contained in:
parent
19376625d1
commit
3577e5b5b1
@ -30,7 +30,7 @@
|
||||
#include "zones.h"
|
||||
|
||||
#define SET_TIME_FACE_NUM_SETTINGS (7)
|
||||
const char set_time_face_titles[SET_TIME_FACE_NUM_SETTINGS][3] = {"HR", "M1", "SE", "YR", "MO", "DA", " "};
|
||||
const char set_time_face_titles[SET_TIME_FACE_NUM_SETTINGS][3] = {" ", "YR", "MO", "DA", "HR", "M1", "SE"};
|
||||
|
||||
static bool _quick_ticks_running;
|
||||
static int32_t current_offset;
|
||||
@ -39,30 +39,30 @@ static void _handle_alarm_button(watch_date_time_t date_time, uint8_t current_pa
|
||||
// handles short or long pressing of the alarm button
|
||||
|
||||
switch (current_page) {
|
||||
case 0: // hour
|
||||
date_time.unit.hour = (date_time.unit.hour + 1) % 24;
|
||||
break;
|
||||
case 1: // minute
|
||||
date_time.unit.minute = (date_time.unit.minute + 1) % 60;
|
||||
break;
|
||||
case 2: // second
|
||||
date_time.unit.second = 0;
|
||||
break;
|
||||
case 3: // year
|
||||
date_time.unit.year = ((date_time.unit.year % 60) + 1);
|
||||
break;
|
||||
case 4: // month
|
||||
date_time.unit.month = (date_time.unit.month % 12) + 1;
|
||||
break;
|
||||
case 5: { // day
|
||||
date_time.unit.day = date_time.unit.day + 1;
|
||||
break;
|
||||
}
|
||||
case 6: // time zone
|
||||
case 0: // time zone
|
||||
movement_set_timezone_index(movement_get_timezone_index() + 1);
|
||||
if (movement_get_timezone_index() >= NUM_ZONE_NAMES) movement_set_timezone_index(0);
|
||||
current_offset = movement_get_current_timezone_offset_for_zone(movement_get_timezone_index());
|
||||
break;
|
||||
case 1: // year
|
||||
date_time.unit.year = ((date_time.unit.year % 60) + 1);
|
||||
break;
|
||||
case 2: // month
|
||||
date_time.unit.month = (date_time.unit.month % 12) + 1;
|
||||
break;
|
||||
case 3: { // day
|
||||
date_time.unit.day = date_time.unit.day + 1;
|
||||
break;
|
||||
case 4: // hour
|
||||
date_time.unit.hour = (date_time.unit.hour + 1) % 24;
|
||||
break;
|
||||
case 5: // minute
|
||||
date_time.unit.minute = (date_time.unit.minute + 1) % 60;
|
||||
break;
|
||||
case 6: // second
|
||||
date_time.unit.second = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (date_time.unit.day > days_in_month(date_time.unit.month, date_time.unit.year + WATCH_RTC_REFERENCE_YEAR))
|
||||
date_time.unit.day = 1;
|
||||
@ -131,22 +131,7 @@ bool set_time_face_loop(movement_event_t event, void *context) {
|
||||
char buf[11];
|
||||
watch_display_text(WATCH_POSITION_TOP_LEFT, (char *) set_time_face_titles[current_page]);
|
||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, " ");
|
||||
if (current_page < 3) {
|
||||
watch_set_colon();
|
||||
if (movement_clock_mode_24h()) {
|
||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||
sprintf(buf, "%2d%02d%02d", date_time.unit.hour, date_time.unit.minute, date_time.unit.second);
|
||||
} else {
|
||||
sprintf(buf, "%2d%02d%02d", (date_time.unit.hour % 12) ? (date_time.unit.hour % 12) : 12, date_time.unit.minute, date_time.unit.second);
|
||||
if (date_time.unit.hour < 12) watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||
else watch_set_indicator(WATCH_INDICATOR_PM);
|
||||
}
|
||||
} else if (current_page < 6) {
|
||||
watch_clear_colon();
|
||||
watch_clear_indicator(WATCH_INDICATOR_24H);
|
||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||
sprintf(buf, "%2d%02d%02d", date_time.unit.year + 20, date_time.unit.month, date_time.unit.day);
|
||||
} else {
|
||||
if (current_page < 1) {
|
||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, " Z");
|
||||
if (current_offset < 0) watch_display_text(WATCH_POSITION_TOP_LEFT, "- ");
|
||||
else watch_display_text(WATCH_POSITION_TOP_LEFT, "* ");
|
||||
@ -160,6 +145,21 @@ bool set_time_face_loop(movement_event_t event, void *context) {
|
||||
sprintf(buf, "%s", (char *) (3 + zone_names + 11 * movement_get_timezone_index()));
|
||||
watch_clear_colon();
|
||||
}
|
||||
} else if (current_page < 4) {
|
||||
watch_clear_colon();
|
||||
watch_clear_indicator(WATCH_INDICATOR_24H);
|
||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||
sprintf(buf, "%2d%02d%02d", date_time.unit.year + 20, date_time.unit.month, date_time.unit.day);
|
||||
} else {
|
||||
watch_set_colon();
|
||||
if (movement_clock_mode_24h()) {
|
||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||
sprintf(buf, "%2d%02d%02d", date_time.unit.hour, date_time.unit.minute, date_time.unit.second);
|
||||
} else {
|
||||
sprintf(buf, "%2d%02d%02d", (date_time.unit.hour % 12) ? (date_time.unit.hour % 12) : 12, date_time.unit.minute, date_time.unit.second);
|
||||
if (date_time.unit.hour < 12) watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||
else watch_set_indicator(WATCH_INDICATOR_PM);
|
||||
}
|
||||
}
|
||||
|
||||
watch_display_text(WATCH_POSITION_BOTTOM, buf);
|
||||
@ -167,16 +167,16 @@ bool set_time_face_loop(movement_event_t event, void *context) {
|
||||
// blink up the parameter we're setting
|
||||
if (event.subsecond % 2 && !_quick_ticks_running) {
|
||||
switch (current_page) {
|
||||
case 0:
|
||||
case 3:
|
||||
watch_display_text(WATCH_POSITION_HOURS, " ");
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
watch_display_text(WATCH_POSITION_MINUTES, " ");
|
||||
watch_display_text(WATCH_POSITION_HOURS, " ");
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
watch_display_text(WATCH_POSITION_MINUTES, " ");
|
||||
break;
|
||||
case 3:
|
||||
case 6:
|
||||
watch_display_text(WATCH_POSITION_SECONDS, " ");
|
||||
break;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user