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]
|
||||
default_envs = esp32dev
|
||||
|
||||
|
||||
|
||||
[env:esp32dev]
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
|
|
@ -25,11 +23,19 @@ lib_deps =
|
|||
extra_scripts = pre:minify.py
|
||||
board_build.partitions = min_spiffs.csv
|
||||
board_build.filesystem = littlefs
|
||||
build_flags =
|
||||
build_flags =
|
||||
-DCONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=1
|
||||
-DCONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=1
|
||||
-DCONFIG_ESP_COREDUMP_CHECKSUM_CRC32=1
|
||||
|
||||
-DCONFIG_ESP_COREDUMP_ENABLE_TO_UART=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]
|
||||
build_type = debug
|
||||
platform = espressif32
|
||||
|
|
@ -55,4 +61,4 @@ lib_deps =
|
|||
knolleary/PubSubClient@^2.8
|
||||
extra_scripts = pre:minify.py
|
||||
board_build.partitions = min_spiffs.csv
|
||||
board_build.filesystem = littlefs
|
||||
board_build.filesystem = littlefs
|
||||
|
|
|
|||
|
|
@ -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