Logging format improvements plus debounce serial at startup
This commit is contained in:
parent
5f6bb1dd6b
commit
5061f96a85
|
@ -221,18 +221,18 @@ static int run_face_recognition(dl_matrix3du_t *image_matrix, box_array_t *net_b
|
||||||
int8_t left_sample_face = enroll_face(&id_list, aligned_face);
|
int8_t left_sample_face = enroll_face(&id_list, aligned_face);
|
||||||
|
|
||||||
if(left_sample_face == (ENROLL_CONFIRM_TIMES - 1)){
|
if(left_sample_face == (ENROLL_CONFIRM_TIMES - 1)){
|
||||||
Serial.printf("Enrolling Face ID: %d\n", this_face);
|
Serial.printf("Enrolling Face ID: %d\r\n", this_face);
|
||||||
}
|
}
|
||||||
Serial.printf("Enrolling Face ID: %d sample %d\n", this_face, ENROLL_CONFIRM_TIMES - left_sample_face);
|
Serial.printf("Enrolling Face ID: %d sample %d\r\n", this_face, ENROLL_CONFIRM_TIMES - left_sample_face);
|
||||||
rgb_printf(image_matrix, FACE_COLOR_CYAN, "ID[%u] Sample[%u]", this_face, ENROLL_CONFIRM_TIMES - left_sample_face);
|
rgb_printf(image_matrix, FACE_COLOR_CYAN, "ID[%u] Sample[%u]", this_face, ENROLL_CONFIRM_TIMES - left_sample_face);
|
||||||
if (left_sample_face == 0){
|
if (left_sample_face == 0){
|
||||||
is_enrolling = 0;
|
is_enrolling = 0;
|
||||||
Serial.printf("Enrolled Face ID: %d\n", this_face);
|
Serial.printf("Enrolled Face ID: %d\r\n", this_face);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
matched_id = recognize_face(&id_list, aligned_face);
|
matched_id = recognize_face(&id_list, aligned_face);
|
||||||
if (matched_id >= 0) {
|
if (matched_id >= 0) {
|
||||||
Serial.printf("Match Face ID: %u\n", matched_id);
|
Serial.printf("Match Face ID: %u\r\n", matched_id);
|
||||||
rgb_printf(image_matrix, FACE_COLOR_GREEN, "Hello Subject %u", matched_id);
|
rgb_printf(image_matrix, FACE_COLOR_GREEN, "Hello Subject %u", matched_id);
|
||||||
} else {
|
} else {
|
||||||
Serial.println("No Match Found");
|
Serial.println("No Match Found");
|
||||||
|
@ -250,58 +250,58 @@ static int run_face_recognition(dl_matrix3du_t *image_matrix, box_array_t *net_b
|
||||||
}
|
}
|
||||||
|
|
||||||
void serialDump() {
|
void serialDump() {
|
||||||
Serial.println("\nPreferences file: ");
|
Serial.println("\r\nPreferences file: ");
|
||||||
dumpPrefs(SPIFFS);
|
dumpPrefs(SPIFFS);
|
||||||
if (critERR.length() > 0) {
|
if (critERR.length() > 0) {
|
||||||
Serial.printf("\n\nA critical error has occurred when initialising Camera Hardware, see startup megssages\n");
|
Serial.printf("\r\n\r\nA critical error has occurred when initialising Camera Hardware, see startup megssages\r\n");
|
||||||
}
|
}
|
||||||
// Module
|
// Module
|
||||||
Serial.printf("Name: %s\n", myName);
|
Serial.printf("Name: %s\r\n", myName);
|
||||||
Serial.printf("Firmware: %s (base: %s)\n", myVer, baseVersion);
|
Serial.printf("Firmware: %s (base: %s)\r\n", myVer, baseVersion);
|
||||||
float sketchPct = 100 * sketchSize / sketchSpace;
|
float sketchPct = 100 * sketchSize / sketchSpace;
|
||||||
Serial.printf("Sketch Size: %i (total: %i, %.1f%% used)\n", sketchSize, sketchSpace, sketchPct);
|
Serial.printf("Sketch Size: %i (total: %i, %.1f%% used)\r\n", sketchSize, sketchSpace, sketchPct);
|
||||||
Serial.printf("MD5: %s\n", sketchMD5.c_str());
|
Serial.printf("MD5: %s\r\n", sketchMD5.c_str());
|
||||||
Serial.printf("ESP sdk: %s\n", ESP.getSdkVersion());
|
Serial.printf("ESP sdk: %s\r\n", ESP.getSdkVersion());
|
||||||
// Network
|
// Network
|
||||||
if (accesspoint) {
|
if (accesspoint) {
|
||||||
if (captivePortal) {
|
if (captivePortal) {
|
||||||
Serial.printf("WiFi Mode: AccessPoint with captive portal\n");
|
Serial.printf("WiFi Mode: AccessPoint with captive portal\r\n");
|
||||||
} else {
|
} else {
|
||||||
Serial.printf("WiFi Mode: AccessPoint\n");
|
Serial.printf("WiFi Mode: AccessPoint\r\n");
|
||||||
}
|
}
|
||||||
Serial.printf("WiFi SSID: %s\n", apName);
|
Serial.printf("WiFi SSID: %s\r\n", apName);
|
||||||
} else {
|
} else {
|
||||||
Serial.printf("WiFi Mode: Client\n");
|
Serial.printf("WiFi Mode: Client\r\n");
|
||||||
String ssidName = WiFi.SSID();
|
String ssidName = WiFi.SSID();
|
||||||
Serial.printf("WiFi Ssid: %s\n", ssidName.c_str());
|
Serial.printf("WiFi Ssid: %s\r\n", ssidName.c_str());
|
||||||
Serial.printf("WiFi Rssi: %i\n", WiFi.RSSI());
|
Serial.printf("WiFi Rssi: %i\r\n", WiFi.RSSI());
|
||||||
String bssid = WiFi.BSSIDstr();
|
String bssid = WiFi.BSSIDstr();
|
||||||
Serial.printf("WiFi BSSID: %s\n", bssid.c_str());
|
Serial.printf("WiFi BSSID: %s\r\n", bssid.c_str());
|
||||||
}
|
}
|
||||||
Serial.printf("WiFi IP address: %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
|
Serial.printf("WiFi IP address: %d.%d.%d.%d\r\n", ip[0], ip[1], ip[2], ip[3]);
|
||||||
if (!accesspoint) {
|
if (!accesspoint) {
|
||||||
Serial.printf("WiFi Netmask: %d.%d.%d.%d\n", net[0], net[1], net[2], net[3]);
|
Serial.printf("WiFi Netmask: %d.%d.%d.%d\r\n", net[0], net[1], net[2], net[3]);
|
||||||
Serial.printf("WiFi Gateway: %d.%d.%d.%d\n", gw[0], gw[1], gw[2], gw[3]);
|
Serial.printf("WiFi Gateway: %d.%d.%d.%d\r\n", gw[0], gw[1], gw[2], gw[3]);
|
||||||
}
|
}
|
||||||
Serial.printf("WiFi Http port: %i, Stream port: %i\n", httpPort, streamPort);
|
Serial.printf("WiFi Http port: %i, Stream port: %i\r\n", httpPort, streamPort);
|
||||||
byte mac[6];
|
byte mac[6];
|
||||||
WiFi.macAddress(mac);
|
WiFi.macAddress(mac);
|
||||||
Serial.printf("WiFi MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
Serial.printf("WiFi MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
// System
|
// System
|
||||||
int64_t sec = esp_timer_get_time() / 1000000;
|
int64_t sec = esp_timer_get_time() / 1000000;
|
||||||
int64_t upDays = int64_t(floor(sec/86400));
|
int64_t upDays = int64_t(floor(sec/86400));
|
||||||
int upHours = int64_t(floor(sec/3600)) % 24;
|
int upHours = int64_t(floor(sec/3600)) % 24;
|
||||||
int upMin = int64_t(floor(sec/60)) % 60;
|
int upMin = int64_t(floor(sec/60)) % 60;
|
||||||
int upSec = sec % 60;
|
int upSec = sec % 60;
|
||||||
Serial.printf("System up: %" PRId64 ":%02i:%02i:%02i (d:h:m:s)\n", upDays, upHours, upMin, upSec);
|
Serial.printf("System up: %" PRId64 ":%02i:%02i:%02i (d:h:m:s)\r\n", upDays, upHours, upMin, upSec);
|
||||||
Serial.printf("Active streams: %i, Previous streams: %lu, Images captured: %lu\n", streamCount, streamsServed, imagesServed);
|
Serial.printf("Active streams: %i, Previous streams: %lu, Images captured: %lu\r\n", streamCount, streamsServed, imagesServed);
|
||||||
Serial.printf("Freq: %i MHz\n", ESP.getCpuFreqMHz());
|
Serial.printf("Freq: %i MHz\r\n", ESP.getCpuFreqMHz());
|
||||||
Serial.printf("Heap: %i, free: %i, min free: %i, max block: %i\n", ESP.getHeapSize(), ESP.getFreeHeap(), ESP.getMinFreeHeap(), ESP.getMaxAllocHeap());
|
Serial.printf("Heap: %i, free: %i, min free: %i, max block: %i\r\n", ESP.getHeapSize(), ESP.getFreeHeap(), ESP.getMinFreeHeap(), ESP.getMaxAllocHeap());
|
||||||
Serial.printf("Psram: %i, free: %i, min free: %i, max block: %i\n", ESP.getPsramSize(), ESP.getFreePsram(), ESP.getMinFreePsram(), ESP.getMaxAllocPsram());
|
Serial.printf("Psram: %i, free: %i, min free: %i, max block: %i\r\n", ESP.getPsramSize(), ESP.getFreePsram(), ESP.getMinFreePsram(), ESP.getMaxAllocPsram());
|
||||||
if (filesystem) {
|
if (filesystem) {
|
||||||
Serial.printf("Spiffs: %i, used: %i\n", SPIFFS.totalBytes(), SPIFFS.usedBytes());
|
Serial.printf("Spiffs: %i, used: %i\r\n", SPIFFS.totalBytes(), SPIFFS.usedBytes());
|
||||||
}
|
}
|
||||||
Serial.printf("Enrolled faces: %i (max %i)\n", id_list.count, id_list.size);
|
Serial.printf("Enrolled faces: %i (max %i)\r\n", id_list.count, id_list.size);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
||||||
esp_camera_fb_return(fb);
|
esp_camera_fb_return(fb);
|
||||||
int64_t fr_end = esp_timer_get_time();
|
int64_t fr_end = esp_timer_get_time();
|
||||||
if (debugData) {
|
if (debugData) {
|
||||||
Serial.printf("JPG: %uB %ums\n", (uint32_t)(fb_len), (uint32_t)((fr_end - fr_start)/1000));
|
Serial.printf("JPG: %uB %ums\r\n", (uint32_t)(fb_len), (uint32_t)((fr_end - fr_start)/1000));
|
||||||
}
|
}
|
||||||
imagesServed++;
|
imagesServed++;
|
||||||
if (autoLamp && (lampVal != -1)) setLamp(0);
|
if (autoLamp && (lampVal != -1)) setLamp(0);
|
||||||
|
@ -411,7 +411,7 @@ static esp_err_t capture_handler(httpd_req_t *req){
|
||||||
|
|
||||||
int64_t fr_end = esp_timer_get_time();
|
int64_t fr_end = esp_timer_get_time();
|
||||||
if (debugData) {
|
if (debugData) {
|
||||||
Serial.printf("FACE: %uB %ums %s%d\n", (uint32_t)(jchunk.len), (uint32_t)((fr_end - fr_start)/1000), detected?"DETECTED ":"", face_id);
|
Serial.printf("FACE: %uB %ums %s%d\r\n", (uint32_t)(jchunk.len), (uint32_t)((fr_end - fr_start)/1000), detected?"DETECTED ":"", face_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
imagesServed++;
|
imagesServed++;
|
||||||
|
@ -559,7 +559,7 @@ static esp_err_t stream_handler(httpd_req_t *req){
|
||||||
frame_time /= 1000;
|
frame_time /= 1000;
|
||||||
uint32_t avg_frame_time = ra_filter_run(&ra_filter, frame_time);
|
uint32_t avg_frame_time = ra_filter_run(&ra_filter, frame_time);
|
||||||
if (debugData) {
|
if (debugData) {
|
||||||
Serial.printf("MJPG: %uB %ums (%.1ffps), AVG: %ums (%.1ffps), %u+%u+%u+%u=%u %s%d\n",
|
Serial.printf("MJPG: %uB %ums (%.1ffps), AVG: %ums (%.1ffps), %u+%u+%u+%u=%u %s%d\r\n",
|
||||||
(uint32_t)(_jpg_buf_len),
|
(uint32_t)(_jpg_buf_len),
|
||||||
(uint32_t)frame_time, 1000.0 / (uint32_t)frame_time,
|
(uint32_t)frame_time, 1000.0 / (uint32_t)frame_time,
|
||||||
avg_frame_time, 1000.0 / avg_frame_time,
|
avg_frame_time, 1000.0 / avg_frame_time,
|
||||||
|
@ -793,7 +793,7 @@ static esp_err_t logo_svg_handler(httpd_req_t *req){
|
||||||
|
|
||||||
static esp_err_t dump_handler(httpd_req_t *req){
|
static esp_err_t dump_handler(httpd_req_t *req){
|
||||||
flashLED(75);
|
flashLED(75);
|
||||||
Serial.println("\nDump Requested via Web");
|
Serial.println("\r\nDump Requested via Web");
|
||||||
serialDump();
|
serialDump();
|
||||||
static char dumpOut[2000] = "";
|
static char dumpOut[2000] = "";
|
||||||
char * d = dumpOut;
|
char * d = dumpOut;
|
||||||
|
@ -1100,7 +1100,7 @@ void startCameraServer(int hPort, int sPort){
|
||||||
// Request Handlers; config.max_uri_handlers (above) must be >= the number of handlers
|
// Request Handlers; config.max_uri_handlers (above) must be >= the number of handlers
|
||||||
config.server_port = hPort;
|
config.server_port = hPort;
|
||||||
config.ctrl_port = hPort;
|
config.ctrl_port = hPort;
|
||||||
Serial.printf("Starting web server on port: '%d'\n", config.server_port);
|
Serial.printf("Starting web server on port: '%d'\r\n", config.server_port);
|
||||||
if (httpd_start(&camera_httpd, &config) == ESP_OK) {
|
if (httpd_start(&camera_httpd, &config) == ESP_OK) {
|
||||||
if (critERR.length() > 0) {
|
if (critERR.length() > 0) {
|
||||||
httpd_register_uri_handler(camera_httpd, &error_uri);
|
httpd_register_uri_handler(camera_httpd, &error_uri);
|
||||||
|
@ -1120,7 +1120,7 @@ void startCameraServer(int hPort, int sPort){
|
||||||
|
|
||||||
config.server_port = sPort;
|
config.server_port = sPort;
|
||||||
config.ctrl_port = sPort;
|
config.ctrl_port = sPort;
|
||||||
Serial.printf("Starting stream server on port: '%d'\n", config.server_port);
|
Serial.printf("Starting stream server on port: '%d'\r\n", config.server_port);
|
||||||
if (httpd_start(&stream_httpd, &config) == ESP_OK) {
|
if (httpd_start(&stream_httpd, &config) == ESP_OK) {
|
||||||
if (critERR.length() > 0) {
|
if (critERR.length() > 0) {
|
||||||
httpd_register_uri_handler(camera_httpd, &error_uri);
|
httpd_register_uri_handler(camera_httpd, &error_uri);
|
||||||
|
|
|
@ -245,7 +245,7 @@ void WifiSetup() {
|
||||||
Serial.println();
|
Serial.println();
|
||||||
byte mac[6] = {0,0,0,0,0,0};
|
byte mac[6] = {0,0,0,0,0,0};
|
||||||
WiFi.macAddress(mac);
|
WiFi.macAddress(mac);
|
||||||
Serial.printf("MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
Serial.printf("MAC address: %02X:%02X:%02X:%02X:%02X:%02X\r\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
|
|
||||||
int bestStation = -1;
|
int bestStation = -1;
|
||||||
long bestRSSI = -1024;
|
long bestRSSI = -1024;
|
||||||
|
@ -253,9 +253,9 @@ void WifiSetup() {
|
||||||
uint8_t bestBSSID[6];
|
uint8_t bestBSSID[6];
|
||||||
if (stationCount > firstStation) {
|
if (stationCount > firstStation) {
|
||||||
// We have a list to scan
|
// We have a list to scan
|
||||||
Serial.printf("Scanning local Wifi Networks\n");
|
Serial.printf("Scanning local Wifi Networks\r\n");
|
||||||
int stationsFound = WiFi.scanNetworks();
|
int stationsFound = WiFi.scanNetworks();
|
||||||
Serial.printf("%i networks found\n", stationsFound);
|
Serial.printf("%i networks found\r\n", stationsFound);
|
||||||
if (stationsFound > 0) {
|
if (stationsFound > 0) {
|
||||||
for (int i = 0; i < stationsFound; ++i) {
|
for (int i = 0; i < stationsFound; ++i) {
|
||||||
// Print SSID and RSSI for each network found
|
// Print SSID and RSSI for each network found
|
||||||
|
@ -298,7 +298,7 @@ void WifiSetup() {
|
||||||
Serial.println("AccessPoint mode selected in config");
|
Serial.println("AccessPoint mode selected in config");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Serial.printf("Connecting to Wifi Network %d: [%02X:%02X:%02X:%02X:%02X:%02X] %s \n",
|
Serial.printf("Connecting to Wifi Network %d: [%02X:%02X:%02X:%02X:%02X:%02X] %s \r\n",
|
||||||
bestStation, bestBSSID[0], bestBSSID[1], bestBSSID[2], bestBSSID[3],
|
bestStation, bestBSSID[0], bestBSSID[1], bestBSSID[2], bestBSSID[3],
|
||||||
bestBSSID[4], bestBSSID[5], bestSSID);
|
bestBSSID[4], bestBSSID[5], bestSSID);
|
||||||
// Apply static settings if necesscary
|
// Apply static settings if necesscary
|
||||||
|
@ -348,9 +348,9 @@ void WifiSetup() {
|
||||||
ip = WiFi.localIP();
|
ip = WiFi.localIP();
|
||||||
net = WiFi.subnetMask();
|
net = WiFi.subnetMask();
|
||||||
gw = WiFi.gatewayIP();
|
gw = WiFi.gatewayIP();
|
||||||
Serial.printf("IP address: %d.%d.%d.%d\n",ip[0],ip[1],ip[2],ip[3]);
|
Serial.printf("IP address: %d.%d.%d.%d\r\n",ip[0],ip[1],ip[2],ip[3]);
|
||||||
Serial.printf("Netmask : %d.%d.%d.%d\n",net[0],net[1],net[2],net[3]);
|
Serial.printf("Netmask : %d.%d.%d.%d\r\n",net[0],net[1],net[2],net[3]);
|
||||||
Serial.printf("Gateway : %d.%d.%d.%d\n",gw[0],gw[1],gw[2],gw[3]);
|
Serial.printf("Gateway : %d.%d.%d.%d\r\n",gw[0],gw[1],gw[2],gw[3]);
|
||||||
// Flash the LED to show we are connected
|
// Flash the LED to show we are connected
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
flashLED(50);
|
flashLED(50);
|
||||||
|
@ -395,7 +395,7 @@ void WifiSetup() {
|
||||||
net = WiFi.subnetMask();
|
net = WiFi.subnetMask();
|
||||||
gw = WiFi.gatewayIP();
|
gw = WiFi.gatewayIP();
|
||||||
strcpy(apName, stationList[0].ssid);
|
strcpy(apName, stationList[0].ssid);
|
||||||
Serial.printf("IP address: %d.%d.%d.%d\n",ip[0],ip[1],ip[2],ip[3]);
|
Serial.printf("IP address: %d.%d.%d.%d\r\n",ip[0],ip[1],ip[2],ip[3]);
|
||||||
// Flash the LED to show we are connected
|
// Flash the LED to show we are connected
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
flashLED(150);
|
flashLED(150);
|
||||||
|
@ -425,9 +425,11 @@ void setup() {
|
||||||
Serial.println(baseVersion);
|
Serial.println(baseVersion);
|
||||||
|
|
||||||
if (stationCount == 0) {
|
if (stationCount == 0) {
|
||||||
Serial.println("\nFatal Error; Halting");
|
Serial.println("\r\nFatal Error; Halting");
|
||||||
Serial.println("No wifi ssid details have been configured; we cannot connect to WiFi or start our own AccessPoint");
|
while (true) {
|
||||||
while (true) delay(1000);
|
Serial.println("No wifi details have been configured; we cannot connect to existing WiFi or start our own AccessPoint, there is no point in proceeding.");
|
||||||
|
delay(5000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LED_PIN) // If we have a notification LED, set it to output
|
#if defined(LED_PIN) // If we have a notification LED, set it to output
|
||||||
|
@ -477,9 +479,9 @@ void setup() {
|
||||||
esp_err_t err = esp_camera_init(&config);
|
esp_err_t err = esp_camera_init(&config);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
delay(100); // need a delay here or the next serial o/p gets missed
|
delay(100); // need a delay here or the next serial o/p gets missed
|
||||||
Serial.printf("\n\nCRITICAL FAILURE: Camera sensor failed to initialise.\n\n");
|
Serial.printf("\r\n\r\nCRITICAL FAILURE: Camera sensor failed to initialise.\r\n\r\n");
|
||||||
Serial.printf("A full (hard, power off/on) reboot will probably be needed to recover from this.\n");
|
Serial.printf("A full (hard, power off/on) reboot will probably be needed to recover from this.\r\n");
|
||||||
Serial.printf("Meanwhile; this unit will reboot in 1 minute since these errors sometime clear automatically\n");
|
Serial.printf("Meanwhile; this unit will reboot in 1 minute since these errors sometime clear automatically\r\n");
|
||||||
// Reset the I2C bus.. may help when rebooting.
|
// Reset the I2C bus.. may help when rebooting.
|
||||||
periph_module_disable(PERIPH_I2C0_MODULE); // try to shut I2C down properly in case that is the problem
|
periph_module_disable(PERIPH_I2C0_MODULE); // try to shut I2C down properly in case that is the problem
|
||||||
periph_module_disable(PERIPH_I2C1_MODULE);
|
periph_module_disable(PERIPH_I2C1_MODULE);
|
||||||
|
@ -618,22 +620,25 @@ void setup() {
|
||||||
sprintf(streamURL, "http://%d.%d.%d.%d:%d/", ip[0], ip[1], ip[2], ip[3], streamPort);
|
sprintf(streamURL, "http://%d.%d.%d.%d:%d/", ip[0], ip[1], ip[2], ip[3], streamPort);
|
||||||
#endif
|
#endif
|
||||||
if (critERR.length() == 0) {
|
if (critERR.length() == 0) {
|
||||||
Serial.printf("\nCamera Ready!\nUse '%s' to connect\n", httpURL);
|
Serial.printf("\r\nCamera Ready!\r\nUse '%s' to connect\r\n", httpURL);
|
||||||
Serial.printf("Stream viewer available at '%sview'\n", streamURL);
|
Serial.printf("Stream viewer available at '%sview'\r\n", streamURL);
|
||||||
Serial.printf("Raw stream URL is '%s'\n", streamURL);
|
Serial.printf("Raw stream URL is '%s'\r\n", streamURL);
|
||||||
#if defined(DEBUG_DEFAULT_ON)
|
#if defined(DEBUG_DEFAULT_ON)
|
||||||
debugOn();
|
debugOn();
|
||||||
#else
|
#else
|
||||||
debugOff();
|
debugOff();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
Serial.printf("\nCamera unavailable due to initialisation errors.\n\n");
|
Serial.printf("\r\nCamera unavailable due to initialisation errors.\r\n\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used when dumping status; these are slow functions, so just do them once during startup
|
// Used when dumping status; these are slow functions, so just do them once during startup
|
||||||
sketchSize = ESP.getSketchSize();
|
sketchSize = ESP.getSketchSize();
|
||||||
sketchSpace = ESP.getFreeSketchSpace();
|
sketchSpace = ESP.getFreeSketchSpace();
|
||||||
sketchMD5 = ESP.getSketchMD5();
|
sketchMD5 = ESP.getSketchMD5();
|
||||||
|
|
||||||
|
// As a final init step chomp out the serial buffer in case we have recieved mis-keys or garbage during startup
|
||||||
|
while (Serial.available()) Serial.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
12
storage.cpp
12
storage.cpp
|
@ -15,7 +15,7 @@ extern int8_t recognition_enabled; // Face recognition enable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
|
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
|
||||||
Serial.printf("Listing SPIFFS directory: %s\n", dirname);
|
Serial.printf("Listing SPIFFS directory: %s\r\n", dirname);
|
||||||
|
|
||||||
File root = fs.open(dirname);
|
File root = fs.open(dirname);
|
||||||
if(!root){
|
if(!root){
|
||||||
|
@ -53,7 +53,7 @@ void dumpPrefs(fs::FS &fs){
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
Serial.printf("%s not found, nothing to dump.\n", PREFERENCES_FILE);
|
Serial.printf("%s not found, nothing to dump.\r\n", PREFERENCES_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ void loadPrefs(fs::FS &fs){
|
||||||
if (fs.exists(PREFERENCES_FILE)) {
|
if (fs.exists(PREFERENCES_FILE)) {
|
||||||
// read file into a string
|
// read file into a string
|
||||||
String prefs;
|
String prefs;
|
||||||
Serial.printf("Loading preferences from file %s\n", PREFERENCES_FILE);
|
Serial.printf("Loading preferences from file %s\r\n", PREFERENCES_FILE);
|
||||||
File file = fs.open(PREFERENCES_FILE, FILE_READ);
|
File file = fs.open(PREFERENCES_FILE, FILE_READ);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
Serial.println("Failed to open preferences file");
|
Serial.println("Failed to open preferences file");
|
||||||
|
@ -109,15 +109,15 @@ void loadPrefs(fs::FS &fs){
|
||||||
file.close();
|
file.close();
|
||||||
dumpPrefs(SPIFFS);
|
dumpPrefs(SPIFFS);
|
||||||
} else {
|
} else {
|
||||||
Serial.printf("Preference file %s not found; using system defaults.\n", PREFERENCES_FILE);
|
Serial.printf("Preference file %s not found; using system defaults.\r\n", PREFERENCES_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void savePrefs(fs::FS &fs){
|
void savePrefs(fs::FS &fs){
|
||||||
if (fs.exists(PREFERENCES_FILE)) {
|
if (fs.exists(PREFERENCES_FILE)) {
|
||||||
Serial.printf("Updating %s\n", PREFERENCES_FILE);
|
Serial.printf("Updating %s\r\n", PREFERENCES_FILE);
|
||||||
} else {
|
} else {
|
||||||
Serial.printf("Creating %s\n", PREFERENCES_FILE);
|
Serial.printf("Creating %s\r\n", PREFERENCES_FILE);
|
||||||
}
|
}
|
||||||
File file = fs.open(PREFERENCES_FILE, FILE_WRITE);
|
File file = fs.open(PREFERENCES_FILE, FILE_WRITE);
|
||||||
static char json_response[1024];
|
static char json_response[1024];
|
||||||
|
|
Loading…
Reference in New Issue