Giter Site home page Giter Site logo

Comments (8)

wcbonner avatar wcbonner commented on May 29, 2024

Which thermometer are you using?

I thought I'd fixed the problem with the h5074, which is the only one I've left outside, but it doesn't surprise me that I've got problems with the h5075 or h5175.

from goveebttemplogger.

kw123 avatar kw123 commented on May 29, 2024
		int iTemp = int(data[5]) << 16 | int(data[6]) << 8 | int(data[7]);
		Temperature = float(iTemp) / 10000.0;
		Humidity = float(iTemp % 1000) / 10.0;

that can not be a negative number for Temperature
I tried:
if iTemp > 223 then iTemp -= 224
but that gives wrong numbers (~ -870 or so)

from goveebttemplogger.

kw123 avatar kw123 commented on May 29, 2024

This seems to work:
if iTemp >=8388608: iTemp = 8388608 - iTemp
temp = float(iTemp)/1000.
and for hum then use
hum = abs(iTemp)%1000 / 10.

from goveebttemplogger.

kw123 avatar kw123 commented on May 29, 2024

8388608 = 2exp(23)

from goveebttemplogger.

wcbonner avatar wcbonner commented on May 29, 2024

Thanks. I'll see if I can get it fixed tonight when I'm back near my development machine.

I didn't see an answer as to which device you are working with.

from goveebttemplogger.

kw123 avatar kw123 commented on May 29, 2024

from goveebttemplogger.

kw123 avatar kw123 commented on May 29, 2024

the device name: HS5101

But the problem in the code is for both types: one with 3 bytes (that is the complicated one) but also the one with 2 bytes. There it is a simple 2 complement with 16 bits.
The 3 byte is not a 2 complement. I have never seen it done that way before.
Looks like they where trying to save a byte in the message and made it really complicated.
Karl

from goveebttemplogger.

wcbonner avatar wcbonner commented on May 29, 2024

I updated the two supported models (h5075 and h5177) I have that use the three byte encoding to properly handle negative temperatures. (Tested with the h5075 by putting it in my freezer)

The two byte data model code of the h5074 had already been tested to work properly with negative temperatures. I believe it's working because of the handling of data types. I was specifically using a short integer to handle the data, so the sign data was in a normal bit.

from goveebttemplogger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.