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

Switch to freertos timers #1095

Conversation

rev22
Copy link
Contributor

@rev22 rev22 commented Apr 17, 2022

Addresses observations and issues reported in #1086 and possibly others.

This switches alarm, timer and motor controller to use FreeRTOS timers instead of the app_timer component.

The logic was changed slightly for MotorController, to avoid two timers being started simultaneosily but being executed in an unintended order.

An event is introduced to differentiate between time settings and time adjustments, this is to make alarms resilient to time zone or daylight saving changes, and to prevent companion apps from postponing alarms by periodically adjusting the time in the watch (this could happen if the time is adjusted by the companion app to the exact hour and minute an alarm was set to, which would result in the alarm being set forward 24h by ScheduleAlarm).

I have positively tested the changes, though testing was done in my personal branch mainly so far, and it's still preliminary. I only own one PineTime at the moment, and testing alarms and recurring alarms can take days.

Edit: per discussion with Riksu9000 below, this PR currently focuses on the switch to FreeRTOS timers

@rev22 rev22 force-pushed the alarm-reliability-and-switch-to-freertos-timers branch from 681c700 to aca605d Compare April 17, 2022 13:18
@Avamander Avamander dismissed their stale review April 17, 2022 13:45

Formatting issue was fixed

@medeyko
Copy link
Contributor

medeyko commented Apr 17, 2022

It's great! Because alarm reliability is a very important thing... A unreliable alarm is may be even worse than absense of any alarm.

Copy link
Contributor

@Riksu9000 Riksu9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the "new time" and "adjust time" a bit confusing. I feel like there may be a way to simplify it. I'll have to think about it.

TimerController was recently updated to use FreeRTOS timers. Please fix the conflicts.

@rev22 rev22 force-pushed the alarm-reliability-and-switch-to-freertos-timers branch from aca605d to 34b0717 Compare May 13, 2022 04:26
@rev22
Copy link
Contributor Author

rev22 commented May 13, 2022

Thank you @Riksu9000 for reviewing the code! I have now rebased and updated the commits for the latest develop branch, and applied few cosmetical changes.

@Riksu9000 Riksu9000 added this to the 1.10.0 milestone May 17, 2022
@Riksu9000 Riksu9000 linked an issue May 17, 2022 that may be closed by this pull request
1 task
@rev22 rev22 force-pushed the alarm-reliability-and-switch-to-freertos-timers branch from 34b0717 to 201d09a Compare May 19, 2022 17:58
@rev22
Copy link
Contributor Author

rev22 commented May 19, 2022

I have rebased the code again and excluded the commit about resilience to time adjustments, so that it's possible to focus better on the switch to FreeRTOS timers (per code review). A new commit was added that may address code clarity.

Copy link
Contributor

@Riksu9000 Riksu9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the remaining APP_TIMER_TICKS() as discussed.

@rev22 rev22 changed the title Alarm reliability and switch to freertos timers Switch to freertos timers May 20, 2022
@NeroBurner NeroBurner merged commit 35dcf8c into InfiniTimeOrg:develop Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alarms sometime do not trigger
5 participants