summaryrefslogtreecommitdiffstats
path: root/movement/movement.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'timeout-event-and-sleep-logic'Matheus Afonso Martins Moreira2024-03-081-2/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, movement drops timeout events in case the previous loop indicates that sleep is not possible. This is due to unintended short circuiting behavior of && and is fixed with a temporary variable. The static qualifier of can_sleep is also removed. Helped-by: Alex Maestas <git@se30.xyz> Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/376
| * movement: fix unintended timeout short circuitingMatheus Afonso Martins Moreira2024-03-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | Currently, movement drops time out events in case the previous loop indicates that sleep is not possible due to short circuiting behavior of logical and in C: if the left-hand side is false, the right hand side is not evaluated at all, which means the loop is not called. This was not intended to happen. Fix it by storing the result in a second boolean variable and working out the logic after the fact.
| * movement: convert can_sleep an automatic variableMatheus Afonso Martins Moreira2024-03-051-1/+1
| | | | | | | | | | It is a simple boolean value and its scope is limited to the function. There is no reason that I can think of for it to be a static variable.
* | Merge branch 'compile-time-preferences'Matheus Afonso Martins Moreira2024-03-081-3/+30
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds overridable C preprocessor definitions for every user preference. Enables the user to set defaults and omit the preferences face. The default behavior of the watch is preserved. Suggested-by: Wesley Aptekar-Cassels <me@wesleyac.com> Implemented-by: madhogs <x3dh4vhf@duck.com> Reviewed-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/295 GitHub-Related-Issue: https://github.com/joeycastillo/Sensor-Watch/issues/291
| * | Merge branch 'main' into preferences_in_configmadhogs2024-02-141-40/+68
| |\|
| * | add compile-time options for all preferences to movement_configmadhogs2023-10-021-3/+30
| | |
* | | Merge branch 'usb-improvements' into advancedMatheus Afonso Martins Moreira2024-03-081-23/+3
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Change newline prints to also send carriage return - Introduce shell module for serial shell with argument parsing - Introduce shell command list for compile time command registration - Refactor file system commands for shell subsystem - Introduce new shell commands: - 'help' command - 'flash' command to reset into bootloader - 'stress' tests CDC serial writes of various lengths - optional delay parameter - Harden USB handling - Hangs less - Drops fewer inputs - Circular buffers for both reads and writes Reported-by: Edward Shin <contact@edwardsh.in> Tested-by: Edward Shin <contact@edwardsh.in> Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> Reviewed-by: James Haggerty <james@gruemail.com> Reviewed-by: Wesley Aptekar-Cassels <me@wesleyac.com> Reviewed-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com> GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/344
| * | USB ImprovementsEdward Shin2024-01-071-26/+6
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Introduce shell module for basic serial shell with argument parsing * Introduce shell_cmd_list module for basic compile-time command registration * Harden USB handling to hang less and drop fewer inputs - Service tud_task() with periodic TC0 timer interrupt - Service cdc_task() with periodic TC1 timer interrupt - Handle shell servicing in main app loop - Add a circular buffering layer for reads/writes * Change newline prints to also send carriage return * Refactor filesystem commands for shell subsystem * Introduce new shell commands: - 'help' command - 'flash' command to reset into bootloader - 'stress' command to stress CDC writes Testing: * Shell validated on Sensor Watch Blue w/ Linux host * Shell validated in emscripten emulator * Tuned by spamming inputs during `stress` cmd until stack didn't crash
* | Change inactivity deadlines: add 10 minutes and remove 2 days. (#365)Max Zettlmeißl2024-02-071-2/+2
| | | | | | | | | | | | | | | | I like to use the ten minute timeout on my watch and there are other people who have similar interests in a lower deadline. The two day deadline had to go to still accommodate the change within the three bit index. The default setting is still the one hour timeout.
* | Revert "make the watch-face a global in movement.c, actually"Christian Buschau2024-01-211-4/+3
| | | | | | | | This reverts commit 0e801ed505cb0c368bf1eb0473058efb6c275a3e.
* | Merge branch 'main' into theAlexes/cleanupWesley Aptekar-Cassels2024-01-211-19/+35
|\ \
| * | movement: Use LE mode code to keep buzzer awake, instead of sleeping.Alex Maestas2024-01-091-26/+36
| | |
| * | Enable custom signal tones in LE mode.Wesley Aptekar-Cassels2024-01-091-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes movement_play_signal synchronous when in LE mode, despite using the underlying asynchronous API. It's a bit of a hack, but it should work well enough for now. This also moves the enabling/disabling of the buzzer into the movement_play_signal function, so that watch faces no longer have to do it.
| * | Use legacy buzzer functions when playing default tune.Wesley Aptekar-Cassels2024-01-091-0/+7
| | | | | | | | | | | | | | | | | | This allows the default tune to be played in LE mode. Fixes: #275
| * | Revert "Merge pull request #283 from ↵Wesley Aptekar-Cassels2024-01-091-19/+1
| |/ | | | | | | | | | | | | neutralinsomniac/fix_hourly_chime_background" This reverts commit 5c94111ea20e50cb9dab8f416603403185e933b3, reversing changes made to bc9b4ce700d3f12adc0daceaa880e3d638df0c2b.
* | make the watch-face a global in movement.c, actuallyAlex Maestas2023-12-171-3/+4
| |
* | clean up trailing whitespace in movement.cAlex Maestas2023-12-161-3/+3
| |
* | use a pointer to the watch face in the app loop instead of indirecting ↵Alex Maestas2023-12-161-4/+16
| | | | | | | | through the index each time, and also recalculate can_sleep based on the timeout loop call.
* | make it clear that the movement_state contains indexesAlex Maestas2023-12-161-15/+15
|/
* move buzzer enabled detection logic into movement for movement_play_signal/tuneJeremy O'Brien2023-09-231-13/+13
| | | | | this way watch faces don't have to disable/enable the buzzer themselves before calling movement_play_signal() and movement_play_tune()
* fix signal tunes not firing in background, and split out ↵Jeremy O'Brien2023-09-221-0/+18
| | | | foreground/background chime functions
* update alternate firmware for new board colorjoeycastillo2023-09-131-0/+2
|
* add sensor watch litejoeycastillo2023-08-171-1/+3
|
* movement: add custom hourly chime tunes (#209)Jeremy O'Brien2023-06-101-3/+1
| | | | | | | * movement: add custom hourly chime tunes * slightly tweak note timings * add kim possible ringtone
* fix for events firing way too fastjoeycastillo2023-01-271-0/+1
|
* add hardcoded frequency correction valuesjoeycastillo2023-01-251-0/+6
|
* Merge branch 'main' into default-handlerdefault-handlerjoeycastillo2023-01-251-1/+5
|\
| * fix fast_tick_enabled behavior in movement (#183)TheOnePerson2023-01-231-1/+5
| |
* | handle switch to secondary face in default handlerjoeycastillo2023-01-151-15/+5
| |
* | add movement_default_loop_handler, test with default watch facesjoeycastillo2023-01-141-0/+20
|/
* Precision watch update (#152)Mikhail Svarichevsky2023-01-101-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Intermediate changes * Databank working * Main commit for precision timing First version where all functions are supposed to be working * Fix math error in nanosec. File storage for location. * Remove obsolete comments * Missing page name on pages rotation - thanks to jeremy * Delete file.diff * Cleanup+tempchart 1) finetune must always reset last calibration time when doing non-0 time correction, even when you are not applying ppm correction. 2) Dithers over 31 periods not 10, more resolution with still no risk of overflow 3) Minute-boundery finetune fix. I also just got this 1-minute error after finetune... 4) Write frequency calibration value in 1 operation rather than 2. All RTC writes must be single operations to avoid partially correct data. 5) Some code cleanup 6) Tempchart face is added for temperature statistics * Update set_time_hackwatch_face.c * Math error in display code of finetune, allow to update correction time even without correction - by long alarm press * Increase reliability of stopping & starting RTC timer As it's quite dangerous operation * hackwatch - days adjust down fix by long alarm * unify style * More comments & last style change * Simulator support RTC operations (watch_rtc_enable and watch_rtc_freqcorr_write) are in common libs. * Unicode fix * Crystal aging is now adjustable (AA page in nanosec - annual aging, ppm/year) Aging is baked into fixed offset every time finetune is performed, as it relies on last adjustment time. * Blink on non-0 page every minute in finetune to measure clock error * Rolling back private changes * Cleanup * Cleanup * Quality of life changes in nanosec 1. Does not calculate & apply ppm correction if less than 6 hours passed since previous adjustment (as it gives very high correction values which are unrealistic and unhelpful) 2. Idle timeout resets to face 0 only if no correction was made * unify style * Fix low-power errors in nanosec infrastructure, faster display in finetune * Merge fix * unify style Co-authored-by: Jeremy O'Brien <neutral@fastmail.com> Co-authored-by: joeycastillo <joeycastillo@utexas.edu>
* new backer firmware with original lineupjoeycastillo2022-11-291-1/+3
|
* allow setting default LED colors in movement_configjoeycastillo2022-11-281-1/+10
|
* Merge branch 'main' into auto-fire-long-pressTheOnePerson2022-10-261-4/+19
|\
| * Add an Alarm face to movement (#96)TheOnePerson2022-10-251-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add movement_play_alarm_beeps() to movement.c and make alarm sounds customizable. Add alarm indicator to simple watch face. * Add alarm face * alarm_face: fix problem with disabling alarms for 00:00. * Fix typos in comments and get rid of of unused variable warning * remove unnecessary constant * simple_clock_face: fix disappearing chime indicator after face switch, enable alarm indicator updates in app loop (for one-time alarms). movement: handle situations where watch is in sleep mode and chimes fire off at the same time as alarms properly. * alarm_face: tweak process of displaying things on the lcd. Add extra long and extra short alarms. Increase number of alarm slots to 16. * alarm face: fix alarms playing one beeping round more than set. * alarm face: add proper quick cycling of hour and minute setting * alarm-face: correct am/pm indication and some minor tweaks. Reset movement_config.h to current main branch. simple-watch-face: Remove unnecessary check and swap indicators (alarm / hourly chime) * alarm-face: reverse commit parts from another branch (accidentially commited logic depending on movement firmware auto firing the long press event) Co-authored-by: joeycastillo <joeycastillo@utexas.edu>
| * Merge pull request #103 from wryun/long-press-home-to-settingsjoeycastillo2022-10-231-4/+19
| |\ | | | | | | Long press of mode on home screen goes to settings
| | * make this an if/then to please emscriptenjoeycastillo2022-10-231-5/+6
| | |
| | * disable settings hiding by defaultjoeycastillo2022-10-231-3/+7
| | |
| | * Long press of mode on home screen goes to settingsJames Haggerty2022-10-191-4/+14
| | | | | | | | | | | | | | | This also changes the default rotation so you don't see the settings screens.
* | | Movement: implement auto firing of long press events and introduce long up ↵TheOnePerson2022-10-231-11/+33
|/ / | | | | | | event. (Also re-implement alarm_enabled and alarm_note)
* | allow watch faces to schedule tasks from backgroundjoeycastillo2022-10-221-3/+11
| |
* | fix scheduled tasks scheduling another taskNiclas Hoyer2022-10-211-0/+4
|/
* use watch_face_changed propertyjoeycastillo2022-10-121-1/+1
|
* no need to set this (set in movement_move_to_face)joeycastillo2022-10-111-1/+0
|
* don't sleep on watch face changejoeycastillo2022-10-111-3/+11
|
* Make long press mode go back to face 0 instead of next faceJames Haggerty2022-10-121-3/+8
|
* Merge branch 'main' of github.com:joeycastillo/Sensor-Watch into lfsJoey Castillo2022-08-021-12/+31
|\
| * movement: wake programmatically from background and play alarmJoey Castillo2022-07-171-12/+31
| |
* | add file browser to movement, remove old appJoey Castillo2022-05-091-1/+3
| |
* | simulator: add USB serial input fieldJoey Castillo2022-05-091-0/+30
|/