Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24h default option #374

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions make.mk
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,7 @@ endif
ifeq ($(BOARD), OSO-FEAL-A1-00)
CFLAGS += -DCRYSTALLESS
endif

ifdef MOVEMENT_CLOCK_MODE_DEFAULT_24H
CFLAGS += -DMOVEMENT_CLOCK_MODE_DEFAULT_24H
endif
31 changes: 30 additions & 1 deletion movement/movement.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
/* SPDX-License-Identifier: MIT */

/*
* MIT License
*
* Copyright (c) 2022 Joey Castillo
* Copyright © 2021-2023 Joey Castillo <[email protected]> <[email protected]>
* Copyright © 2022-2023 TheOnePerson <[email protected]>
* Copyright © 2022 Alexsander Akers <[email protected]>
* Copyright © 2022 James Haggerty <[email protected]>
* Copyright © 2022 Niclas Hoyer <[email protected]>
* Copyright © 2022 Wesley Ellis <[email protected]>
* Copyright © 2023 Wesley Aptekar-Cassels <[email protected]>
* Copyright © 2023 Alex Maestas <[email protected]>
* Copyright © 2023 Jeremy O'Brien <[email protected]>
* Copyright © 2023 Mikhail Svarichevsky <[email protected]>
* Copyright © 2024 Alex Maestas <[email protected]>
* Copyright © 2024 Christian Buschau <[email protected]>
* Copyright © 2024 Max Zettlmeißl <[email protected]>
* Copyright © 2024 Wesley Aptekar-Cassels <[email protected]>
* Copyright © 2024 Matheus Afonso Martins Moreira <[email protected]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -61,6 +77,11 @@
#define MOVEMENT_SECONDARY_FACE_INDEX 0
#endif

// Default to 12h clock mode unless configured otherwise.
#ifndef MOVEMENT_CLOCK_MODE_DEFAULT_24H
#define MOVEMENT_CLOCK_MODE_DEFAULT_24H 0
#endif

// Set default LED colors if not set
#ifndef MOVEMENT_DEFAULT_RED_COLOR
#define MOVEMENT_DEFAULT_RED_COLOR 0x0
Expand Down Expand Up @@ -135,6 +156,12 @@ void cb_alarm_fired(void);
void cb_fast_tick(void);
void cb_tick(void);

static inline void movement_default_to_24h_mode_if_configured(void) {
if (MOVEMENT_CLOCK_MODE_DEFAULT_24H) {
movement_state.settings.bit.clock_mode_24h = true;
}
}

static inline void _movement_reset_inactivity_countdown(void) {
movement_state.le_mode_ticks = movement_le_inactivity_deadlines[movement_state.settings.bit.le_interval];
movement_state.timeout_ticks = movement_timeout_inactivity_deadlines[movement_state.settings.bit.to_interval];
Expand Down Expand Up @@ -361,6 +388,8 @@ void app_init(void) {
movement_state.next_available_backup_register = 4;
_movement_reset_inactivity_countdown();

movement_default_to_24h_mode_if_configured();

filesystem_init();

#if __EMSCRIPTEN__
Expand Down