mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 08:49:52 +03:00
roll back changes to 2.0.0 for ESP8266 uart
This commit is contained in:
@@ -46,9 +46,9 @@ void ICACHE_RAM_ATTR EMSuart::emsuart_rx_intr_handler(void * para) {
|
|||||||
|
|
||||||
if (USIS(EMSUART_UART) & ((1 << UIBD))) { // BREAK detection = End of EMS data block
|
if (USIS(EMSUART_UART) & ((1 << UIBD))) { // BREAK detection = End of EMS data block
|
||||||
USC0(EMSUART_UART) &= ~(1 << UCBRK); // reset tx-brk
|
USC0(EMSUART_UART) &= ~(1 << UCBRK); // reset tx-brk
|
||||||
if (emsTxBufLen > 0) { // timer tx_mode is interrupted by <brk>
|
if (emsTxBufIdx < emsTxBufLen) { // irq tx_mode is interrupted by <brk>
|
||||||
emsTxBufLen = 0;
|
emsTxBufIdx = emsTxBufLen + 1; // stop tx
|
||||||
drop_next_rx = true;
|
// drop_next_rx = true; // we have trash in buffer
|
||||||
}
|
}
|
||||||
USIC(EMSUART_UART) = (1 << UIBD); // INT clear the BREAK detect interrupt
|
USIC(EMSUART_UART) = (1 << UIBD); // INT clear the BREAK detect interrupt
|
||||||
length = 0;
|
length = 0;
|
||||||
@@ -89,9 +89,6 @@ void ICACHE_FLASH_ATTR EMSuart::emsuart_recvTask(os_event_t * events) {
|
|||||||
|
|
||||||
// ISR to Fire when Timer is triggered
|
// ISR to Fire when Timer is triggered
|
||||||
void ICACHE_RAM_ATTR EMSuart::emsuart_tx_timer_intr_handler() {
|
void ICACHE_RAM_ATTR EMSuart::emsuart_tx_timer_intr_handler() {
|
||||||
if (emsTxBufLen == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
emsTxBufIdx++;
|
emsTxBufIdx++;
|
||||||
if (emsTxBufIdx < emsTxBufLen) {
|
if (emsTxBufIdx < emsTxBufLen) {
|
||||||
USF(EMSUART_UART) = emsTxBuf[emsTxBufIdx];
|
USF(EMSUART_UART) = emsTxBuf[emsTxBufIdx];
|
||||||
@@ -101,8 +98,7 @@ void ICACHE_RAM_ATTR EMSuart::emsuart_tx_timer_intr_handler() {
|
|||||||
timer1_write(EMSUART_TX_BRK_TIMER);
|
timer1_write(EMSUART_TX_BRK_TIMER);
|
||||||
} else {
|
} else {
|
||||||
USC0(EMSUART_UART) &= ~(1 << UCBRK); // reset <BRK>
|
USC0(EMSUART_UART) &= ~(1 << UCBRK); // reset <BRK>
|
||||||
sending_ = false;
|
sending_ = false;
|
||||||
emsTxBufLen = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,7 +279,7 @@ uint16_t ICACHE_FLASH_ATTR EMSuart::transmit(uint8_t * buf, uint8_t len) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Logic for tx_mode of 1
|
* Logic for tx_mode of 1
|
||||||
* based on original code from https://github.com/proddy/EMS-ESP/issues/103 by @susisstrolch
|
* based on code from https://github.com/proddy/EMS-ESP/issues/103 by @susisstrolch
|
||||||
*
|
*
|
||||||
* Logic:
|
* Logic:
|
||||||
* we emit the whole telegram, with Rx interrupt disabled, collecting busmaster response in FIFO.
|
* we emit the whole telegram, with Rx interrupt disabled, collecting busmaster response in FIFO.
|
||||||
|
|||||||
Reference in New Issue
Block a user