usbtemp / utmp-cli

Command line interface for reading the temperature from USB thermometer
MIT License
7 stars 3 forks source link

Wrong readings for negative temperatures in Celsius #1

Closed j-fraga closed 4 years ago

j-fraga commented 4 years ago

I have utmp-cli running on OpenWRT (MIPS32). Today I was surprised by seeing readings like these:

# utmp-cli USB Thermometer CLI v1.05 Copyright 2019 usbtemp.com Licensed under MIT licence. Using serial port: /dev/ttyUSB0 Waiting for response ... Dec 04 08:12:48 Sensor C: 4095.44

The real temperature was bellow 0 degrees Celsius. I fiddled with the probe precision, but that didn't make any difference.

jaka commented 4 years ago

I can confirm, the problem was multiplication of unsigned short T with -1 in function DS18B20_acquire. Check today's commit. Do you compile yourself?

j-fraga commented 4 years ago

Thanks for the prompt response, @jaka. Yes, I compile myself. Going to try and do that during the next couple of days and then report back.

j-fraga commented 4 years ago

The bug is fixed. Sorry for taking so long to provide feedback.