mirror of
https://github.com/anklimov/lighthub
synced 2025-12-07 20:29:50 +03:00
DS18B20 TEMPERATURE_PRECISION increased to 12 bits and temp converted to float
This commit is contained in:
@@ -265,22 +265,7 @@ void Input::setNextPollTime(unsigned long pollTime) {
|
||||
}
|
||||
}
|
||||
|
||||
void Input::printFloatValueToStr(float value, char *valstr) {
|
||||
#if defined(ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||
sprintf(valstr, "%2.1f", value);
|
||||
#endif
|
||||
#if defined(__AVR__)
|
||||
sprintf(valstr, "%d", (int)value);
|
||||
int fractional = 10.0*((float)abs(value)-(float)abs((int)value));
|
||||
int val_len =strlen(valstr);
|
||||
valstr[val_len]='.';
|
||||
valstr[val_len+1]='0'+fractional;
|
||||
valstr[val_len+2]='\0';
|
||||
#endif
|
||||
#if defined(__SAM3X8E__)
|
||||
sprintf(valstr, "%2.1f",value);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Input::contactPoll() {
|
||||
boolean currentInputState;
|
||||
@@ -415,4 +400,3 @@ void Input::printUlongValueToStr(char *valstr, unsigned long value) {
|
||||
}
|
||||
valstr[i]='\0';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user