diff --git a/ESP32/console_esp32.cpp b/ESP32/console_esp32.cpp index 2e73c8a..5924311 100644 --- a/ESP32/console_esp32.cpp +++ b/ESP32/console_esp32.cpp @@ -10,9 +10,9 @@ #define NEOPIXELS_PIN 25 -console_esp32::console_esp32(std::atomic_uint32_t *const stop_event, bus *const b, Stream & io_port) : +console_esp32::console_esp32(std::atomic_uint32_t *const stop_event, bus *const b, std::vector & io_ports) : console(stop_event, b), - io_port(io_port) + io_ports(io_ports) { } @@ -24,8 +24,10 @@ console_esp32::~console_esp32() int console_esp32::wait_for_char_ll(const short timeout) { for(short i=0; iavailable()) + return port->read(); + } delay(10); } @@ -35,7 +37,8 @@ int console_esp32::wait_for_char_ll(const short timeout) void console_esp32::put_char_ll(const char c) { - io_port.print(c); + for(auto & port : io_ports) + port->print(c); } void console_esp32::put_string_lf(const std::string & what) @@ -55,7 +58,7 @@ void console_esp32::refresh_virtual_terminal() void console_esp32::panel_update_thread() { - io_port.println(F("panel task started")); + Serial.println(F("panel task started")); cpu *const c = b->getCpu(); diff --git a/ESP32/console_esp32.h b/ESP32/console_esp32.h index 4590ddf..7818771 100644 --- a/ESP32/console_esp32.h +++ b/ESP32/console_esp32.h @@ -1,4 +1,5 @@ #include +#include #include "console.h" @@ -6,7 +7,7 @@ class console_esp32 : public console { private: - Stream & io_port; + std::vector io_ports; protected: int wait_for_char_ll(const short timeout) override; @@ -14,7 +15,7 @@ protected: void put_char_ll(const char c) override; public: - console_esp32(std::atomic_uint32_t *const stop_event, bus *const b, Stream & io_port); + console_esp32(std::atomic_uint32_t *const stop_event, bus *const b, std::vector & io_ports); virtual ~console_esp32(); void put_string_lf(const std::string & what) override; diff --git a/ESP32/main.ino b/ESP32/main.ino index a2014b9..0b283b4 100644 --- a/ESP32/main.ino +++ b/ESP32/main.ino @@ -1,5 +1,6 @@ // (C) 2018-2023 by Folkert van Heusden // Released under Apache License v2.0 +#include #include #include #include @@ -317,7 +318,8 @@ void setup() { b->add_cpu(c); Serial.println(F("Init console")); - cnsl = new console_esp32(&stop_event, b, Serial); + std::vector serial_ports { &Serial, &Serial1 }; + cnsl = new console_esp32(&stop_event, b, serial_ports); Serial.println(F("Start line-frequency interrupt")); kw11_l *lf = new kw11_l(b, cnsl);