mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-03-30 08:52:11 +02:00
improve logging
This commit is contained in:
parent
2509030c49
commit
88fdfa577a
2 changed files with 17 additions and 57 deletions
|
|
@ -11,8 +11,6 @@
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = esp32dev
|
default_envs = esp32dev
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[env:esp32dev]
|
[env:esp32dev]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
|
|
@ -27,8 +25,16 @@ board_build.partitions = min_spiffs.csv
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
build_flags =
|
build_flags =
|
||||||
-DCONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=1
|
-DCONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=1
|
||||||
-DCONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=1
|
-DCONFIG_ESP_COREDUMP_ENABLE_TO_UART=1
|
||||||
-DCONFIG_ESP_COREDUMP_CHECKSUM_CRC32=1
|
-DCONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=1
|
||||||
|
-DCONFIG_ESP_COREDUMP_CHECKSUM_CRC32=1
|
||||||
|
-DCONFIG_ESP_TASK_WDT_PANIC=1
|
||||||
|
-DCONFIG_ESP_COREDUMP_DECODE_INFO=1
|
||||||
|
monitor_speed = 115200
|
||||||
|
monitor_filters =
|
||||||
|
time
|
||||||
|
esp32_exception_decoder
|
||||||
|
log2file
|
||||||
|
|
||||||
[env:esp32devdbg]
|
[env:esp32devdbg]
|
||||||
build_type = debug
|
build_type = debug
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#define LOG_LOCAL_LEVEL ESP_LOG_INFO
|
||||||
|
#include "esp_log.h"
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <LittleFS.h>
|
#include <LittleFS.h>
|
||||||
#include <esp_task_wdt.h>
|
#include <esp_task_wdt.h>
|
||||||
|
|
@ -22,59 +24,11 @@ GitUpdater git;
|
||||||
|
|
||||||
uint32_t oldheap = 0;
|
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() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.println("Startup/Boot....");
|
log_i("Startup/Boot....");
|
||||||
Serial.println("Mounting File System...");
|
log_i("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!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(LittleFS.begin()) Serial.println("File system mounted successfully");
|
if(LittleFS.begin()) Serial.println("File system mounted successfully");
|
||||||
else Serial.println("Error mounting file system");
|
else Serial.println("Error mounting file system");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue