mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 08:49:52 +03:00
fix to tx_mode
This commit is contained in:
@@ -348,7 +348,7 @@ void showInfo() {
|
|||||||
if (ems_getTxCapable()) {
|
if (ems_getTxCapable()) {
|
||||||
char valuestr[8] = {0}; // for formatting floats
|
char valuestr[8] = {0}; // for formatting floats
|
||||||
myDebug_P(PSTR(" Tx: Last poll=%s seconds ago, Tx mode=%d, # successful write requests=%d"),
|
myDebug_P(PSTR(" Tx: Last poll=%s seconds ago, Tx mode=%d, # successful write requests=%d"),
|
||||||
_float_to_char(valuestr, (ems_getPollFrequency() / (float)1000000), 3),
|
_float_to_char(valuestr, (ems_getPollFrequency() / (float)1000000), 3), ems_getTxMode(),
|
||||||
EMS_Sys_Status.emsTxPkgs);
|
EMS_Sys_Status.emsTxPkgs);
|
||||||
} else {
|
} else {
|
||||||
myDebug_P(PSTR(" Tx: no signal"));
|
myDebug_P(PSTR(" Tx: no signal"));
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
_EMSRxBuf * pEMSRxBuf;
|
_EMSRxBuf * pEMSRxBuf;
|
||||||
_EMSRxBuf * paEMSRxBuf[EMS_MAXBUFFERS];
|
_EMSRxBuf * paEMSRxBuf[EMS_MAXBUFFERS];
|
||||||
uint8_t emsRxBufIdx = 0;
|
uint8_t emsRxBufIdx = 0;
|
||||||
uint8_t phantomBrk = 0; // tells Rx about upcoming phantom break from Tx
|
uint8_t phantomBrk = 0; // tells Rx about upcoming phantom break from Tx
|
||||||
|
|
||||||
os_event_t recvTaskQueue[EMSUART_recvTaskQueueLen]; // our Rx queue
|
os_event_t recvTaskQueue[EMSUART_recvTaskQueueLen]; // our Rx queue
|
||||||
|
|
||||||
@@ -208,13 +208,13 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
|
|||||||
for (uint8_t i = 0; i < len; i++) {
|
for (uint8_t i = 0; i < len; i++) {
|
||||||
USF(EMSUART_UART) = buf[i];
|
USF(EMSUART_UART) = buf[i];
|
||||||
}
|
}
|
||||||
emsuart_tx_brk(); // send <BRK>
|
emsuart_tx_brk(); // send <BRK>
|
||||||
} else if (EMS_Sys_Status.emsTxMode == 1) { // With extra tx delay for EMS+
|
} else if (EMS_Sys_Status.emsTxMode == 1) { // With extra tx delay for EMS+
|
||||||
for (uint8_t i = 0; i < len; i++) {
|
for (uint8_t i = 0; i < len; i++) {
|
||||||
USF(EMSUART_UART) = buf[i];
|
USF(EMSUART_UART) = buf[i];
|
||||||
delayMicroseconds(EMSUART_TX_BRK_WAIT); // https://github.com/proddy/EMS-ESP/issues/23#
|
delayMicroseconds(EMSUART_TX_BRK_WAIT); // https://github.com/proddy/EMS-ESP/issues/23#
|
||||||
}
|
}
|
||||||
emsuart_tx_brk(); // send <BRK>
|
emsuart_tx_brk(); // send <BRK>
|
||||||
} else if (EMS_Sys_Status.emsTxMode == 3) { // Junkers logic by @philrich
|
} else if (EMS_Sys_Status.emsTxMode == 3) { // Junkers logic by @philrich
|
||||||
for (uint8_t i = 0; i < len; i++) {
|
for (uint8_t i = 0; i < len; i++) {
|
||||||
USF(EMSUART_UART) = buf[i];
|
USF(EMSUART_UART) = buf[i];
|
||||||
@@ -226,7 +226,7 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
|
|||||||
// wait until bits are sent on wire
|
// wait until bits are sent on wire
|
||||||
delayMicroseconds(EMSUART_TX_WAIT_BYTE - EMSUART_TX_LAG + EMSUART_TX_WAIT_GAP);
|
delayMicroseconds(EMSUART_TX_WAIT_BYTE - EMSUART_TX_LAG + EMSUART_TX_WAIT_GAP);
|
||||||
}
|
}
|
||||||
emsuart_tx_brk(); // send <BRK>
|
emsuart_tx_brk(); // send <BRK>
|
||||||
} else if (EMS_Sys_Status.emsTxMode == 2) { // smart Tx - take two - https://github.com/proddy/EMS-ESP/issues/103 by @susisstrolch
|
} else if (EMS_Sys_Status.emsTxMode == 2) { // smart Tx - take two - https://github.com/proddy/EMS-ESP/issues/103 by @susisstrolch
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -249,7 +249,6 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
|
|||||||
// wait for echo from busmaster
|
// wait for echo from busmaster
|
||||||
while ((((USS(EMSUART_UART) >> USRXC) & 0xFF) < i || (USIS(EMSUART_UART) & (1 << UIBD)))) {
|
while ((((USS(EMSUART_UART) >> USRXC) & 0xFF) < i || (USIS(EMSUART_UART) & (1 << UIBD)))) {
|
||||||
delayMicroseconds(EMSUART_BIT_TIME); // burn CPU cycles...
|
delayMicroseconds(EMSUART_BIT_TIME); // burn CPU cycles...
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +257,7 @@ void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
|
|||||||
// otherwise, we send the final Tx-BRK in loopback and enable Rx-INT.
|
// otherwise, we send the final Tx-BRK in loopback and enable Rx-INT.
|
||||||
// worst case, we'll see an additional Rx-BRK...
|
// worst case, we'll see an additional Rx-BRK...
|
||||||
if (!(USIS(EMSUART_UART) & (1 << UIBD))) {
|
if (!(USIS(EMSUART_UART) & (1 << UIBD))) {
|
||||||
phantomBrk = 1; // tell Rx to expect a phantom BRK
|
phantomBrk = 1; // tell Rx to expect a phantom BRK
|
||||||
|
|
||||||
// no bus collision - send terminating BRK signal
|
// no bus collision - send terminating BRK signal
|
||||||
emsuart_loopback(true);
|
emsuart_loopback(true);
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define APP_NAME "EMS-ESP"
|
#define APP_NAME "EMS-ESP"
|
||||||
#define APP_VERSION "1.8.0b6"
|
#define APP_VERSION "1.8.0b7"
|
||||||
#define APP_HOSTNAME "ems-esp"
|
#define APP_HOSTNAME "ems-esp"
|
||||||
|
|||||||
Reference in New Issue
Block a user