From f48cea8afb18d62e8f17a72b9b5c969aecf6e916 Mon Sep 17 00:00:00 2001 From: Gregg Date: Sun, 1 May 2022 17:03:07 -0500 Subject: [PATCH] Completed refactoring of 'i' CLI command All error checking and database validation is now done dynamically every time the 'i' command is run. --- src/HomeSpan.cpp | 20 ++++---------------- src/HomeSpan.h | 2 -- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index 666399e..5814f9f 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -180,20 +180,8 @@ void Span::pollTask() { if(!isInitialized){ processSerialCommand("i"); // print homeSpan configuration info - - if(nFatalErrors>0){ - Serial.print("\n*** PROGRAM HALTED DUE TO "); - Serial.print(nFatalErrors); - Serial.print(" FATAL ERROR"); - if(nFatalErrors>1) - Serial.print("S"); - Serial.print(" IN CONFIGURATION! ***\n\n"); - while(1); - } - - Serial.print("\n"); - - HAPClient::init(); // read NVS and load HAP settings + + HAPClient::init(); // read NVS and load HAP settings if(!strlen(network.wifiData.ssid)){ Serial.print("*** WIFI CREDENTIALS DATA NOT FOUND. "); @@ -1013,8 +1001,8 @@ void Span::processSerialCommand(const char *c){ } // Accessories - Serial.printf("\nDatabase Validation: Warnings=%d, Errors=%d\n\n",nWarnings,nErrors); - Serial.printf("Configured as Bridge: %s\n\n",isBridge?"YES":"NO"); + Serial.printf("\nConfigured as Bridge: %s\n\n",isBridge?"YES":"NO"); + Serial.printf("Database Validation: Warnings=%d, Errors=%d\n\n",nWarnings,nErrors); char d[]="------------------------------"; Serial.printf("%-30s %8s %10s %s %s %s %s %s\n","Service","UUID","AID","IID","Update","Loop","Button","Linked Services"); diff --git a/src/HomeSpan.h b/src/HomeSpan.h index d5e70e2..3e3ae37 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -157,8 +157,6 @@ struct Span{ char category[3]=""; // category ID of primary accessory - broadcast as Bonjour field "ci" (HAP Section 13) unsigned long snapTime; // current time (in millis) snapped before entering Service loops() or updates() boolean isInitialized=false; // flag indicating HomeSpan has been initialized - int nFatalErrors=0; // number of fatal errors in user-defined configuration - int nWarnings=0; // number of warnings errors in user-defined configuration boolean isBridge=true; // flag indicating whether device is configured as a bridge (i.e. first Accessory contains nothing but AccessoryInformation and HAPProtocolInformation) HapQR qrCode; // optional QR Code to use for pairing const char *sketchVersion="n/a"; // version of the sketch