Added ESP console logger as serial interface

This commit is contained in:
2024-03-23 12:32:14 +01:00
parent 55c3ebbbe4
commit ec05cfd9b6
7 changed files with 296 additions and 77 deletions
+34 -8
View File
@@ -28,6 +28,7 @@
#include "nvs_flash.h"
// HAL includes
#include "esplog.h"
#include "gpio.h"
#include "i2c.h"
#include "uart.h"
@@ -36,7 +37,7 @@
#include "isl29125.h"
#include "logger.h"
#include "ledmatrix.h"
#include "Wifi.h"
#include "wifi.h"
// Application includes
#include "clock.h"
@@ -92,7 +93,7 @@ void otaTask(void* parameters);
extern "C" void app_main(void)
{
esp_log_level_set("*", ESP_LOG_WARN);
esp_log_level_set("*", ESP_LOG_INFO);
esp_err_t ret = nvs_flash_init();
@@ -102,6 +103,9 @@ extern "C" void app_main(void)
ret = nvs_flash_init();
}
ESP_LOGE("Test", "System start");
vTaskDelay(100);
// -----------------------------------------------------------------------------------------------------------------
// UART
//
@@ -120,17 +124,30 @@ extern "C" void app_main(void)
ESP_ERROR_CHECK(uart_set_pin(debugUart, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
ESP_ERROR_CHECK(uart_driver_install(debugUart, 1024, 1024, 0, NULL, 0));
uart uartDebug = uart(&debugUart);
uartDebug.open();
uartDebug.write(255, 255, (uint8_t*)"START", 5);
ESP_LOGE("Test", "Uart installed");
vTaskDelay(100);
// uart uartDebug = uart(&debugUart);
// uartDebug.open();
// uartDebug.write(255, 255, (uint8_t*)"START", 5);
ESP_LOGE("Test", "Uart interface open");
vTaskDelay(100);
esplog esplogger = esplog();
esplogger.open();
// -----------------------------------------------------------------------------------------------------------------
// System-wide Debug Logger
//
logger debugLogger = logger(16, uartDebug);
// logger debugLogger = logger(16, uartDebug);
logger debugLogger = logger(16, esplogger);
// Call the logger executable within a dedicated task and forget about it afterwards
xTaskCreate(loggerTask, (const char*)"loggerTask", 4000, &debugLogger, 3, &loggerTaskHandle);
xTaskCreate(loggerTask, (const char*)"loggerTask", 3000, &debugLogger, 3, &loggerTaskHandle);
ESP_LOGE("Test", "Logger Task started");
vTaskDelay(100);
LOGGER_PRINT("\n\r-----------------------------------------------------------------------\n\r");
LOGGER_PRINT("System Start\n\r");
@@ -139,6 +156,9 @@ extern "C" void app_main(void)
LOGGER_PRINT("Release: %d.%d \n\r", MAJORRELEASE, MINORRELEASE);
LOGGER_PRINT("Compiled on %s at %s\n\r\n\r\n\r", __DATE__, __TIME__);
ESP_LOGE("Test", "Logger System Rpintout");
vTaskDelay(100);
// // -----------------------------------------------------------------------------------------------------------------
// // I2C Masterbus for sensoring peripherals
// //
@@ -176,9 +196,15 @@ extern "C" void app_main(void)
// -----------------------------------------------------------------------------------------------------------------
// Wifi create and connect
//
Wifi wifi;
Wifi wifi = Wifi();
ESP_LOGE("Test", "Wifi object created");
vTaskDelay(100);
wifi.start_client();
ESP_LOGE("Test", "Wifi started");
vTaskDelay(100);
// -----------------------------------------------------------------------------------------------------------------
// Programmable LEDs in a strip
//