Commit b37514b9 authored by Nick Mooney's avatar Nick Mooney Committed by GitHub

Fix clamping to a single hex digit

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.
parent 3b5fc3e8
...@@ -118,7 +118,7 @@ void loop(void) ...@@ -118,7 +118,7 @@ void loop(void)
int i = 0; int i = 0;
while ( i < num_channels ) while ( i < num_channels )
{ {
printf("%x",min(0xf,values[i]&0xf)); printf("%x",min(0xf,values[i]));
++i; ++i;
} }
Serial.println(); Serial.println();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment