Skip to content

Conversation

mrschuster
Copy link
Contributor

The function TIMER_IF_Convert_Tick2ms() returned wrong values.

When tick duration is 3.9 ms, the function multiplied by 4 instead.

The order of the computation is important: first multiply by 1000, then divide, then add 1. It was: compute (1000/256+1) as int, which is 4, and then use the 4 as factor.

This fixes issue #40.

The order of the computation is important: first multiply by 1000, then divide, then add 1. It was: compute (1000/256+1) as int, which is 4, and then use the 4 as factor. Hence, the conversion of ms was quite off the real value.

Also rename MS_TO_TICK, since it does not do that.

Fixes stm32duino#40.
@fpistm fpistm added the fix 🩹 Bug fix label Nov 27, 2024
@fpistm fpistm added this to the 0.2.1/0.3.0 milestone Nov 27, 2024
@fpistm fpistm self-requested a review November 27, 2024 09:55
Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

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

LGTM.
Thanks @mrschuster for this PR.

@fpistm fpistm linked an issue Nov 27, 2024 that may be closed by this pull request
@fpistm fpistm merged commit 4159906 into stm32duino:main Nov 27, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 🩹 Bug fix
Projects
Development

Successfully merging this pull request may close these issues.

SimpleAsync Example does not receive packets from the Helium Network
2 participants