mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-03-30 17:02:12 +02:00
improve logging
This commit is contained in:
parent
2509030c49
commit
88fdfa577a
2 changed files with 17 additions and 57 deletions
|
|
@ -1,3 +1,5 @@
|
|||
#define LOG_LOCAL_LEVEL ESP_LOG_INFO
|
||||
#include "esp_log.h"
|
||||
#include <WiFi.h>
|
||||
#include <LittleFS.h>
|
||||
#include <esp_task_wdt.h>
|
||||
|
|
@ -22,59 +24,11 @@ GitUpdater git;
|
|||
|
||||
uint32_t oldheap = 0;
|
||||
|
||||
void inline checkCoreDumpPartition() {
|
||||
esp_core_dump_init();
|
||||
esp_core_dump_summary_t *summary =
|
||||
static_cast<esp_core_dump_summary_t *>(malloc(sizeof(esp_core_dump_summary_t)));
|
||||
if (summary) {
|
||||
esp_err_t err = esp_core_dump_get_summary(summary);
|
||||
if (err == ESP_OK) {
|
||||
log_i("Getting core dump summary ok.");
|
||||
|
||||
} else {
|
||||
log_e("Getting core dump summary not ok. Error: %d", (int)err);
|
||||
log_e("Probably no coredump present yet.");
|
||||
log_e("esp_core_dump_image_check() = %d", esp_core_dump_image_check());
|
||||
}
|
||||
free(summary);
|
||||
}
|
||||
}
|
||||
|
||||
void listDir(const char *dirname, uint8_t levels) {
|
||||
Serial.printf("Listing: %s\n", dirname);
|
||||
File root = LittleFS.open(dirname);
|
||||
if (!root || !root.isDirectory()) {
|
||||
Serial.println("Failed to open directory");
|
||||
return;
|
||||
}
|
||||
File file = root.openNextFile();
|
||||
while (file) {
|
||||
if (file.isDirectory()) {
|
||||
Serial.printf(" DIR : %s\n", file.name());
|
||||
if (levels) listDir(file.path(), levels - 1);
|
||||
} else {
|
||||
Serial.printf(" FILE: %-30s %d bytes\n", file.name(), file.size());
|
||||
}
|
||||
file = root.openNextFile();
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.println();
|
||||
Serial.println("Startup/Boot....");
|
||||
Serial.println("Mounting File System...");
|
||||
checkCoreDumpPartition();
|
||||
|
||||
if (LittleFS.begin()) {
|
||||
Serial.printf("\nTotal: %d bytes\n", LittleFS.totalBytes());
|
||||
Serial.printf("Used: %d bytes\n", LittleFS.usedBytes());
|
||||
Serial.printf("Free: %d bytes\n", LittleFS.totalBytes() - LittleFS.usedBytes());
|
||||
Serial.println();
|
||||
listDir("/", 3);
|
||||
} else {
|
||||
Serial.println("LittleFS mount failed!");
|
||||
}
|
||||
log_i("Startup/Boot....");
|
||||
log_i("Mounting File System...");
|
||||
|
||||
if(LittleFS.begin()) Serial.println("File system mounted successfully");
|
||||
else Serial.println("Error mounting file system");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue