Commit Graph

136 Commits

Author SHA1 Message Date
voloved 154bd54510 Set time on make (#35)
* Time can get set from makefile

* Added setting make time into simulator

* Added  Hash in settings

* Added default location

* Cuts the Githash to 6 characters in the settings in case the makefile didn't do that already

* bump gossamer commit

* remove automatic timezone setting

* automatic time set: rename MAKEFILE_ to BUILD_ to match gossamer

* Revert "Added default location"

This reverts commit c24f69450fd40472c4f6cebb790a56c3f0d69cb6.

* silence warning

* watch_get_init_date_time: explicitly initialize all fields to 0

---------

Co-authored-by: Joey Castillo <joeycastillo@utexas.edu>
2025-07-06 10:56:27 -04:00
Joey Castillo 37a8a92f58 bugfix: maintain accelerometer background sampling rate after wake from sleep 2025-07-03 17:14:08 -04:00
Joey Castillo b1c67bea94 accelerometer: keep threshold across sleeps by tracking it in movement 2025-06-25 17:22:17 -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 1a5ccd34a0 accelerometer: don't initialize on wake if already set up 2025-06-11 23:25:08 -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 69b8048790 power down accelerometer unless a watch face requests it 2025-05-26 10:51:11 -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 acdc32ffb4 movement: add loudness setting for button press 2025-05-20 17:27:32 -04:00
Joey Castillo 7d8ad1b87b simplify activity tracking, just active minutes for now 2025-05-17 13:54:37 -04:00
Joey Castillo 40a0308059 fix long press bug (seems related to disabling an interrupt) 2025-05-17 11:55:03 -04:00
Joey Castillo 47fbaccc77 add movement_get_temperature, works across different sensor boards 2025-05-17 11:03:51 -04:00
Joey Castillo 80cbb0fe30 automatically detect temperature sensor 2025-05-17 10:23:38 -04:00
Joey Castillo c5bda0faeb auto-detect accelerometer sensor (and don't fail build for lack of a temperature sensor) 2025-05-16 00:07:15 -04:00
Joey Castillo 374a93846d FREQCORR is now handled in _watch_rtc_init 2025-05-15 21:33:26 -04:00
Joey Castillo 0739382fb8 remove orientation change counter 2025-05-13 18:21:58 -04:00
Joey Castillo 956b8601f6 enable filtering on button inputs 2025-05-12 22:25:27 -04:00
Joey Castillo ff3b69a38b accelerometer: disable wake on motion, has awkward user experience 2025-04-28 18:29:57 -04:00
Joey Castillo b0dbff4172 accelerometer: stop sleeping after inactivity, use LE settings 2025-04-28 18:29:57 -04:00
Joey Castillo e435969b51 WIP: accelerometer activity tracking 2025-04-20 13:47:04 -04:00
Joey Castillo 29547227ee actually, set the time after loading settings (need to convert to UTC) 2025-03-15 18:30:37 -04:00
Joey Castillo 32086bc499 happy (belated) new year 2025-03-15 18:15:08 -04:00
Joey Castillo 7d129ba6c3 world clock: support longer cities on custom LCD 2025-03-15 15:20:22 -04:00
Joey Castillo ecc633fab4 second movement: persist settings to file system 2025-03-15 11:44:00 -04:00
Joey Castillo c1efea4db7 lcd autodetect: use buttons as a backup option 2025-03-15 09:48:53 -04:00
Joey Castillo 185b9b1b97 move activity logging into Movement core 2025-03-12 23:05:06 -04:00
Joey Castillo 99a28dc886 accelerometer: have been using a threshold of 8 for latest tests 2024-12-16 16:41:26 -05:00
Joey Castillo 4b5e15cc1d accelrometer: add tap event, test by adding tap to set countdown 2024-11-27 18:04:17 -05:00
joeycastillo c6af677b79 accel: count orientation changes with TC2 instead of waking up 2024-11-18 23:50:21 -05:00
joeycastillo 548260b13e accelerometer: vibe check complete, no need for these diagnostic beeps 2024-11-18 22:26:45 -05:00
joeycastillo c8da4e5d82 use accelerometer to enter and exit low energy mode 2024-11-18 21:48:10 -05:00
joeycastillo 3e6079a24b track stationary, not active minutes 2024-11-18 21:39:12 -05:00
joeycastillo b00faa2b03 accelerometer: new hardware swaps interrupt wiring 2024-11-18 21:39:12 -05:00
joeycastillo b5fd0f7418 accel: lower wake threshold to smallest possible value 2024-11-18 18:45:44 -05:00
joeycastillo 13d98ef5c9 activity tracking proof of concept 2024-10-20 21:13:34 -04:00
joeycastillo 19376625d1 more accelerometer work 2024-10-19 12:35:46 -04:00
joeycastillo a81b6960e3 more accelerometer testing 2024-10-16 08:20:20 -04:00
joeycastillo 2ea18e0f73 fix broken simulator build 2024-10-14 12:51:17 -04:00
joeycastillo ea8c55744b document the accelerometer setup 2024-10-14 12:38:13 -04:00
joeycastillo e5c568b757 use gossamer calls for EVSYS and TC2 event actions 2024-10-14 12:37:57 -04:00
joeycastillo 2d3412bb09 beep softer when changing modes (saves energy) 2024-10-12 11:34:06 -04:00
joeycastillo 4795818098 only build sensor features if sensor is available 2024-10-12 11:16:01 -04:00
joeycastillo e1b5395e10 preliminary accelerometer support in Movement 2024-10-09 09:48:49 -04:00
joeycastillo ab861d81d1 fix time zones in simulator 2024-10-07 08:36:23 -04:00
joeycastillo 63c34005ee initial pass at simulator support 2024-10-06 17:14:46 -04:00
joeycastillo 55ebd7325a remove printf statements 2024-10-05 13:01:00 -04:00
joeycastillo b03f593373 no need to check on :15 and :45 -- Nepal does not observe DST 2024-10-05 12:57:13 -04:00
joeycastillo 0a9d71e2d4 use consistent naming style for typedefs 2024-10-05 10:36:58 -04:00
joeycastillo 4623bf002a use named constant for UTC zone 2024-10-05 10:36:58 -04:00
joeycastillo e5c20acd78 cache DST offsets so we're not constantly converting time zones 2024-10-05 10:36:58 -04:00