@@ -331,10 +331,10 @@ void handleDeviceDefinition(const char * key, const char * val, void * pv) {
331
331
if (key[0 ] == DEVICE_ATTRIB_ADDRESS) {
332
332
parseBytes (def->address , val, 8 );
333
333
} else if (key[0 ] == DEVICE_ATTRIB_CALIBRATEADJUST) {
334
- temp_t parsedVal = temp_t ( 0. 0 );
334
+ temp_t parsedVal = temp_t::raw ( 0 );
335
335
const int32_t minval = temp_t (-5.0 ).getRaw ();
336
336
const int32_t maxval = temp_t (5.0 ).getRaw ();
337
- if (parsedVal.fromTempString (val, tempControl.cc .tempFormat , minval, maxval)) {
337
+ if (parsedVal.fromTempString (val, tempControl.cc .tempFormat , false , minval, maxval)) {
338
338
def->calibrationAdjust = parsedVal;
339
339
}
340
340
} else if (idx >= 0 ) {
@@ -368,6 +368,7 @@ void DeviceManager::parseDeviceDefinition(Stream & p) {
368
368
static DeviceDefinition dev;
369
369
370
370
fill ((int8_t *) &dev, sizeof (dev)); // fills with all -1
371
+ dev.calibrationAdjust == temp_t::invalid ();
371
372
piLink.parseJson (&handleDeviceDefinition, &dev);
372
373
373
374
if (!inRangeInt8 (dev.id , 0 , NUM_DEVICE_SLOTS)) // no device id given, or it's out of range, can't do anything else.
@@ -392,12 +393,11 @@ void DeviceManager::parseDeviceDefinition(Stream & p) {
392
393
393
394
assignIfSet (dev.pio , &target.hw .settings .actuator .pio );
394
395
395
- int8_t * calibrationAdjustAsInt8 = reinterpret_cast <int8_t *>(&dev.calibrationAdjust );
396
- if (calibrationAdjustAsInt8[0 ] != -1 && calibrationAdjustAsInt8[1 ] != -1 ){ // set by fill
396
+ if (temp_t::invalid () != dev.calibrationAdjust ){
397
397
target.hw .settings .sensor .calibration = dev.calibrationAdjust ;
398
398
}
399
399
else {
400
- target.hw .settings .sensor .calibration = temp_t ( 0. 0 );
400
+ target.hw .settings .sensor .calibration = temp_t::raw ( 0 );
401
401
}
402
402
403
403
if (dev.address [0 ] != 0xFF ) // first byte is family identifier. I don't have a complete list, but so far 0xFF is not used.
0 commit comments