aderusha / HASwitchPlate

LCD touchscreen for Home Automation
MIT License
732 stars 128 forks source link

LCD Reset #42

Closed RDickens closed 5 years ago

RDickens commented 5 years ago

The nextionReset() function does not work.

You have set the digitalWrite(nextionResetPin, LOW); but did not set it HIGH again

void nextionReset() { digitalWrite(nextionResetPin, LOW); Serial1.print("rest"); Serial1.write(nextionSuffix, sizeof(nextionSuffix)); Serial1.flush(); delay(2000); }

I have added a digitalWrite(nextionResetPin, HIGH); and mqttClient.disconnect();. This turns on the power to the diplay again and also forces the diplay to re-connect and sync.

void nextionReset() { digitalWrite(nextionResetPin, LOW); Serial1.print("rest"); Serial1.write(nextionSuffix, sizeof(nextionSuffix)); Serial1.flush(); delay(2000); digitalWrite(nextionResetPin, HIGH); mqttClient.disconnect(); }

aderusha commented 5 years ago

Great catch! I had intentionally done this the way it's written as the use cases I was considering were followed by an ESP.reset(). Of course, I forgot the MQTT command lcdreset which doesn't also reset the ESP.

Next release will have this fix, thank you for digging into it, pointing it out, and providing an easy solution!

aderusha commented 5 years ago

New reset code in latest HASP release v0.35