Minor tweaks to some LED patterns
This commit is contained in:
parent
e658d6d4eb
commit
8cfd9afa63
|
|
@ -223,7 +223,7 @@ void Span::commandMode(){
|
||||||
mode=1;
|
mode=1;
|
||||||
done=true;
|
done=true;
|
||||||
statusLED.start(LED_ALERT);
|
statusLED.start(LED_ALERT);
|
||||||
delay(1000);
|
delay(2000);
|
||||||
} else
|
} else
|
||||||
if(controlButton.triggered(10,3000)){
|
if(controlButton.triggered(10,3000)){
|
||||||
if(!controlButton.longPress()){
|
if(!controlButton.longPress()){
|
||||||
|
|
@ -308,12 +308,15 @@ void Span::initWifi(){
|
||||||
long sTime=millis();
|
long sTime=millis();
|
||||||
|
|
||||||
while(millis()-sTime<delayTime){
|
while(millis()-sTime<delayTime){
|
||||||
if(controlButton.triggered(9999,3000) || (Serial.available() && readSerial(buf,1) && (buf[0]=='X'))){
|
if(controlButton.triggered(9999,3000)){
|
||||||
Serial.print(" TERMINATED!\n");
|
Serial.print(" TERMINATED!\n");
|
||||||
statusLED.start(LED_ALERT);
|
statusLED.start(LED_ALERT);
|
||||||
delay(1000);
|
controlButton.wait();
|
||||||
processSerialCommand("X"); // DELETE WiFi Data
|
processSerialCommand("X"); // DELETE WiFi Data and Restart
|
||||||
return;
|
}
|
||||||
|
if (Serial.available() && readSerial(buf,1) && (buf[0]=='X')){
|
||||||
|
Serial.print(" TERMINATED!\n");
|
||||||
|
processSerialCommand("X"); // DELETE WiFi Data and Restart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -496,9 +499,9 @@ void Span::processSerialCommand(char *c){
|
||||||
network.serialConfigure();
|
network.serialConfigure();
|
||||||
nvs_set_blob(HAPClient::wifiNVS,"WIFIDATA",&network.wifiData,sizeof(network.wifiData)); // update data
|
nvs_set_blob(HAPClient::wifiNVS,"WIFIDATA",&network.wifiData,sizeof(network.wifiData)); // update data
|
||||||
nvs_commit(HAPClient::wifiNVS); // commit to NVS
|
nvs_commit(HAPClient::wifiNVS); // commit to NVS
|
||||||
Serial.print("\n*** WiFi Credentials ERASED! Re-starting ***\n\n");
|
Serial.print("\n*** WiFi Credentials SAVED! Re-starting ***\n\n");
|
||||||
delay(500);
|
|
||||||
statusLED.off();
|
statusLED.off();
|
||||||
|
delay(1000);
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -525,62 +528,62 @@ void Span::processSerialCommand(char *c){
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.print("\n*** Re-starting ***\n\n");
|
Serial.print("\n*** Re-starting ***\n\n");
|
||||||
delay(500);
|
|
||||||
statusLED.off();
|
statusLED.off();
|
||||||
|
delay(1000);
|
||||||
ESP.restart(); // re-start device
|
ESP.restart(); // re-start device
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X': {
|
case 'X': {
|
||||||
|
|
||||||
|
statusLED.off();
|
||||||
nvs_erase_all(HAPClient::wifiNVS);
|
nvs_erase_all(HAPClient::wifiNVS);
|
||||||
nvs_commit(HAPClient::wifiNVS);
|
nvs_commit(HAPClient::wifiNVS);
|
||||||
Serial.print("\n*** WiFi Credentials ERASED! Re-starting...\n\n");
|
Serial.print("\n*** WiFi Credentials ERASED! Re-starting...\n\n");
|
||||||
delay(500);
|
delay(1000);
|
||||||
statusLED.off();
|
|
||||||
ESP.restart(); // re-start device
|
ESP.restart(); // re-start device
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'H': {
|
case 'H': {
|
||||||
|
|
||||||
|
statusLED.off();
|
||||||
nvs_erase_all(HAPClient::hapNVS);
|
nvs_erase_all(HAPClient::hapNVS);
|
||||||
nvs_commit(HAPClient::hapNVS);
|
nvs_commit(HAPClient::hapNVS);
|
||||||
Serial.print("\n*** HomeSpan Device ID and Pairing Data DELETED! Restarting...\n\n");
|
Serial.print("\n*** HomeSpan Device ID and Pairing Data DELETED! Restarting...\n\n");
|
||||||
delay(1000);
|
delay(1000);
|
||||||
statusLED.off();
|
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R': {
|
case 'R': {
|
||||||
|
|
||||||
|
statusLED.off();
|
||||||
Serial.print("\n*** Restarting...\n\n");
|
Serial.print("\n*** Restarting...\n\n");
|
||||||
delay(1000);
|
delay(1000);
|
||||||
statusLED.off();
|
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F': {
|
case 'F': {
|
||||||
|
|
||||||
|
statusLED.off();
|
||||||
nvs_erase_all(HAPClient::hapNVS);
|
nvs_erase_all(HAPClient::hapNVS);
|
||||||
nvs_commit(HAPClient::hapNVS);
|
nvs_commit(HAPClient::hapNVS);
|
||||||
nvs_erase_all(HAPClient::wifiNVS);
|
nvs_erase_all(HAPClient::wifiNVS);
|
||||||
nvs_commit(HAPClient::wifiNVS);
|
nvs_commit(HAPClient::wifiNVS);
|
||||||
Serial.print("\n*** FACTORY RESET! Restarting...\n\n");
|
Serial.print("\n*** FACTORY RESET! Restarting...\n\n");
|
||||||
delay(1000);
|
delay(1000);
|
||||||
statusLED.off();
|
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'E': {
|
case 'E': {
|
||||||
|
|
||||||
|
statusLED.off();
|
||||||
nvs_flash_erase();
|
nvs_flash_erase();
|
||||||
Serial.print("\n*** ALL DATA ERASED! Restarting...\n\n");
|
Serial.print("\n*** ALL DATA ERASED! Restarting...\n\n");
|
||||||
delay(1000);
|
delay(1000);
|
||||||
statusLED.off();
|
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
#define DEFAULT_AP_PASSWORD "homespan" // change with homeSpan.setApPassword(pwd)
|
#define DEFAULT_AP_PASSWORD "homespan" // change with homeSpan.setApPassword(pwd)
|
||||||
|
|
||||||
#define DEFAULT_AP_TIMEOUT 120 // change with homeSpan.setApTimeout(nSeconds)
|
#define DEFAULT_AP_TIMEOUT 300 // change with homeSpan.setApTimeout(nSeconds)
|
||||||
#define DEFAULT_COMMAND_TIMEOUT 30 // change with homeSpan.setCommandTimeout(nSeconds)
|
#define DEFAULT_COMMAND_TIMEOUT 120 // change with homeSpan.setCommandTimeout(nSeconds)
|
||||||
|
|
||||||
#define DEFAULT_LOG_LEVEL 0 // change with homeSpan.setLogLevel(level)
|
#define DEFAULT_LOG_LEVEL 0 // change with homeSpan.setLogLevel(level)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue