Fix all days in a month

This commit is contained in:
Christian Buschau 2024-08-03 12:22:15 +02:00
parent e732afbec6
commit db165bec30
No known key found for this signature in database
GPG key ID: 74B8EC7053894AC4
4 changed files with 4 additions and 4 deletions

View file

@ -27,7 +27,7 @@
#include "day_one_face.h" #include "day_one_face.h"
#include "watch.h" #include "watch.h"
static const uint8_t days_in_month[12] = {31, 29, 31, 30, 31, 30, 30, 31, 30, 31, 30, 31}; static const uint8_t days_in_month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
static uint32_t _day_one_face_juliandaynum(uint16_t year, uint16_t month, uint16_t day) { static uint32_t _day_one_face_juliandaynum(uint16_t year, uint16_t month, uint16_t day) {
// from here: https://en.wikipedia.org/wiki/Julian_day#Julian_day_number_calculation // from here: https://en.wikipedia.org/wiki/Julian_day#Julian_day_number_calculation

View file

@ -158,7 +158,7 @@ static void _draw(time_left_state_t *state, uint8_t subsecond) {
/// @brief handle short or long pressing the alarm button /// @brief handle short or long pressing the alarm button
static void _handle_alarm_button(time_left_state_t *state) { static void _handle_alarm_button(time_left_state_t *state) {
const uint8_t days_in_month[12] = {31, 28, 31, 30, 31, 30, 30, 31, 30, 31, 30, 31}; const uint8_t days_in_month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
uint32_t tmp_day; uint32_t tmp_day;
switch (state->current_page) { switch (state->current_page) {
case TIME_LEFT_FACE_SETTINGS_STATE: // birth year case TIME_LEFT_FACE_SETTINGS_STATE: // birth year

View file

@ -33,7 +33,7 @@ static bool _quick_ticks_running;
static void _handle_alarm_button(movement_settings_t *settings, watch_date_time date_time, uint8_t current_page) { static void _handle_alarm_button(movement_settings_t *settings, watch_date_time date_time, uint8_t current_page) {
// handles short or long pressing of the alarm button // handles short or long pressing of the alarm button
const uint8_t days_in_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; const uint8_t days_in_month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
switch (current_page) { switch (current_page) {
case 0: // hour case 0: // hour

View file

@ -47,7 +47,7 @@ void set_time_hackwatch_face_activate(movement_settings_t *settings, void *conte
bool set_time_hackwatch_face_loop(movement_event_t event, movement_settings_t *settings, void *context) { bool set_time_hackwatch_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
uint8_t current_page = *((uint8_t *)context); uint8_t current_page = *((uint8_t *)context);
const uint8_t days_in_month[12] = {31, 28, 31, 30, 31, 30, 30, 31, 30, 31, 30, 31}; const uint8_t days_in_month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if (event.subsecond == 15) // Delay displayed time update by ~0.5 seconds, to align phase exactly to main clock at 1Hz if (event.subsecond == 15) // Delay displayed time update by ~0.5 seconds, to align phase exactly to main clock at 1Hz
date_time_settings = watch_rtc_get_date_time(); date_time_settings = watch_rtc_get_date_time();