arduino-opentherm
arduino-opentherm copied to clipboard
Bug with f88 converter (negative values)
trafficstars
Hi,
I had to changed the type conversion for negative values from the unsigned type BYTE to CHAR to allow the sign (of the float) to traverse to valueHB.
void OpenthermData::f88(float value) { if (value >= 0) { valueHB = (byte) value;
float fraction = (value - valueHB);
valueLB = fraction * 256.0;
} else { //valueHB = (byte)(value - 1); valueHB = (char) (value -1) ; float fraction = (value - valueHB - 1); Serial.print("Fraction == ");Serial.println(fraction); valueLB = fraction * 256.0; } }
Thanks for the lib, it's great fun to be able to read and set a Chronotherm IV thermostat.