Sensor Watch Simulator (#35)

* Put something on screen

* Use the 32bit watch_date_time repr to pass from JS

* Implement periodic callbacks

* Clear display on enabling

* Hook up watch_set_led_color() to SVG (green-only)

* Make debug output full-width

* Remove default Emscripten canvas

* Implement sleep and button clicks

* Fix time zone conversion bug in beats-time app

* Clean up warnings

* Fix pin levels

* Set time zone to browser value (if available)

* Add basic backup data saving

* Silence format specifier warnings in both targets

* Remove unnecessary, copied files

* Use RTC pointer to clear callbacks (if available)

* Use preprocessor define to avoid hardcoding MOVEMENT_NUM_FACES

* Change each face to const preprocessor definition

* Remove Intl.DateTimeFormat usage

* Update shell.html title, header

* Add touch start/end event handlers on SVG buttons

* Update shell.html

* Update folder structure (shared, simulator, hardware under watch-library)

* Tease out shared components from watch_slcd

* Clean up simulator watch_slcd.c inline JS calls

* Fix missing newlines at end of file

* Add simulator warnings (except format, unused-paremter)

* Implement remaining watch_rtc functions

* Fix button bug on mouse down then drag out

* Implement remaining watch_slcd functions

* Link keyboard events to buttons (for keys A, L, M)

* Rewrite event handling (mouse, touch, keyboard) in C

* Set explicit text UTF-8 charset in shell.html

* Address PR comments

* Remove unused directories from include paths
This commit is contained in:
Alexsander Akers
2022-01-25 15:03:22 -05:00
committed by GitHub
parent 9e24f6c336
commit b8de35658f
327 changed files with 2303 additions and 570 deletions

View File

@@ -45,7 +45,7 @@ bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void
state->next_subsecond_update = (event.subsecond + 1 + (BEAT_REFRESH_FREQUENCY * 2 / 3)) % BEAT_REFRESH_FREQUENCY;
state->last_centibeat_displayed = centibeats;
}
sprintf(buf, "bt %6ld", centibeats);
sprintf(buf, "bt %6lu", centibeats);
watch_display_string(buf, 0);
break;
@@ -53,7 +53,7 @@ bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void
if (!watch_tick_animation_is_running()) watch_start_tick_animation(432);
date_time = watch_rtc_get_date_time();
centibeats = clock2beats(date_time.unit.hour, date_time.unit.minute, date_time.unit.second, event.subsecond, movement_timezone_offsets[settings->bit.time_zone]);
sprintf(buf, "bt %4ld ", centibeats / 100);
sprintf(buf, "bt %4lu ", centibeats / 100);
watch_display_string(buf, 0);
break;

View File

@@ -14,12 +14,12 @@ void beats_face_activate(movement_settings_t *settings, void *context);
bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void beats_face_resign(movement_settings_t *settings, void *context);
static const watch_face_t beats_face = {
beats_face_setup,
beats_face_activate,
beats_face_loop,
beats_face_resign,
NULL
};
#define beats_face ((const watch_face_t){ \
beats_face_setup, \
beats_face_activate, \
beats_face_loop, \
beats_face_resign, \
NULL, \
})
#endif // BEATS_FACE_H_

View File

@@ -38,12 +38,12 @@ void blinky_face_activate(movement_settings_t *settings, void *context);
bool blinky_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void blinky_face_resign(movement_settings_t *settings, void *context);
static const watch_face_t blinky_face = {
blinky_face_setup,
blinky_face_activate,
blinky_face_loop,
blinky_face_resign,
NULL
};
#define blinky_face ((const watch_face_t){ \
blinky_face_setup, \
blinky_face_activate, \
blinky_face_loop, \
blinky_face_resign, \
NULL, \
})
#endif // BLINKY_FACE_H_
#endif // BLINKY_FACE_H_

View File

@@ -58,12 +58,12 @@ void countdown_face_activate(movement_settings_t *settings, void *context);
bool countdown_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void countdown_face_resign(movement_settings_t *settings, void *context);
static const watch_face_t countdown_face = {
countdown_face_setup,
countdown_face_activate,
countdown_face_loop,
countdown_face_resign,
NULL
};
#define countdown_face ((const watch_face_t){ \
countdown_face_setup, \
countdown_face_activate, \
countdown_face_loop, \
countdown_face_resign, \
NULL, \
})
#endif // COUNTDOWN_FACE_H_

View File

@@ -37,7 +37,7 @@ static void _day_one_face_update(day_one_state_t state) {
watch_date_time date_time = watch_rtc_get_date_time();
uint32_t julian_date = _day_one_face_juliandaynum(date_time.unit.year + WATCH_RTC_REFERENCE_YEAR, date_time.unit.month, date_time.unit.day);
uint32_t julian_birthdate = _day_one_face_juliandaynum(state.birth_year, state.birth_month, state.birth_day);
sprintf(buf, "DA %6ld", julian_date - julian_birthdate);
sprintf(buf, "DA %6lu", julian_date - julian_birthdate);
watch_display_string(buf, 0);
}

View File

@@ -44,12 +44,12 @@ void day_one_face_activate(movement_settings_t *settings, void *context);
bool day_one_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void day_one_face_resign(movement_settings_t *settings, void *context);
static const watch_face_t day_one_face = {
day_one_face_setup,
day_one_face_activate,
day_one_face_loop,
day_one_face_resign,
NULL
};
#define day_one_face ((const watch_face_t){ \
day_one_face_setup, \
day_one_face_activate, \
day_one_face_loop, \
day_one_face_resign, \
NULL, \
})
#endif // DAY_ONE_FACE_H_

View File

@@ -38,12 +38,12 @@ void pulsometer_face_activate(movement_settings_t *settings, void *context);
bool pulsometer_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void pulsometer_face_resign(movement_settings_t *settings, void *context);
static const watch_face_t pulsometer_face = {
pulsometer_face_setup,
pulsometer_face_activate,
pulsometer_face_loop,
pulsometer_face_resign,
NULL
};
#define pulsometer_face ((const watch_face_t){ \
pulsometer_face_setup, \
pulsometer_face_activate, \
pulsometer_face_loop, \
pulsometer_face_resign, \
NULL, \
})
#endif // PULSOMETER_FACE_H_
#endif // PULSOMETER_FACE_H_

View File

@@ -15,12 +15,12 @@ void stopwatch_face_activate(movement_settings_t *settings, void *context);
bool stopwatch_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void stopwatch_face_resign(movement_settings_t *settings, void *context);
static const watch_face_t stopwatch_face = {
stopwatch_face_setup,
stopwatch_face_activate,
stopwatch_face_loop,
stopwatch_face_resign,
NULL
};
#define stopwatch_face ((const watch_face_t){ \
stopwatch_face_setup, \
stopwatch_face_activate, \
stopwatch_face_loop, \
stopwatch_face_resign, \
NULL, \
})
#endif // STOPWATCH_FACE_H_
#endif // STOPWATCH_FACE_H_

View File

@@ -52,12 +52,12 @@ void sunrise_sunset_face_activate(movement_settings_t *settings, void *context);
bool sunrise_sunset_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void sunrise_sunset_face_resign(movement_settings_t *settings, void *context);
static const watch_face_t sunrise_sunset_face = {
sunrise_sunset_face_setup,
sunrise_sunset_face_activate,
sunrise_sunset_face_loop,
sunrise_sunset_face_resign,
NULL
};
#define sunrise_sunset_face ((const watch_face_t){ \
sunrise_sunset_face_setup, \
sunrise_sunset_face_activate, \
sunrise_sunset_face_loop, \
sunrise_sunset_face_resign, \
NULL, \
})
#endif // SUNRISE_SUNSET_FACE_H_

View File

@@ -15,12 +15,12 @@ void totp_face_activate(movement_settings_t *settings, void *context);
bool totp_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void totp_face_resign(movement_settings_t *settings, void *context);
static const watch_face_t totp_face = {
totp_face_setup,
totp_face_activate,
totp_face_loop,
totp_face_resign,
NULL
};
#define totp_face ((const watch_face_t){ \
totp_face_setup, \
totp_face_activate, \
totp_face_loop, \
totp_face_resign, \
NULL, \
})
#endif // TOTP_FACE_H_