-
Notifications
You must be signed in to change notification settings - Fork 499
Closed
Description
When I moved excising project on Arduino Due, I got compiler warning
comparison (celsius < -55) is always false due to limited range of data type
1 Because char is unsigned by default on ArduinoDdue, forum discussion. Maybe char need replace with signed char?
2 But also I noticed that this signed value later convert in unsigned before sending on device. Don't know is it right or not.
void DallasTemperature::setHighAlarmTemp(const uint8_t* deviceAddress, char celsius){
// make sure the alarm temperature is within the device's range
if (celsius > 125) celsius = 125;
else if (celsius < -55) celsius = -55;
ScratchPad scratchPad;
if (isConnected(deviceAddress, scratchPad)){
scratchPad[HIGH_ALARM_TEMP] = (uint8_t)celsius;
writeScratchPad(deviceAddress, scratchPad);
}
}
Metadata
Metadata
Assignees
Labels
No labels