Finished Time Stamping - Started Web Log Structure

This commit is contained in:
Gregg 2022-03-03 21:37:20 -06:00
parent 20ce79ef34
commit b6c019d1a8
3 changed files with 15 additions and 5 deletions

View File

@ -1274,7 +1274,8 @@ int HAPClient::getStatusURL(){
response+="<p><b>" + String(homeSpan.displayName) + "</b></p>\n"; response+="<p><b>" + String(homeSpan.displayName) + "</b></p>\n";
response+="<table>\n"; response+="<table>\n";
response+="<tr><td>Uptime:</td><td>" + String(uptime) + "</td></tr>\n"; response+="<tr><td>Up Time:</td><td>" + String(uptime) + "</td></tr>\n";
response+="<tr><td>Boot Time:</td><td>" + String(homeSpan.bootTime) + "</td></tr>\n";
response+="<tr><td>ESP32 Board:</td><td>" + String(ARDUINO_BOARD) + "</td></tr>\n"; response+="<tr><td>ESP32 Board:</td><td>" + String(ARDUINO_BOARD) + "</td></tr>\n";
response+="<tr><td>Arduino-ESP Version:</td><td>" + String(ARDUINO_ESP_VERSION) + "</td></tr>\n"; response+="<tr><td>Arduino-ESP Version:</td><td>" + String(ARDUINO_ESP_VERSION) + "</td></tr>\n";
response+="<tr><td>ESP-IDF Version:</td><td>" + String(ESP_IDF_VERSION_MAJOR) + "." + String(ESP_IDF_VERSION_MINOR) + "." + String(ESP_IDF_VERSION_PATCH) + "</td></tr>\n"; response+="<tr><td>ESP-IDF Version:</td><td>" + String(ESP_IDF_VERSION_MAJOR) + "." + String(ESP_IDF_VERSION_MINOR) + "." + String(ESP_IDF_VERSION_PATCH) + "</td></tr>\n";

View File

@ -563,10 +563,10 @@ void Span::checkConnect(){
if(timeServer){ if(timeServer){
Serial.printf("Acquiring Time from %s... ",timeServer,timeZone); Serial.printf("Acquiring Time from %s... ",timeServer,timeZone);
configTzTime(timeZone,timeServer); configTzTime(timeZone,timeServer);
struct tm timeinfo;
if(getLocalTime(&timeinfo)){ if(getLocalTime(&timeinfo)){
char c[65]; strftime(bootTime,sizeof(bootTime),"%c",&timeinfo);
strftime(c,64,"%a %b %e %Y %I:%M:%S %p",&timeinfo); Serial.printf("%s\n\n",bootTime);
Serial.printf("%s (%s)\n\n",c,timeZone);
} else { } else {
Serial.printf("Can't access Time Server - time-keeping disabled!\n\n"); Serial.printf("Can't access Time Server - time-keeping disabled!\n\n");
timeServer=NULL; timeServer=NULL;

View File

@ -94,6 +94,14 @@ struct SpanBuf{ // temporary storage buffer for us
/////////////////////////////// ///////////////////////////////
struct SpanWebLog{ // optional web status/log data
int maxEntries=-1; // max number of log entries; -1 = do not create log or status; 0 = create status but no log; 1..N = create status and log with N entries
int nEntries=0; // current number of log entries
char **entry; // pointers to log entries of arbitrary size
};
///////////////////////////////
struct Span{ struct Span{
const char *displayName; // display name for this device - broadcast as part of Bonjour MDNS const char *displayName; // display name for this device - broadcast as part of Bonjour MDNS
@ -115,7 +123,8 @@ struct Span{
char pairingCodeCommand[12]=""; // user-specified Pairing Code - only needed if Pairing Setup Code is specified in sketch using setPairingCode() char pairingCodeCommand[12]=""; // user-specified Pairing Code - only needed if Pairing Setup Code is specified in sketch using setPairingCode()
const char *timeZone=NULL; // optional time-zone specification const char *timeZone=NULL; // optional time-zone specification
const char *timeServer=NULL; // optional time server to use for acquiring clock time const char *timeServer=NULL; // optional time server to use for acquiring clock time
struct tm timeinfo; // optional time info structure char bootTime[33]="Unknown"; // boot time
SpanWebLog webLog; // optional web status/log
boolean connected=false; // WiFi connection status boolean connected=false; // WiFi connection status
unsigned long waitTime=60000; // time to wait (in milliseconds) between WiFi connection attempts unsigned long waitTime=60000; // time to wait (in milliseconds) between WiFi connection attempts