Update xdrv_26_lm75ad.ino to support C or F

Update xdrv_26_lm75ad.ino to support C or F depending on Settings.flag.temperature_conversion (#define TEMP_CONVERSION 0 or 1) as stored in [SetOption8] Return temperature in (0 = Celsius or 1 = Fahrenheit)
This commit is contained in:
andrethomas 2018-06-05 14:50:52 +02:00 committed by GitHub
parent c860927857
commit 289b662f10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 129 additions and 126 deletions

View File

@ -75,6 +75,9 @@ float LM75ADConvertTemp(uint16_t t) {
t=t>>5; // shift value into place (5 LSB not used) t=t>>5; // shift value into place (5 LSB not used)
tmpt=t*0.125; tmpt=t*0.125;
} }
if (!isnan(tmpt) && Settings.flag.temperature_conversion) {
tmpt = tmpt * 1.8 + 32; // Fahrenheit
}
return tmpt; return tmpt;
} }