mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-12 01:40:52 +01:00
Feature: Redirect all ESP log output to the MessageOutput handler
This commit is contained in:
@@ -19,6 +19,8 @@ public:
|
|||||||
size_t write(const uint8_t* buffer, size_t size) override;
|
size_t write(const uint8_t* buffer, size_t size) override;
|
||||||
void register_ws_output(AsyncWebSocket* output);
|
void register_ws_output(AsyncWebSocket* output);
|
||||||
|
|
||||||
|
static int log_vprintf(const char *fmt, va_list arguments);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,13 @@ build_flags =
|
|||||||
-DCONFIG_ASYNC_TCP_QUEUE_SIZE=128
|
-DCONFIG_ASYNC_TCP_QUEUE_SIZE=128
|
||||||
-DEMC_TASK_STACK_SIZE=6400
|
-DEMC_TASK_STACK_SIZE=6400
|
||||||
; -DHOY_DEBUG_QUEUE
|
; -DHOY_DEBUG_QUEUE
|
||||||
|
|
||||||
|
; Log related defines
|
||||||
|
-DUSE_ESP_IDF_LOG
|
||||||
|
-DLOG_LOCAL_LEVEL=5
|
||||||
|
-DCORE_DEBUG_LEVEL=5
|
||||||
|
-DTAG="\"CORE\""
|
||||||
|
|
||||||
-Wall -Wextra -Wunused -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference
|
-Wall -Wextra -Wunused -Wmisleading-indentation -Wduplicated-cond -Wlogical-op -Wnull-dereference
|
||||||
; Have to remove -Werror because of
|
; Have to remove -Werror because of
|
||||||
; https://github.com/espressif/arduino-esp32/issues/9044 and
|
; https://github.com/espressif/arduino-esp32/issues/9044 and
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ void MessageOutputClass::init(Scheduler& scheduler)
|
|||||||
{
|
{
|
||||||
scheduler.addTask(_loopTask);
|
scheduler.addTask(_loopTask);
|
||||||
_loopTask.enable();
|
_loopTask.enable();
|
||||||
|
esp_log_set_vprintf(log_vprintf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageOutputClass::register_ws_output(AsyncWebSocket* output)
|
void MessageOutputClass::register_ws_output(AsyncWebSocket* output)
|
||||||
@@ -28,6 +29,13 @@ void MessageOutputClass::register_ws_output(AsyncWebSocket* output)
|
|||||||
_ws = output;
|
_ws = output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MessageOutputClass::log_vprintf(const char* fmt, va_list arguments)
|
||||||
|
{
|
||||||
|
char log_buffer[WS_CHUNK_SIZE_BYTES];
|
||||||
|
vsnprintf(log_buffer, sizeof(log_buffer), fmt, arguments);
|
||||||
|
return MessageOutput.print(log_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
void MessageOutputClass::serialWrite(MessageOutputClass::message_t const& m)
|
void MessageOutputClass::serialWrite(MessageOutputClass::message_t const& m)
|
||||||
{
|
{
|
||||||
// operator bool() of HWCDC returns false if the device is not attached to
|
// operator bool() of HWCDC returns false if the device is not attached to
|
||||||
|
|||||||
Reference in New Issue
Block a user