Update HomeSpan.cpp
Tweaks to WiFi reset code so that instead of re-starting, HomeSpan simply disconnects WiFi, which triggers initWifi() upon the next call to poll(().
This commit is contained in:
parent
b06dadc6a1
commit
60c2d5645d
|
|
@ -178,8 +178,7 @@ void Span::poll() {
|
||||||
if(controlButton.triggered(5000,10000)){
|
if(controlButton.triggered(5000,10000)){
|
||||||
statusLED.off();
|
statusLED.off();
|
||||||
if(controlButton.longPress()){
|
if(controlButton.longPress()){
|
||||||
delay(2000);
|
processSerialCommand("W"); // DELETE WiFi Data
|
||||||
processSerialCommand("W"); // DELETE WiFi Data and Restart
|
|
||||||
} else {
|
} else {
|
||||||
controlButton.reset();
|
controlButton.reset();
|
||||||
processSerialCommand("U"); // UNPAIR Device
|
processSerialCommand("U"); // UNPAIR Device
|
||||||
|
|
@ -312,12 +311,8 @@ void Span::initWifi(){
|
||||||
|
|
||||||
while(millis()-sTime<delayTime){
|
while(millis()-sTime<delayTime){
|
||||||
if(controlButton.triggered(9999,3000) || (Serial.available() && readSerial(buf,1) && (buf[0]=='W'))){
|
if(controlButton.triggered(9999,3000) || (Serial.available() && readSerial(buf,1) && (buf[0]=='W'))){
|
||||||
statusLED.start(LED_ALERT);
|
processSerialCommand("W"); // DELETE WiFi Data
|
||||||
Serial.print("\n** Deleting WIFI Network Data **\n** Restarting...\n\n");
|
return;
|
||||||
nvs_erase_all(HAPClient::wifiNVS);
|
|
||||||
nvs_commit(HAPClient::wifiNVS);
|
|
||||||
delay(2000);
|
|
||||||
ESP.restart();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -489,9 +484,8 @@ void Span::processSerialCommand(char *c){
|
||||||
|
|
||||||
nvs_erase_all(HAPClient::wifiNVS);
|
nvs_erase_all(HAPClient::wifiNVS);
|
||||||
nvs_commit(HAPClient::wifiNVS);
|
nvs_commit(HAPClient::wifiNVS);
|
||||||
Serial.print("\n** WIFI Network Data DELETED **\n** Restarting...\n\n");
|
WiFi.disconnect();
|
||||||
delay(1000);
|
Serial.print("\n** WIFI Network Data DELETED **\n\n");
|
||||||
ESP.restart();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -558,7 +552,7 @@ void Span::processSerialCommand(char *c){
|
||||||
Serial.print(" d - print attributes database\n");
|
Serial.print(" d - print attributes database\n");
|
||||||
Serial.print(" i - print detailed info about configuration\n");
|
Serial.print(" i - print detailed info about configuration\n");
|
||||||
Serial.print(" U - unpair device by deleting all Controller data\n");
|
Serial.print(" U - unpair device by deleting all Controller data\n");
|
||||||
Serial.print(" W - delete stored WiFi data and restart\n");
|
Serial.print(" W - delete stored WiFi data\n");
|
||||||
Serial.print(" H - delete stored HomeKit Pairing data and restart\n");
|
Serial.print(" H - delete stored HomeKit Pairing data and restart\n");
|
||||||
Serial.print(" F - delete all stored data (Factory Reset) and restart\n");
|
Serial.print(" F - delete all stored data (Factory Reset) and restart\n");
|
||||||
Serial.print(" ? - print this list of commands\n");
|
Serial.print(" ? - print this list of commands\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue