pihome-shc / pihome

PiHome - Smart Heating, Ventilation and Air Conditioning (HVAC)
http://www.pihome.eu
Other
52 stars 25 forks source link

Error in PiHome_Temperature_Sensor_v035.ino.ino #437

Closed twa127 closed 3 years ago

twa127 commented 3 years ago

Hi,

The current version of PiHome_Temperature_Sensor_v035.ino.ino does not compile. I think the error was introduced with commit #430. The syntax for the line sensors.setResolution(TEMPERATURE_PRECISION); appears to be incorrect as the documentation indicates it requires a sensor address together with the precision value.

As the default precision for the DS18b20 is 12bits anyway, is this update redundant ?

Can I also suggest the file name is tied-up from .ino.ino to .ino

dvdcut commented 3 years ago

i can not compile sketch either with line sensors.setResolution(TEMPERATURE_PRECISION);

pihome-shc commented 3 years ago

@twa127 i agree, my sensors report reading in 12bit as well, @sandreialexandru can you compile code or is there anything else wrong with your sensors?

pihome-shc commented 3 years ago

as example of my system temperature reading. image

sandreialexandru commented 3 years ago

I have found this solution after I had problems with 3 sensors. First I thought that one of them was broken, but after testing 2 more the results were the same. The code that I gave you is the one that I compiled for my sensor. I had no problems compiling. Maybe a batch of DS18B20 is faulty, because not one but 3 of them defaulted to resolution 9, which I believe means that temperature readings are in 0.5 increments.

pihome-shc commented 3 years ago

may be sensors have resolution set different for your, what version of library you are using? onewire, mysensors etc.

sandreialexandru commented 3 years ago

OneWire version 2.3.5 DallasTemperature version 3.9.0 MySensors version 2.3.2

On Thu, Nov 19, 2020, 01:22 PiHomeHVAC notifications@github.com wrote:

may be sensors have resolution set different for your, what version of library you are using? onewire, mysensors etc.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pihome-shc/pihome/issues/437#issuecomment-730008423, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK56MCLCNE5E4UQYNYTLRKDSQRJMTANCNFSM4TZZZHTA .

twa127 commented 3 years ago

If you look in DallasTemperature.h there are 2 definitions for setResolution -

// set global resolution to 9, 10, 11, or 12 bits
void setResolution(uint8_t);

and

// set resolution of a device to 9, 10, 11, or 12 bits
bool setResolution(const uint8_t*, uint8_t,
        bool skipGlobalBitResolutionCalculation = false);

So it looks like you can set it globally, strange why it won't compile for me, my libraries are up to date

pihome-shc commented 3 years ago

i have following version and i can not compile it either, but funny thing is i have global resolution 8bit but i get 12bit resolution

DallasTemperature version 3.7.2 MySensors version 2.3.2

twa127 commented 3 years ago

I think sensors.setResolution(TEMPERATURE_PRECISION); is in the wrong place in the sketch. If you move it into void setup() after the line sensors.setWaitForConversion(false); then the sketch compiles okay.

twa127 commented 3 years ago

Tried setting the global resolution to 9, 10, 11 and 12 bits and then captured the conversion time for each resolution, the results were 94, 188, 375 and 750 as per ds18b20 spec. I'll update the temperature sensor sketches if you think this is okay.

pihome-shc commented 3 years ago

I think its ok to update sketch,

On 19 Nov 2020, at 13:41, twa127 notifications@github.com wrote:

Tried setting the global resolution to 9, 10, 11 and 12 bits and then captured the conversion time for each resolution, the results were 94, 188, 375 and 750 as per ds18b20 spec. I'll update the temperature sensor sketches if you think this is okay.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

twa127 commented 3 years ago

Okay done both the NRF and RFM versions