reset reason, uart adapt for C6

This commit is contained in:
MichaelDvP
2026-03-19 16:39:27 +01:00
parent e610f0d57f
commit 7c6ff01ebe
2 changed files with 11 additions and 20 deletions

View File

@@ -34,25 +34,6 @@
#include "../test/test.h"
#endif
#ifndef EMSESP_STANDALONE
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
#include "../esp32/rom/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "../esp32s2/rom/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#include "../esp32c3/rom/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32S3
#include "../esp32s3/rom/rtc.h"
#else
#error Target CONFIG_IDF_TARGET is not supported
#endif
#else // ESP32 Before IDF 4.0
#include "../rom/rtc.h"
#endif
#include <esp_mac.h>
#endif
#ifndef NO_TLS_SUPPORT
#define ENABLE_SMTP
#define USE_ESP_SSLCLIENT
@@ -63,6 +44,7 @@
#endif
#ifndef EMSESP_STANDALONE
#include <esp_mac.h>
#include "esp_efuse.h"
#endif
@@ -2642,7 +2624,7 @@ bool System::command_restart(const char * value, const int8_t id) {
std::string System::reset_reason(uint8_t cpu) const {
#ifndef EMSESP_STANDALONE
switch (rtc_get_reset_reason(cpu)) {
switch (esp_rom_get_reset_reason(cpu)) {
case 1:
return ("Power on reset");
// case 2 :reset pin not on esp32

View File

@@ -68,6 +68,14 @@ void EMSuart::uart_event_task(void * pvParameters) {
// initialize UART driver
void EMSuart::start(const uint8_t tx_mode, const uint8_t rx_gpio, const uint8_t tx_gpio) {
if (tx_mode_ == EMS_TXMODE_INIT) {
#if CONFIG_IDF_TARGET_ESP32C6
uart_config_t uart_config = {.baud_rate = EMSUART_BAUD,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.rx_flow_ctrl_thresh = 0};
#else
uart_config_t uart_config = {.baud_rate = EMSUART_BAUD,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
@@ -76,6 +84,7 @@ void EMSuart::start(const uint8_t tx_mode, const uint8_t rx_gpio, const uint8_t
.rx_flow_ctrl_thresh = 0,
.source_clk = UART_SCLK_APB,
.flags = {0}};
#endif
#if defined(EMSUART_RX_INVERT)
inverse_mask |= UART_SIGNAL_RXD_INV;
#endif