Joey Castillo
42997ff614
ir upload: display free space instead of 'no data'
2025-06-25 17:08:38 -04:00
Daniel Bergman
7f9a00ef35
fix(lis2dw): Re-initialize accelerometer after waking from sleep ( #16 )
...
* fix(lis2dw): Re-initialize accelerometer after waking from sleep
The LIS2DW accelerometer was not being re-initialized correctly after the device woke from sleep mode. When entering sleep, `watch_enter_sleep_mode` disables peripherals and pins, including those for I²C, to conserve power.
Upon waking, the `app_setup` function was designed to re-initialize the hardware. However, the logic only performed the I²C device check once on the initial boot. On subsequent wakes, the `movement_state.has_lis2dw` flag would prevent the I²C bus and the LIS2DW driver from being set up again. This caused any watch face functionality that relied on the accelerometer, such as the countdown face's tap detection, to fail after a sleep/wake cycle.
This commit refactors the initialization logic within `app_setup`. It now uses a static boolean `lis2dw_initialized` to ensure the sensor is detected only once at boot time. On subsequent wakes, if the sensor was originally found to be present, the I²C bus is explicitly re-enabled and the driver is re-initialized with `lis2dw_begin()` before its configuration is reapplied. This ensures the accelerometer is reliably available after every wake-up.
* fix(lis2dw): only check for accelerometer presence once per boot
Previously, devices without the LIS2DW sensor would re-enable I2C and attempt to detect the sensor on every wake from sleep, wasting power and CPU cycles. This change introduces a static `lis2dw_checked` flag that is set after the first detection attempt, regardless of whether the sensor is found. Now, the presence check and I2C enable/disable only occur once per boot, ensuring that devices without the sensor do not repeatedly attempt detection, improving efficiency and battery life.
2025-06-25 09:18:33 -04:00
Joey Castillo
918549a462
accelerometer status: documentation update
2025-06-11 23:27:17 -04:00
Joey Castillo
1a5ccd34a0
accelerometer: don't initialize on wake if already set up
2025-06-11 23:25:08 -04:00
Joey Castillo
bb5aa4ff7c
accelerometer status face: bug fixes
2025-06-11 23:06:40 -04:00
Joey Castillo
e9b7f3f955
mars time: long press to change time zone
2025-06-08 07:48:54 -06:00
Joey Castillo
9459b7d01f
temperature display: long press to toggle units
2025-06-08 07:48:46 -06:00
Joey Castillo
bf40e46036
bugfix: remove time_offset to get alarm handler working in simulator
2025-06-07 21:25:57 -06:00
Joey Castillo
4160efef70
fast stopwatch: fix overconsumption
2025-06-04 20:48:00 -04:00
Joey Castillo
87a315d936
countdown timer: snap back to clock on timeout, unless running
2025-06-04 00:19:51 -04:00
Joey Castillo
659c73046d
mars time: actually update in low energy mode
2025-06-02 20:27:14 -04:00
Joey Castillo
fe23ed6e7a
add watch face to peek at a memory location
2025-05-29 08:21:18 -04:00
Joey Castillo
ca46cb4988
for testing: add NOSLEEP build option to remove sleep mode entirely
2025-05-29 07:22:04 -04:00
Joey Castillo
9a712258f8
world clock: blink colon in low energy mode
2025-05-28 23:43:17 -04:00
Joey Castillo
ad3f1e56ed
mars time: don't time out, enable low energy animation
2025-05-28 23:42:38 -04:00
Joey Castillo
7cf81ee9e0
set LED's drive strength to high
2025-05-27 20:40:06 -04:00
Joey Castillo
e9811a518a
bring mars time into Second Movement
2025-05-27 19:30:54 -04:00
Joey Castillo
69b8048790
power down accelerometer unless a watch face requests it
2025-05-26 10:51:11 -04:00
Joey Castillo
6ac2c13098
swap temperature and battery in default firmware
2025-05-26 10:50:07 -04:00
Joey Castillo
6b297e50e4
movement_config: put alarm into standard rotation
2025-05-21 15:44:45 -04:00
Joey Castillo
05080be843
alarm_face: hook alarm up to main clock's alarm indicator
2025-05-21 15:44:16 -04:00
Joey Castillo
5ee0de27cf
movement: fire top of minute at top of minute, not bottom of last minute
2025-05-21 15:08:00 -04:00
Joey Castillo
bf44c0ae1e
bring wake_face into Second Movement (renamed alarm_face)
2025-05-21 15:07:29 -04:00
Joey Castillo
583fae0b30
nanosec: add braces since we declare things
2025-05-21 09:17:38 -04:00
Joey Castillo
310ad3d095
watch_adc: enable ADC when checking battery; let's get rid of this footgun once and for all
2025-05-21 08:51:39 -04:00
Joey Castillo
07a085e90b
preferences face: removed in favor of new settings face
2025-05-21 01:19:29 -04:00
Joey Castillo
f017462ad4
temperature logger: skip if no temperature sensor is available
2025-05-21 01:15:03 -04:00
Joey Castillo
b4730da36b
temperature logger: rename stuff to remove thermistor references
2025-05-21 01:12:20 -04:00
Joey Castillo
6c1fa9f4df
temperature faces: no need to import thermistor driver
2025-05-21 01:10:09 -04:00
Joey Castillo
ea90319180
nanosec: use new Movement API for getting temperature
2025-05-21 01:09:15 -04:00
Joey Castillo
f48058568a
watch utility: make Friday all caps like the others
2025-05-21 00:53:13 -04:00
Joey Castillo
e0010f6760
port nanosec and finetune to Second Movement
2025-05-21 00:50:23 -04:00
Joey Castillo
20a72b4590
default firmware: put stopwatch before countdown
2025-05-21 00:15:19 -04:00
Joey Castillo
287f755edb
slcd: we can fit these segment mappings into one byte
2025-05-20 23:50:09 -04:00
Joey Castillo
d43c216664
bugfix: need definition of colon as indicator for blinking on custom LCD
2025-05-20 23:42:22 -04:00
Joey Castillo
540222e949
voltage and temperature: clear sleep animation on activate
2025-05-20 23:36:20 -04:00
Joey Castillo
da82469576
countdown: implement sleep mode animation
2025-05-20 23:34:47 -04:00
Joey Castillo
74c8573641
moon phase: clear sleep animation on wake
2025-05-20 23:30:27 -04:00
Joey Castillo
094d33094e
clock face: move state typedef to header for consistency
2025-05-20 22:35:16 -04:00
Joey Castillo
44d14ba706
clock face: rename 'clock' to 'state' for consistency
2025-05-20 22:34:15 -04:00
Joey Castillo
e048cdeb52
activity logging: try to ignore spurious active minutes
2025-05-20 17:34:45 -04:00
Joey Castillo
acdc32ffb4
movement: add loudness setting for button press
2025-05-20 17:27:32 -04:00
Joey Castillo
616bb08720
display detection: return straight away if LCD type was forced
2025-05-18 21:19:12 -04:00
Joey Castillo
5691a3f4f1
watch library: remove LCD autodetect, make selection manual
2025-05-18 21:04:49 -04:00
Joey Castillo
4a04db6ca6
light meter: was written today lol
2025-05-18 20:45:37 -04:00
Joey Castillo
94a08b531a
light meter: rough half-working prototype
2025-05-18 20:32:36 -04:00
Joey Castillo
e511059da8
activity log: snap back to today on timeout
2025-05-18 13:29:45 -04:00
Joey Castillo
c281922e4d
activity log: update today's count at top of minute
2025-05-18 13:29:45 -04:00
Joey Castillo
51e6d62a1b
activity log: clear animation when waking from sleep mode
2025-05-18 13:29:45 -04:00
Joey Castillo
56366199e7
light meter: initial UI work
2025-05-18 13:29:45 -04:00