openenergymonitor / EmonESP

ESP8266 WIFI serial to emoncms link
160 stars 77 forks source link

Default values get overwritten... wrong behaviour #94

Open FredM67 opened 3 years ago

FredM67 commented 3 years ago

Start with a "blank" chip, with default config. "ctrl_mode" defaults to "Off". At the end of setup(), ctrl_mode is "Off". After a couple of loop(), it turns to "On". I'm still searching where the variable gets changed.

FredM67 commented 3 years ago

So I'm totally stucked.... I've put "everywhere" debug lines to print "ctrl_mode"... I cannot find where, during the first seconds after reboot, the variable is turned from "Off" to "On".... May be it's somewhere in a javascript file ?!?

FredM67 commented 3 years ago

Ok, got it.... the problem is on line 202 or src.ino. At each reboot, the condition on line 200 is true and it leads to turn ctrl_mode from "Off" to "On".

BTW, I don't understand what's the purpose of this block. Is it specific to an environment ? For emonesp, except a couple of time at the beginning of the boot, we never go inside the "if", even after pushing the "GPIO0" button.