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

Bug with f88 converter (negative values) #27

Open
jjvandenberg opened this issue Feb 7, 2021 · 0 comments
Open

Bug with f88 converter (negative values) #27

jjvandenberg opened this issue Feb 7, 2021 · 0 comments

Comments

@jjvandenberg
Copy link

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.

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

No branches or pull requests

1 participant