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

Fix clamping to a single hex digit #304

Merged
merged 1 commit into from
Dec 30, 2016
Merged

Fix clamping to a single hex digit #304

merged 1 commit into from
Dec 30, 2016

Conversation

nickmooney
Copy link
Collaborator

The desired functionality is to display all channel measurements greater than 0xF as 0xF. The current behavior picks the minimum between 0xF and (value & 0xF), which is just the last hex digit of the measurement.

If the value was 0x12, the code would print 2 rather than F. This change just makes min compare 0xF with the full value of the measurement, such that measurements above 0xF will always get clamped correctly.

The desired functionality is to display all channel measurements greater than 0xF as 0xF. The current behavior picks the minimum between `0xF` and `(value & 0xF)`, which is just the last hex digit of the measurement.

If the value was `0x12`, the code would print `2` rather than `F`. This change just makes `min` compare `0xF` with the full value of the measurement, such that measurements above `0xF` will always get clamped correctly.
@nickmooney nickmooney merged commit cd39d2d into nRF24:master Dec 30, 2016
@nickmooney nickmooney deleted the patch-1 branch December 30, 2016 19:52
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.

1 participant