ESP R120 crashes upon receiving MQTT message

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
renearts
New user
Posts: 9
Joined: 26 May 2016, 13:31
Location: Volkel, NL
Contact:

ESP R120 crashes upon receiving MQTT message

#1 Post by renearts » 02 Sep 2016, 20:56

I'm having a strange problem: with R108 all seems to work fine.
I'm using a H108 5 channel dimmer with ESPEasy R108, which receives MQTT messages (from pimatic) like this one : "/h801_kitchen/pwm/15" with a value between 0-1024. Hardly ever needs a reboot.
I just tried updating it via the webinterface to R120, this works well, the ESP reboots and is responsive from a browser (pwm, fade all works great). Though when I send an MQTT message as stated above (exactly the same, nothing changed in my pimatic config, also happens when using a manual MQTT tool) the ESP seems to crash. I need to powercycle it before it gets responsive again.
The log shows no strange messages, just the normal boot sequence and that it is connected to the MQTT broker.
Reprogramming the firmware to R108 makes it all work again (all done via web interface).

I tried building R120 myself, the problem still applies (R120 builds fine, no problems).

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: ESP R120 crashes upon receiving MQTT message

#2 Post by tozett » 03 Sep 2016, 10:01

most problems with crashed here in the forum had to to with power-issues.
may you check this?

http://www.esp8266.nu/index.php/Power

User avatar
renearts
New user
Posts: 9
Joined: 26 May 2016, 13:31
Location: Volkel, NL
Contact:

Re: ESP R120 crashes upon receiving MQTT message

#3 Post by renearts » 03 Sep 2016, 18:56

Power should be fine as it is an LED controller with a beefy supply. Also with R108 all works fine, via wifi everything works fine as well. This really seems to be MQTT related if you're asking me :)

Martinus

Re: ESP R120 crashes upon receiving MQTT message

#4 Post by Martinus » 04 Sep 2016, 12:07

Bug confirmed. It was introduced with the 'fade' option for pwm.
It will be fixed in R127, but in the mean time, you could use the newer command method to set pwm, using the 'cmd' topic:

Code: Select all

<template>/cmd
pwm,<pin>,<value>,[<fade>]
So in your case this would be like this:

Code: Select all

/h801_kitchen/cmd
pwm,15,<value>

Or wait for the next release...

Technical background on this bug:

When using the old <template>/pwm/<pin> command, TempEvent->Par3 is left uninitialized, because at that time, only two parameters where used and you can only provide two parameters using this method.
In R108 this uninitialized int seems to result in a zero value. Causing no issue.
In R120 this results in a huge value (>1 billion msec), causing the system to delay for a very long time, effectively 'hanging'.

It shows that uninitialized values can have different and unexpected behaviour accross different builds.

User avatar
renearts
New user
Posts: 9
Joined: 26 May 2016, 13:31
Location: Volkel, NL
Contact:

Re: ESP R120 crashes upon receiving MQTT message

#5 Post by renearts » 04 Sep 2016, 16:03

Ah thanks a lot! This indeed solves my problem.
As I was updating to R120 with the intention to be able to use the fade option, I am now using a quick workaround while waiting on R127.
Pimatic currently does not support adding a value for the fade time AFAIK, so I am now just using the newer command format and hardcoded a fade time of 1024 in the firmware. Works great for now :)
Thanks again for your assistance!

Post Reply

Who is online

Users browsing this forum: No registered users and 131 guests