Home › Forum › Community › Jumps in measured data › Reply To: Jumps in measured data
I’ve provided more details on email, please check it. But for the continuity of the topic, the bug becomes apparent when you decode the “converted” values. Please add the decoding function:
double int2double(uint16_t val) {
int8_t d = (val >> 8) & 0xFF;
int8_t i = (val & 0xFF) - 127;
if (i < 0) d *= -1;
return i + d / 100.0;
}
The if (i < 0) d *= -1; won't trigger when i is 0. The problem with this algorithm is that we have no way of knowing the sign, when the integer byte is 0. Exactly the bug you have spotted. Try this code to the "converted" values, and check the more details I sent on your email. I tried to see if this is fixable on the server side, but apparently information is lost on the conversion. A new encoding scheme has been added to the firmware. We will need to install this new firmware on all affected units.