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

feat(timer): change period/delay storage #117

Merged
merged 2 commits into from
Oct 20, 2023

Conversation

finger563
Copy link
Contributor

@finger563 finger563 commented Oct 20, 2023

Description

  • Update timer to use std::chrono::microseconds for storing period and delay to improve precision of timing across platforms (e.g. on MacOS).
  • Add period_float and delay_float members which perform the conversion once to then be printed in logs later as needed.
  • feat(x-plat): added build scripts for ease of use and ignore the lib/pc output directory

Motivation and Context

On MacOS, the existing use of std::chrono::duration<float> for the period and delay had odd behavioral issues, leading to no wait at all on the condition variable. This PR fixes that.

How has this been tested?

  • Building and running the timer example on a QtPy ESP32 PICO
  • Building and running the PC timer test on MacOS

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

CleanShot 2023-10-20 at 09 21 27
CleanShot 2023-10-20 at 09 25 03

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.

* Update timer to use std::chrono::microseconds for storing period and delay to improve precision of timing across platforms (e.g. on MacOS).
* Add period_float and delay_float members which perform the conversion once to then be printed in logs later as needed.
@finger563 finger563 added bug Something isn't working timer xplat cross platform support labels Oct 20, 2023
@finger563 finger563 merged commit 645756a into main Oct 20, 2023
39 checks passed
@finger563 finger563 deleted the feature/timer-precision-update branch October 20, 2023 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working timer xplat cross platform support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant