work around with uart_driver_delete
This commit is contained in:
parent
f6d8927d23
commit
ed85d9717a
2 changed files with 12 additions and 5 deletions
|
@ -19,6 +19,7 @@ comm_esp32_hardwareserial::comm_esp32_hardwareserial(const int uart_nr, const in
|
||||||
|
|
||||||
comm_esp32_hardwareserial::~comm_esp32_hardwareserial()
|
comm_esp32_hardwareserial::~comm_esp32_hardwareserial()
|
||||||
{
|
{
|
||||||
|
if (initialized)
|
||||||
ESP_ERROR_CHECK(uart_driver_delete(uart_nr));
|
ESP_ERROR_CHECK(uart_driver_delete(uart_nr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +45,9 @@ bool comm_esp32_hardwareserial::begin()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// it already was at this point?!
|
||||||
|
uart_driver_delete(uart_nr);
|
||||||
|
|
||||||
// Setup UART buffered IO with event queue
|
// Setup UART buffered IO with event queue
|
||||||
const int uart_buffer_size = 1024 * 2;
|
const int uart_buffer_size = 1024 * 2;
|
||||||
static QueueHandle_t uart_queue;
|
static QueueHandle_t uart_queue;
|
||||||
|
@ -53,6 +57,8 @@ bool comm_esp32_hardwareserial::begin()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ private:
|
||||||
const int rx_pin { -1 };
|
const int rx_pin { -1 };
|
||||||
const int tx_pin { -1 };
|
const int tx_pin { -1 };
|
||||||
const int bitrate { 38400 };
|
const int bitrate { 38400 };
|
||||||
|
bool initialized { false };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
comm_esp32_hardwareserial(const int uart_nr, const int rx_pin, const int tx_pin, const int bps);
|
comm_esp32_hardwareserial(const int uart_nr, const int rx_pin, const int tx_pin, const int bps);
|
||||||
|
|
Loading…
Add table
Reference in a new issue