letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.27k stars 2.21k forks source link

Feature/change request: move hardwareInit above WifiConnect #114

Closed dropax closed 7 years ago

dropax commented 7 years ago

Especially with the sometimes unstable sonoffs it can take a long time until the configured boot states for GPIOs get applied. Found the reason in ESPEasy.ino (line 564ff): hardwareInit() is run after the wifi stuff is done.

I use several sonoffs buried in lamps, they are powered through the original (wall)switches. This way the lamps can be used in the normal way. Just the delay between flipping the switch and the lamp coming on is irritating (especially if the wifi connection fails three times until AP mode is firered) and I think it would greatly improve the WifeAcceptanceFactor ;) to do the hardware init first.

Is there technically anything speaking against moving hardwareInit() a few lines up?

psy0rz commented 7 years ago

I will look into it to see what exactly happens in hardwareinit and what happens in the lines before it.

I think this is a pretty usefull feature: It allows one to keep the wirering simple. (just connect it somewhere after the lightswitch) And if there is something wrong with the homecontroller or network, you can just use the switch.

psy0rz commented 7 years ago

fixed in v2.0.0-dev6.

also after startup the sensor will be send immediately, instead of waiting arbitrary amounts of time (30 seconds )