diff --git a/src/HAP.cpp b/src/HAP.cpp
index f69d73d..3c7adda 100644
--- a/src/HAP.cpp
+++ b/src/HAP.cpp
@@ -1514,7 +1514,7 @@ void HAPClient::removeController(uint8_t *id){
removeControllers();
LOG1("That was last Admin Controller! Removing any remaining Regular Controllers and unpairing Accessory\n");
mdns_service_txt_item_set("_hap","_tcp","sf","1"); // set Status Flag = 1 (Table 6-8)
- homeSpan.statusLED.start(500,0.5,2,1000);
+ homeSpan.statusLED.start(LED_PAIRING_NEEDED);
}
LOG2("\n");
diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp
index 0524ece..f1fbb30 100644
--- a/src/HomeSpan.cpp
+++ b/src/HomeSpan.cpp
@@ -57,9 +57,9 @@ void Span::begin(Category catID, char *displayName, char *hostNameBase, char *mo
Serial.print("\n\n");
if(!digitalRead(controlPin)){ // factory reset pin is low upon start-up
+ Serial.print("** CONTROL BUTTON PRESSED DURING STARTUP! PERFORMING FACTORY RESET **\n\n");
+ statusLED.start(LED_ALERT);
nvs_flash_erase(); // erase NVS storage
- Serial.print("** CONTROL BUTTON PRESSED DURING STARTUP! ALL STORED DATA ERASED **\n\n");
- statusLED.start(100);
delay(5000);
Serial.print("Re-starting...\n\n");
statusLED.off();
@@ -84,7 +84,7 @@ void Span::poll() {
if(!HAPClient::nAdminControllers()){
Serial.print("DEVICE NOT YET PAIRED -- PLEASE PAIR WITH HOMEKIT APP\n\n");
- statusLED.start(500,0.5,2,1000);
+ statusLED.start(LED_PAIRING_NEEDED);
} else {
statusLED.on();
}
@@ -163,17 +163,15 @@ void Span::poll() {
HAPClient::checkTimedWrites();
if(controlButton.primed()){
- statusLED.start(500);
+ statusLED.start(LED_ALERT);
}
if(controlButton.triggered(5000,10000)){
+ statusLED.off();
if(controlButton.longPress()){
- statusLED.start(200);
delay(2000);
- statusLED.off();
processSerialCommand("W"); // DELETE WiFi Data and Restart
} else {
- statusLED.off();
controlButton.reset();
processSerialCommand("U"); // UNPAIR Device
}
@@ -228,7 +226,7 @@ void Span::initWifi(){
WiFi.disconnect();
Serial.print("Network configuration required! Found the following SSIDs:\n\n");
- statusLED.start(250); // rapidly blink Status LED
+ statusLED.start(LED_INPUT_NEEDED); // rapidly blink Status LED
for(int i=0;i
Initiating WiFi connection to:
" + String(wifiData.ssid) + "
"; @@ -321,7 +321,7 @@ void Network::processRequest(char *body, char *formData){ responseBody+="SUCCESS! Connected to:
" + String(wifiData.ssid) + "
"; responseBody+="You may enter new 8-digit Setup Code below, or leave blank to retain existing code.
"; @@ -343,7 +343,7 @@ void Network::processRequest(char *body, char *formData){ landingPage=true; - homeSpan.statusLED.start(500,0.3,2,1000); // slow double-blink + homeSpan.statusLED.start(LED_AP_CONNECTED); responseBody+="Welcome to HomeSpan! This page allows you to configure the above HomeSpan device to connect to your WiFi network.
" "The LED on this device should be double-blinking during this configuration.
" diff --git a/src/Settings.h b/src/Settings.h index 6a0f3bd..5cb72f9 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -9,7 +9,7 @@ #define HOMESPAN_VERSION "1.0.0" ////////////////////////////////////////////////////// -// DEFAULT SETTINGS +// DEFAULT SETTINGS // #define DEFAULT_DISPLAY_NAME "HomeSpan Server" // change with optional second argument in homeSpan.begin() #define DEFAULT_HOST_NAME "HomeSpan" // change with optional third argument in homeSpan.begin() @@ -28,6 +28,17 @@ #define DEFAULT_MAX_CONNECTIONS 8 // change with homeSpan.setMaxConnections(num); +///////////////////////////////////////////////////// +// STATUS LED SETTINGS // + +#define LED_PAIRING_NEEDED 1000,0.9 // drop-out +#define LED_ALERT 100 // rapid flashing +#define LED_WIFI_CONNECTING 2000 // slow flashing +#define LED_INPUT_NEEDED 500 // medium flashing +#define LED_AP_STARTED 100,0.5,2,500 // rapid double-blink +#define LED_AP_CONNECTED 500,0.3,2,1000 // slow double-blink + + ///////////////////////////////////////////////////// // Message Log Level Control Macros // // 0=Minimal, 1=Informative, 2=All //