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

Add Timer::stop() API to make it consistent with Task. #129

Merged
merged 2 commits into from
Nov 15, 2023

Conversation

finger563
Copy link
Contributor

@finger563 finger563 commented Nov 15, 2023

Description

feat(timer): add stop() api to make it consistent with task - just an alias for cancel. Updated internal timer impl to use running_ variable for starting/stopping since the cv.wait_for/until was occasionally returning the wrong value when running in low power modes on the esp.

Motivation and Context

  • Consistent APIs across similar components streamlines developer experience and debugging.
  • Using the running_ variable ensures that even when running with low power modes (with light sleep enabled), we don't get issues with the cv.wait_for / wait_until returning the wrong status and causing the timer to exit.

How has this been tested?

Building and running the timer example.

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

Correct behavior after the change:
CleanShot 2023-11-15 at 14 24 41

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

… alias for cancel. Updated internal timer impl to use running_ variable for starting/stopping since the cv.wait_for/until was occasionally returning the wrong value when running in low power modes on the esp.
@finger563 finger563 self-assigned this Nov 15, 2023
@finger563 finger563 added enhancement New feature or request timer labels Nov 15, 2023
@finger563 finger563 merged commit 699b352 into main Nov 15, 2023
46 of 47 checks passed
@finger563 finger563 deleted the feature/timer-api branch November 15, 2023 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request timer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant