mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 08:49:52 +03:00
improvements to raw mode
This commit is contained in:
@@ -503,7 +503,9 @@ void _debugPrintTelegram(const char * prefix, _EMS_RxTelegram * EMS_RxTelegram,
|
||||
strlcat(output_str, " ", sizeof(output_str)); // add space
|
||||
}
|
||||
|
||||
if (!raw) {
|
||||
if (raw) {
|
||||
strlcat(output_str, _hextoa(data[length - 1], buffer), sizeof(output_str));
|
||||
} else {
|
||||
strlcat(output_str, "(CRC=", sizeof(output_str));
|
||||
strlcat(output_str, _hextoa(data[length - 1], buffer), sizeof(output_str));
|
||||
strlcat(output_str, ")", sizeof(output_str));
|
||||
@@ -541,6 +543,7 @@ void _ems_sendTelegram() {
|
||||
}
|
||||
|
||||
// if we're in raw mode just fire and forget
|
||||
// e.g. send 0B 88 02 00 20
|
||||
if (EMS_TxTelegram.action == EMS_TX_TELEGRAM_RAW) {
|
||||
_EMS_RxTelegram EMS_RxTelegram; // create new Rx object
|
||||
|
||||
@@ -548,7 +551,7 @@ void _ems_sendTelegram() {
|
||||
EMS_RxTelegram.length = EMS_TxTelegram.length; // full length of telegram
|
||||
EMS_RxTelegram.telegram = EMS_TxTelegram.data;
|
||||
EMS_RxTelegram.timestamp = millis(); // now
|
||||
_debugPrintTelegram("Sending raw", &EMS_RxTelegram, COLOR_CYAN); // always show
|
||||
_debugPrintTelegram("Sending raw: ", &EMS_RxTelegram, COLOR_CYAN, true); // always show
|
||||
emsuart_tx_buffer(EMS_TxTelegram.data, EMS_TxTelegram.length); // send the telegram to the UART Tx
|
||||
EMS_TxQueue.shift(); // remove from queue
|
||||
return;
|
||||
|
||||
@@ -185,7 +185,7 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
|
||||
delayMicroseconds(EMS_TX_BRK_WAIT);
|
||||
}
|
||||
}
|
||||
emsuart_tx_brk();
|
||||
emsuart_tx_brk(); // send <BRK>
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -193,5 +193,5 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
|
||||
*/
|
||||
void ICACHE_FLASH_ATTR emsaurt_tx_poll() {
|
||||
USF(EMSUART_UART) = EMS_ID_ME;
|
||||
emsuart_tx_brk();
|
||||
emsuart_tx_brk(); // send <BRK>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user