improvements to raw mode

This commit is contained in:
proddy
2019-05-07 21:26:50 +02:00
parent 2335287fe8
commit 788441b2df
2 changed files with 11 additions and 8 deletions

View File

@@ -165,7 +165,7 @@ const _EMS_Type EMS_Types[] = {
{EMS_MODEL_ALL, EMS_TYPE_RCPLUSSet, "RCPLUSSetMessage", _process_RCPLUSSetMessage}, {EMS_MODEL_ALL, EMS_TYPE_RCPLUSSet, "RCPLUSSetMessage", _process_RCPLUSSetMessage},
{EMS_MODEL_ALL, EMS_TYPE_RCPLUSStatusHeating, "RCPLUSStatusHeating", _process_RCPLUSStatusHeating}, {EMS_MODEL_ALL, EMS_TYPE_RCPLUSStatusHeating, "RCPLUSStatusHeating", _process_RCPLUSStatusHeating},
{EMS_MODEL_ALL, EMS_TYPE_RCPLUSStatusMode, "RCPLUSStatusMode", _process_RCPLUSStatusMode}, {EMS_MODEL_ALL, EMS_TYPE_RCPLUSStatusMode, "RCPLUSStatusMode", _process_RCPLUSStatusMode},
// Junkers FR10 // Junkers FR10
{EMS_MODEL_ALL, EMS_TYPE_FR10StatusMessage, "FR10StatusMessage", _process_FR10StatusMessage} {EMS_MODEL_ALL, EMS_TYPE_FR10StatusMessage, "FR10StatusMessage", _process_FR10StatusMessage}
@@ -503,7 +503,9 @@ void _debugPrintTelegram(const char * prefix, _EMS_RxTelegram * EMS_RxTelegram,
strlcat(output_str, " ", sizeof(output_str)); // add space 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, "(CRC=", sizeof(output_str));
strlcat(output_str, _hextoa(data[length - 1], buffer), sizeof(output_str)); strlcat(output_str, _hextoa(data[length - 1], buffer), sizeof(output_str));
strlcat(output_str, ")", sizeof(output_str)); strlcat(output_str, ")", sizeof(output_str));
@@ -541,16 +543,17 @@ void _ems_sendTelegram() {
} }
// if we're in raw mode just fire and forget // 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) { if (EMS_TxTelegram.action == EMS_TX_TELEGRAM_RAW) {
_EMS_RxTelegram EMS_RxTelegram; // create new Rx object _EMS_RxTelegram EMS_RxTelegram; // create new Rx object
EMS_TxTelegram.data[EMS_TxTelegram.length - 1] = _crcCalculator(EMS_TxTelegram.data, EMS_TxTelegram.length); // add the CRC EMS_TxTelegram.data[EMS_TxTelegram.length - 1] = _crcCalculator(EMS_TxTelegram.data, EMS_TxTelegram.length); // add the CRC
EMS_RxTelegram.length = EMS_TxTelegram.length; // full length of telegram EMS_RxTelegram.length = EMS_TxTelegram.length; // full length of telegram
EMS_RxTelegram.telegram = EMS_TxTelegram.data; EMS_RxTelegram.telegram = EMS_TxTelegram.data;
EMS_RxTelegram.timestamp = millis(); // now 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 emsuart_tx_buffer(EMS_TxTelegram.data, EMS_TxTelegram.length); // send the telegram to the UART Tx
EMS_TxQueue.shift(); // remove from queue EMS_TxQueue.shift(); // remove from queue
return; return;
} }

View File

@@ -185,7 +185,7 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
delayMicroseconds(EMS_TX_BRK_WAIT); 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() { void ICACHE_FLASH_ATTR emsaurt_tx_poll() {
USF(EMSUART_UART) = EMS_ID_ME; USF(EMSUART_UART) = EMS_ID_ME;
emsuart_tx_brk(); emsuart_tx_brk(); // send <BRK>
} }