Skip to content

Update for deprecation of non-Chrono timing APIs #112

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kjbracey
Copy link

@kjbracey kjbracey commented Apr 20, 2020

Updates corresponding to ARMmbed/mbed-os#12425.

@jamesbeyond
Copy link
Contributor

The failure is because of astyle checks, it is been fixed, on the master, rebase would resolve the issue

@kjbracey
Copy link
Author

Build failures now look like what I'd expect before Mbed OS gets the associated PR.

@jamesbeyond
Copy link
Contributor

@kjbracey-arm could you rebase, the CI build should be successful now.

@kjbracey
Copy link
Author

Rebased.

@adbridge
Copy link
Contributor

@kjbracey-arm I just came across this having already fixed a couple of the examples. After I get my next fix in , would you be able to adjust this PR accordingly so we can actually get it in? Not sure why it didn't go in at the time :(

@kjbracey
Copy link
Author

kjbracey commented Jan 21, 2021

Oh, distant memories. Sure, I can. Ping me again.

Although if anyone's been doing significant example messing, it might not be a simple rebase. Might need more search-and-replace? Can't remember how I found the places to fix originally...

@adbridge
Copy link
Contributor

adbridge commented Jan 21, 2021

@kjbracey-arm I've only fixed the event and eventQueue examples :)
This is the last of those fixes waiting to go in #125

Timer functions now use chrono values, replace deprecated calls to
library. Replace integer time values with chrono durations.
@harmut01
Copy link
Contributor

harmut01 commented Mar 3, 2021

@kjbracey-arm I've been working on updating the values and have picked up all of your changes. Rather than create a new PR, can I push my changes to your branch?

@harmut01 harmut01 removed their assignment Mar 4, 2021
@harmut01
Copy link
Contributor

harmut01 commented Mar 4, 2021

@adbridge, @kjbracey-arm I've fixed some minor issues that were causing build errors, I believe the PR is ready for review now. Could you please take a look when you have a chance?

Copy link
Author

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

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

Looks fine to me, except the "Alarm" example is a bit glitched. I think that might be my fault - I remember stumbling on it a bit.

hour_led = !hour_led;
} else {
delay += MINUTE;
min_count++;
delay = +min_inc++;
Copy link
Author

Choose a reason for hiding this comment

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

Typo here. Not += like above. But then I think it's still wrong

Surely this and the above should look like.

delay += 1min;
min_inc++;

It's still a bit wonky, because there's no compelling reason to track both delay and min_inc. And why even bother making min_inc be Chrono if it's just a counter?

So, instead, you could forget the delay increment, just do min_inc++ and have

auto delay = hour_inc + min_inc;

in main - making the Chrono nature of those two variables useful.

Copy link
Contributor

Choose a reason for hiding this comment

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

@kjbracey-arm thanks for the feedback! I've cleaned it up now and tested the changes to make sure everything works as expected.

Remove increments of delay, instead only increment chrono min_inc and
hour_inc values. Allows improved utilisation of chrono values and
removes redundant operations to track the delay variable.
Copy link
Author

@kjbracey kjbracey left a comment

Choose a reason for hiding this comment

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

Looks good to me. Can't hit "approve" because it's my own pull request :)

@harmut01
Copy link
Contributor

@adbridge could you take a look at this since you're the only one who can approve in this scenario?

@hazzlim
Copy link

hazzlim commented Jul 29, 2021

I was going through the docs and noticed a couple of discrepancies between the example descriptions and the actual code (e.g. Kernel::Clock example here) - which I can see this PR fixes, so just wanted to ping you @adbridge for potentially picking back up reviewing/approving this. I hope that's not too annoying of me!

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.

6 participants