Commit Graph
19 Commits
Author SHA1 Message Date
Konrad Rieck 0557684ec1 Return to clock mode on inactivity timeout in settings
_settings_loop() never handled EVENT_TIMEOUT, so leaving the watch
face parked in settings mode (4Hz tick, blinking abbreviation) with
no button presses meant it stayed there indefinitely instead of
returning to the clock display like every other face's settings mode
does on timeout.

Factor the existing EVENT_MODE_BUTTON_UP transition logic into
_exit_settings_mode() and reuse it for EVENT_TIMEOUT.
2026-07-27 22:34:04 +02:00
Konrad Rieck cd18c95779 Port of world_clock2 to second movement.
Improvements:

- The name of the time zone is displayed for a brief movement when cycling through the selected time zones.

- The face now comes with pre-selected zones to show-case its functionality: Seattle, New York, UTC, Shanghai, and Tokyo.
2026-07-27 22:33:06 +02:00
Konrad Rieck bf25776a66 Fix wrong format specifier for axis label
_monitor_display() used %C (wide character, expects wint_t) instead
of %c (plain char/int) to print the X/Y/Z axis label. Every other
single-character display in the codebase uses %c; on the embedded
build, without wide-char support in the C library, %C is not a
valid conversion for the char actually being passed.
2026-07-27 22:12:22 +02:00
Konrad Rieck c742e92e7f Fix memory leak in lis2dw_monitor_face settings array
state->settings was malloc'd in lis2dw_monitor_face_setup() outside
the guard that only runs on first allocation of the face's context.
setup() is called again every time the watch wakes from deep sleep
(movement.c's app_setup() re-runs watch_faces[i].setup() for every
face on wake), so each wake cycle allocated a new settings array and
abandoned the previous pointer with no matching free.

Since NUM_SETTINGS is a compile-time constant, make settings a
fixed-size array embedded directly in lis2dw_monitor_state_t instead
of a separately malloc'd pointer, so it's allocated exactly once
along with the rest of the state and never leaks.
2026-07-27 22:11:52 +02:00
Konrad Rieck 705e4be13a Hydration watch face
This watch face monitors daily hydration by tracking and logging water intake.

In tracking mode: Display current water intake and percentage
- Alarm button: +100ml (or configured glass size)
- Light button: -100ml (or configured glass size)
- Alarm long press: Display deviation from estimate
- Light long press: Switch to settings mode
- Alarm really long press: Switch to log mode

In settings mode: Configure glass size, daily goal, wake time, sleep time, alert interval
- Light button: Switch to next setting
- Alarm button: Advance current setting
- Alarm long press: Reset to default value
- Mode button: Switch to tracking mode

In log mode: Display log entries of water intake, date and deviation from goal
- Alarm button: Switch to next log entry
- Light button: Cycle through intake, date and deviation
- Mode button: Switch to tracking mode

Background tasks:
- Automatic reset at wake time
- Alert if intake below estimate at sleep time
- Alert at interval if intake below estimate, waking the watch if asleep
2026-07-27 21:47:04 +02:00
Konrad RieckandClaude Sonnet 5 eacb6de737 Deduplicate month-length table in deadline_face
_increment_date() kept its own copy of the days-per-month table
and leap-year check, duplicating _days_in_month() in the same
file. Two sources of truth is how the July day-count typo went
unnoticed. Call _days_in_month() directly instead, leaving one
table in the file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSucp94GA31sshe5AjvSzQ
2026-07-27 20:41:36 +02:00
Konrad RieckandClaude Sonnet 5 0b7ea662fe Fix day-increment overflow check in deadline_face settings
date_time.unit.day is a 5-bit bitfield (max 31). Incrementing 31
directly in the bitfield wrapped to 0 via truncation before the
day > days_in_month bounds check ever ran, so the overflow was
never caught. The result decoded as "day 0" of the current month,
i.e. the last day of the previous month, silently rolling the
displayed date backwards (e.g. Aug 31 -> Jul 31 -> Jun 30).

Compute the incremented day in a plain uint8_t local first, compare
it against the month length, and only then write the final value
into the bitfield.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSucp94GA31sshe5AjvSzQ
2026-07-27 20:40:21 +02:00
Konrad RieckandClaude Sonnet 5 8913758a24 Fix wrong July day count in deadline_face settings table
The local days_in_month table in _increment_date() listed July as
having 30 days instead of 31, diverging from the correct table in
_days_in_month(). This made July 31 unreachable when incrementing
the day field in settings mode.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSucp94GA31sshe5AjvSzQ
2026-07-27 20:39:30 +02:00
Konrad RieckandGitHub 22b11de6ae Monitor for LIS2DW accelerometer (#61)
This watch face displays the current reading of the LIS2DW12 accelerometer.
The axis (x,y,z) can be selected using the alarm button. A long press on the
light button allows to configure the sensor, including its mode, data rate,
low power mode, bandwidth filtering, range, filter type, and low noise mode.

The watch face is mainly designed for experimenting with the sensor and
configuring it for other developing other watch faces.
2025-08-03 13:12:43 -04:00
1954944d8d Port of deadline face (#48)
* port of deadline face

* removed beep type enum from header

---------

Co-authored-by: Joey Castillo <joeycastillo@utexas.edu>
2025-08-03 13:03:12 -04:00
Konrad RieckandMatheus Afonso Martins Moreira 50cff54833 move to deadline face on alarm 2024-09-07 19:59:04 -03:00
Konrad RieckandMatheus Afonso Martins Moreira e2ec468754 Alarm handled using background task.
The alarm for deadlines is now handled via a background task. Instead of a scheduled task that prevents sleep mode, the face checks in the background every minute whether an deadline is due. If this is the case, the face wakes up from sleep mode and starts a scheduled task for the remaining seconds.
2024-09-07 19:59:04 -03:00
Konrad RieckandMatheus Afonso Martins Moreira 27ab799e85 Fixed bugs and improved watchface
- A background task is only scheduled if the alarm option is activated. If the option is enabled, an alarm sounds when the next deadline is reached. If the option is disabled, no alarm sounds and the watch can enter low energy sleep.

- Fixed tick frequency error. During running mode, the clock ticks at 1Hz. This is set in the init function `_running_init` and thus ensures that we do not run too fast when returning from the setting mode.

- Minor corrections to comments and indentations.
2024-09-07 19:59:04 -03:00
Konrad RieckandMatheus Afonso Martins Moreira c89316b3ec removed higher frequency in first loop run. 2024-09-07 19:59:04 -03:00
Konrad RieckandMatheus Afonso Martins Moreira fab8c94428 moved tick_freq to deadline_state_t structure. 2024-09-07 19:59:04 -03:00
Konrad Rieck 43e94ca0f2 Watch face for tracking deadlines.
You can enter and monitor up to four different deadlines by providing their respective date and time. The watch face displays the remaining time at matching granularity, ranging from years to seconds.
2023-08-20 22:34:50 +02:00
Konrad Rieck 0f9bb0bd37 Fixed incorrect conversion from UNIX timestamp to watch_date_time. 2023-08-11 22:26:34 +02:00
84b947766e Alternative implementation of world clock (#216)
* Implementation of alternative world clock.

* Fixed two minor bugs
- Only start in settings mode on first activation
- Fixed typo in time zone names

---------

Co-authored-by: joeycastillo <joeycastillo@utexas.edu>
2023-03-11 16:37:40 -05:00
Konrad RieckandGitHub b5f191a1b7 Minor enhancements for the countdown face (#177)
* minor enhancements for the countdown face

* Changed usage of countdown timer.

- Long button presses have been removed.

- The light button is used to restore the last countdown as well as enter setting mode when pressed again.

- The visual state has been removed from the display.

- The internal states have been renamed to reflect the new logic.

* restore time when countdown finished.

* support for fast forward on long press (untested).

* support for beeps similar to stop watch

* fixed bug wiht display when fast forwarding
2023-01-23 14:18:28 -06:00