emonTH hangs with DHT22 and external DS18B20 connected and debug off

Hopefully this isn't pebcak, but I noticed something bugish in the current emonTH_DHT22_DS18B20 sketch. After connecting the DS12B20 and updating the sketch to change the node number, the device would hang with led on. I added some short pauses after each setup phase for troubleshooting and found it was hanging at this line:

    if (DHT22_status==1) Serial.println("DS18B20 and DHT22 found, assuming DS18B20 is external sensor");

looking where all the power saving goodies are, commenting the following line lets the device start.. so this leads me to believe that writing to a disabled serial port causes a hang.

  if (debug==0) power_usart0_disable();   //disable serial UART

 

I then proceeded to:

    if ((debug==1) && (DHT22_status==1)) Serial.println("DS18B20 and DHT22 found, assuming DS18B20 is external sensor");

and the unit now works with the serial port disabled.

 

I'm totally new at all things arduino so I'm looking for someone to confirm my thoughts here.

Cheers,

B

 

adool88's picture

Re: emonTH hangs with DHT22 and external DS18B20 connected and debug off

I have same problem- will try this solution. Thanks!

glyn.hudson's picture

Re: emonTH hangs with DHT22 and external DS18B20 connected and debug off

Thanks for this, looks like you have found a bug. I will test and merge this fix into the code. 

Thanks a lot, 

glyn.hudson's picture

Re: emonTH hangs with DHT22 and external DS18B20 connected and debug off

Fix has been merged into github emonth code. Thanks a lot

bdog's picture

Re: emonTH hangs with DHT22 and external DS18B20 connected and debug off

My pleasure!

Was good to get in there and have a look under the hood.

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.