Skip to content

Commit

Permalink
Merge pull request #12 from hexamer/master
Browse files Browse the repository at this point in the history
  • Loading branch information
amatilda authored Jun 27, 2024
2 parents 637f0ed + 73c129a commit c4acbae
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions hardware/arduino/zunoG2/libraries/ZUNO_DS18B20/ZUNO_DS18B20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ int DS18B20Sensor::getTempC100(byte * addr)
size_t current_resolution;

byte dallas_data[9];
int temp = BAD_TEMP;
int16_t temp = BAD_TEMP;
int32_t tempC100 = BAD_TEMP;
byte i;

if (!my_ow->reset())
Expand Down Expand Up @@ -149,11 +150,10 @@ int DS18B20Sensor::getTempC100(byte * addr)
// temp /= 0.16
// will be
// 16/100 => 4/25 => temp *= 25; tem/=4;
temp *= 25;
temp >>= 2;
tempC100 = (int32_t)temp * 25;
tempC100 >>= 2;


return temp;
return tempC100;
}

float DS18B20Sensor::getTemperature(byte * addr) {
Expand Down

0 comments on commit c4acbae

Please sign in to comment.