From e7b7a101e0cfa5d67a8558a7131d2a4240d304ee Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sun, 19 May 2024 20:38:04 +0200 Subject: [PATCH] getting rid of Serial.* (1) --- ESP32/console_esp32.cpp | 4 ++-- ESP32/console_shabadge.cpp | 4 ++-- console.cpp | 2 +- error.cpp | 10 +++++----- memory.cpp | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ESP32/console_esp32.cpp b/ESP32/console_esp32.cpp index dfef91c..72483da 100644 --- a/ESP32/console_esp32.cpp +++ b/ESP32/console_esp32.cpp @@ -66,7 +66,7 @@ void console_esp32::refresh_virtual_terminal() void console_esp32::panel_update_thread() { - Serial.println(F("panel task started")); + DOLOG(info, false, "panel task started"); cpu *const c = b->getCpu(); @@ -175,5 +175,5 @@ void console_esp32::panel_update_thread() } #endif - Serial.println(F("panel task terminating")); + DOLOG(info, false, "panel task terminating"); } diff --git a/ESP32/console_shabadge.cpp b/ESP32/console_shabadge.cpp index b8cdf77..3348bf9 100644 --- a/ESP32/console_shabadge.cpp +++ b/ESP32/console_shabadge.cpp @@ -19,9 +19,9 @@ console_shabadge::console_shabadge(std::atomic_uint32_t *const stop_event, std:: console_esp32(stop_event, io_ports, 296 / 8, 128 / 8) { if (epd.Init() != 0) - Serial.println("Init of DEPG0290B01 failed"); + printf("Init of DEPG0290B01 failed"); else { - Serial.println("DEPG0290B01 initialized"); + printf("DEPG0290B01 initialized"); paint = new Paint(image, 0, 0); diff --git a/console.cpp b/console.cpp index 581eef2..82f92d3 100644 --- a/console.cpp +++ b/console.cpp @@ -357,7 +357,7 @@ void console::operator()() uint8_t value = 1; if (xQueueSend(have_data, &value, portMAX_DELAY) == pdFALSE) - Serial.println("xQueueSend failed"); + TRACE("xQueueSend failed"); #else have_data.notify_all(); #endif diff --git a/error.cpp b/error.cpp index e8da321..1b9dcbf 100644 --- a/error.cpp +++ b/error.cpp @@ -19,15 +19,15 @@ [[ noreturn ]] void error_exit(bool sys_err, const char *format, ...) { +#if defined(ESP32) || defined(BUILD_FOR_RP2040) + printf("Fatal error: %s\n", format); +#else int e = errno; -#if !defined(_WIN32) && !defined(ESP32) && !defined(BUILD_FOR_RP2040) +#if !defined(_WIN32) (void)endwin(); #endif -#if defined(ESP32) || defined(BUILD_FOR_RP2040) - Serial.println(format); -#else va_list ap; va_start(ap, format); @@ -36,7 +36,7 @@ if (sys_err == true) fprintf(stderr, "error: %s (%d)\n", strerror(e), e); -#endif exit(1); +#endif } diff --git a/memory.cpp b/memory.cpp index 9ffe8b4..5c0a92f 100644 --- a/memory.cpp +++ b/memory.cpp @@ -7,16 +7,16 @@ #include #include +#include "log.h" #include "memory.h" memory::memory(const uint32_t size): size(size) { #if defined(ESP32) - Serial.print(F("Memory size (in bytes, decimal): ")); - Serial.println(size); + DOLOG(info, false, "Memory size (in bytes, decimal): %d", size); if (psramFound()) { - Serial.println(F("Using PSRAM")); + DOLOG(info, false, "Using PSRAM"); m = reinterpret_cast(ps_malloc(size));