Created #defines in Settings.h for all statusLED.start() commands
Reviewed and simplified the number of different blinking patterns. All are now labeled in Settings.h
This commit is contained in:
parent
0a5cf52569
commit
0bdeb7508d
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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<network.numSSID;i++){
|
||||
Serial.print(" ");
|
||||
|
|
@ -286,7 +284,7 @@ void Span::initWifi(){
|
|||
|
||||
int nTries=0;
|
||||
|
||||
statusLED.start(1000);
|
||||
statusLED.start(LED_WIFI_CONNECTING);
|
||||
controlButton.reset();
|
||||
|
||||
while(WiFi.status()!=WL_CONNECTED){
|
||||
|
|
@ -305,7 +303,7 @@ void Span::initWifi(){
|
|||
|
||||
while(millis()-sTime<delayTime){
|
||||
if(controlButton.triggered(9999,3000) || (Serial.available() && readSerial(buf,1) && (buf[0]=='W'))){
|
||||
statusLED.start(100);
|
||||
statusLED.start(LED_ALERT);
|
||||
Serial.print("\n** Deleting WIFI Network Data **\n** Restarting...\n\n");
|
||||
nvs_erase_all(HAPClient::wifiNVS);
|
||||
nvs_commit(HAPClient::wifiNVS);
|
||||
|
|
@ -474,7 +472,7 @@ void Span::processSerialCommand(char *c){
|
|||
|
||||
Serial.print("\nDEVICE NOT YET PAIRED -- PLEASE PAIR WITH HOMEKIT APP\n\n");
|
||||
mdns_service_txt_item_set("_hap","_tcp","sf","1"); // set Status Flag = 1 (Table 6-8)
|
||||
statusLED.start(500,0.5,2,1000);
|
||||
statusLED.start(LED_PAIRING_NEEDED);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ boolean Network::serialConfigure(){
|
|||
Serial.print("\n");
|
||||
}
|
||||
|
||||
homeSpan.statusLED.start(1000); // slowly blink Status LED
|
||||
homeSpan.statusLED.start(LED_WIFI_CONNECTING);
|
||||
|
||||
while(WiFi.status()!=WL_CONNECTED){
|
||||
Serial.print("\nConnecting to: ");
|
||||
|
|
@ -83,7 +83,7 @@ boolean Network::serialConfigure(){
|
|||
Serial.print(WiFi.localIP());
|
||||
Serial.print("\n\n");
|
||||
|
||||
homeSpan.statusLED.start(250); // rapidly blink Status LED
|
||||
homeSpan.statusLED.start(LED_INPUT_NEEDED);
|
||||
|
||||
boolean okay=false;
|
||||
Serial.print("Specify new 8-digit Setup Code or leave blank to retain existing code...\n\n");
|
||||
|
|
@ -147,7 +147,7 @@ void Network::apConfigure(char *apName){
|
|||
Serial.print(apPassword);
|
||||
Serial.print("\n");
|
||||
|
||||
homeSpan.statusLED.start(100,0.5,2,500); // fast double blink
|
||||
homeSpan.statusLED.start(LED_AP_STARTED);
|
||||
|
||||
WiFiServer apServer(80);
|
||||
|
||||
|
|
@ -281,7 +281,7 @@ void Network::processRequest(char *body, char *formData){
|
|||
getFormValue(formData,"pwd",wifiData.pwd,MAX_PWD);
|
||||
|
||||
timer=millis();
|
||||
homeSpan.statusLED.start(1000);
|
||||
homeSpan.statusLED.start(LED_WIFI_CONNECTING);
|
||||
|
||||
responseBody+="<meta http-equiv = \"refresh\" content = \"2; url = /wifi-status\" />"
|
||||
"<p>Initiating WiFi connection to:</p><p><b>" + String(wifiData.ssid) + "</p>";
|
||||
|
|
@ -321,7 +321,7 @@ void Network::processRequest(char *body, char *formData){
|
|||
responseBody+="<center><button onclick=\"document.location='/landing-page'\">Cancel</button></center>";
|
||||
} else {
|
||||
|
||||
homeSpan.statusLED.start(500,0.3,2,1000); // slow double-blink
|
||||
homeSpan.statusLED.start(LED_AP_CONNECTED); // slow double-blink
|
||||
|
||||
responseBody+="<p>SUCCESS! Connected to:</p><p><b>" + String(wifiData.ssid) + "</b></p>";
|
||||
responseBody+="<p>You may enter new 8-digit Setup Code below, or leave blank to retain existing code.</p>";
|
||||
|
|
@ -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+="<p>Welcome to HomeSpan! This page allows you to configure the above HomeSpan device to connect to your WiFi network.</p>"
|
||||
"<p>The LED on this device should be <em>double-blinking</em> during this configuration.</p>"
|
||||
|
|
|
|||
|
|
@ -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 //
|
||||
|
|
|
|||
Loading…
Reference in New Issue