mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
txstatus: remove all references and settings
This commit is contained in:
@@ -1147,8 +1147,6 @@ bool FSCallback(MYESP_FSACTION action, const JsonObject json) {
|
|||||||
EMSESP_Status.shower_alert = json["shower_alert"];
|
EMSESP_Status.shower_alert = json["shower_alert"];
|
||||||
EMSESP_Status.publish_time = json["publish_time"] | DEFAULT_PUBLISHTIME;
|
EMSESP_Status.publish_time = json["publish_time"] | DEFAULT_PUBLISHTIME;
|
||||||
|
|
||||||
ems_setTxMode(json["tx_mode"]);
|
|
||||||
|
|
||||||
EMSESP_Status.listen_mode = json["listen_mode"];
|
EMSESP_Status.listen_mode = json["listen_mode"];
|
||||||
ems_setTxDisabled(EMSESP_Status.listen_mode);
|
ems_setTxDisabled(EMSESP_Status.listen_mode);
|
||||||
|
|
||||||
@@ -1170,8 +1168,6 @@ bool FSCallback(MYESP_FSACTION action, const JsonObject json) {
|
|||||||
json["shower_alert"] = EMSESP_Status.shower_alert;
|
json["shower_alert"] = EMSESP_Status.shower_alert;
|
||||||
json["publish_time"] = EMSESP_Status.publish_time;
|
json["publish_time"] = EMSESP_Status.publish_time;
|
||||||
json["heating_circuit"] = EMSESP_Status.heating_circuit;
|
json["heating_circuit"] = EMSESP_Status.heating_circuit;
|
||||||
json["tx_mode"] = ems_getTxMode();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1300,12 +1296,6 @@ bool SettingsCallback(MYESP_FSACTION action, uint8_t wc, const char * setting, c
|
|||||||
myDebug_P(PSTR("Error. Usage: set heating_circuit <1 | 2>"));
|
myDebug_P(PSTR("Error. Usage: set heating_circuit <1 | 2>"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// tx delay/ tx mode
|
|
||||||
if (((strcmp(setting, "tx_mode") == 0) || (strcmp(setting, "tx_delay") == 0)) && (wc == 2)) {
|
|
||||||
ems_setTxMode(atoi(value));
|
|
||||||
ok = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == MYESP_FSACTION_LIST) {
|
if (action == MYESP_FSACTION_LIST) {
|
||||||
@@ -1332,7 +1322,6 @@ bool SettingsCallback(MYESP_FSACTION action, uint8_t wc, const char * setting, c
|
|||||||
myDebug_P(PSTR(" shower_timer=%s"), EMSESP_Status.shower_timer ? "on" : "off");
|
myDebug_P(PSTR(" shower_timer=%s"), EMSESP_Status.shower_timer ? "on" : "off");
|
||||||
myDebug_P(PSTR(" shower_alert=%s"), EMSESP_Status.shower_alert ? "on" : "off");
|
myDebug_P(PSTR(" shower_alert=%s"), EMSESP_Status.shower_alert ? "on" : "off");
|
||||||
myDebug_P(PSTR(" publish_time=%d"), EMSESP_Status.publish_time);
|
myDebug_P(PSTR(" publish_time=%d"), EMSESP_Status.publish_time);
|
||||||
myDebug_P(PSTR(" tx_mode=%d"), ems_getTxMode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
|||||||
19
src/ems.cpp
19
src/ems.cpp
@@ -235,7 +235,6 @@ void ems_init() {
|
|||||||
EMS_Sys_Status.emsTxDisabled = false;
|
EMS_Sys_Status.emsTxDisabled = false;
|
||||||
EMS_Sys_Status.emsPollFrequency = 0;
|
EMS_Sys_Status.emsPollFrequency = 0;
|
||||||
EMS_Sys_Status.txRetryCount = 0;
|
EMS_Sys_Status.txRetryCount = 0;
|
||||||
EMS_Sys_Status.emsTxMode = 0;
|
|
||||||
EMS_Sys_Status.emsIDMask = 0x00;
|
EMS_Sys_Status.emsIDMask = 0x00;
|
||||||
EMS_Sys_Status.emsPollAck[0] = EMS_ID_ME;
|
EMS_Sys_Status.emsPollAck[0] = EMS_ID_ME;
|
||||||
|
|
||||||
@@ -356,24 +355,6 @@ bool ems_getPoll() {
|
|||||||
return EMS_Sys_Status.emsPollEnabled;
|
return EMS_Sys_Status.emsPollEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ems_setTxMode(uint8_t mode) {
|
|
||||||
EMS_Sys_Status.emsTxMode = mode;
|
|
||||||
|
|
||||||
// special case for Junkers. If tx_mode is 3 then set the reverse poll flag
|
|
||||||
// https://github.com/proddy/EMS-ESP/issues/103#issuecomment-495945850
|
|
||||||
if (mode == 3) {
|
|
||||||
EMS_Sys_Status.emsIDMask = 0x80;
|
|
||||||
myDebug_P(PSTR("Forcing emsReverse for Junkers"));
|
|
||||||
} else {
|
|
||||||
EMS_Sys_Status.emsIDMask = 0x00;
|
|
||||||
}
|
|
||||||
EMS_Sys_Status.emsPollAck[0] = EMS_ID_ME ^ EMS_Sys_Status.emsIDMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t ems_getTxMode() {
|
|
||||||
return EMS_Sys_Status.emsTxMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ems_getEmsRefreshed() {
|
bool ems_getEmsRefreshed() {
|
||||||
return EMS_Sys_Status.emsRefreshed;
|
return EMS_Sys_Status.emsRefreshed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,36 +171,6 @@ void ICACHE_FLASH_ATTR emsuart_start() {
|
|||||||
ETS_UART_INTR_ENABLE();
|
ETS_UART_INTR_ENABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Send a BRK signal
|
|
||||||
* Which is a 11-bit set of zero's (11 cycles)
|
|
||||||
*/
|
|
||||||
void ICACHE_FLASH_ATTR emsuart_tx_brk() {
|
|
||||||
uint32_t tmp;
|
|
||||||
|
|
||||||
// must make sure Tx FIFO is empty
|
|
||||||
while (((USS(EMSUART_UART) >> USTXC) & 0xFF) != 0)
|
|
||||||
;
|
|
||||||
|
|
||||||
tmp = ((1 << UCRXRST) | (1 << UCTXRST)); // bit mask
|
|
||||||
USC0(EMSUART_UART) |= (tmp); // set bits
|
|
||||||
USC0(EMSUART_UART) &= ~(tmp); // clear bits
|
|
||||||
|
|
||||||
// To create a 11-bit <BRK> we set TXD_BRK bit so the break signal will
|
|
||||||
// automatically be sent when the tx fifo is empty
|
|
||||||
tmp = (1 << UCBRK);
|
|
||||||
GPIO_H(TX_MARK_MASK);
|
|
||||||
USC0(EMSUART_UART) |= (tmp); // set bit
|
|
||||||
|
|
||||||
if (EMS_Sys_Status.emsTxMode <= 1) { // classic mode and ems+ (0, 1)
|
|
||||||
delayMicroseconds(EMSUART_TX_BRK_WAIT);
|
|
||||||
} else if (EMS_Sys_Status.emsTxMode == 3) { // junkers mode
|
|
||||||
delayMicroseconds(EMSUART_TX_WAIT_BRK - EMSUART_TX_LAG); // 1144 (11 Bits)
|
|
||||||
}
|
|
||||||
|
|
||||||
USC0(EMSUART_UART) &= ~(tmp); // clear bit
|
|
||||||
GPIO_L(TX_MARK_MASK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send to Tx, ending with a <BRK>
|
* Send to Tx, ending with a <BRK>
|
||||||
@@ -210,34 +180,6 @@ _EMS_TX_STATUS ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
|
|||||||
ems_dumpBuffer("emsuart_tx_buffer: ", buf, len); // validate and transmit the EMS buffer, excluding the BRK
|
ems_dumpBuffer("emsuart_tx_buffer: ", buf, len); // validate and transmit the EMS buffer, excluding the BRK
|
||||||
if (len) {
|
if (len) {
|
||||||
LA_PULSE(50);
|
LA_PULSE(50);
|
||||||
// temp code until we get mode 2 working without resets
|
|
||||||
if (EMS_Sys_Status.emsTxMode == 0) { // classic mode logic
|
|
||||||
for (uint8_t i = 0; i < len; i++) {
|
|
||||||
TX_PULSE(EMSUART_BIT_TIME / 4);
|
|
||||||
USF(EMSUART_UART) = buf[i];
|
|
||||||
}
|
|
||||||
emsuart_tx_brk(); // send <BRK>
|
|
||||||
} else if (EMS_Sys_Status.emsTxMode == 1) { // With extra tx delay for EMS+
|
|
||||||
for (uint8_t i = 0; i < len; i++) {
|
|
||||||
TX_PULSE(EMSUART_BIT_TIME / 4);
|
|
||||||
USF(EMSUART_UART) = buf[i];
|
|
||||||
delayMicroseconds(EMSUART_TX_BRK_WAIT); // https://github.com/proddy/EMS-ESP/issues/23#
|
|
||||||
}
|
|
||||||
emsuart_tx_brk(); // send <BRK>
|
|
||||||
} else if (EMS_Sys_Status.emsTxMode == 3) { // Junkers logic by @philrich
|
|
||||||
for (uint8_t i = 0; i < len; i++) {
|
|
||||||
TX_PULSE(EMSUART_BIT_TIME / 4);
|
|
||||||
USF(EMSUART_UART) = buf[i];
|
|
||||||
|
|
||||||
// just to be safe wait for tx fifo empty (needed?)
|
|
||||||
while (((USS(EMSUART_UART) >> USTXC) & 0xff) != 0)
|
|
||||||
;
|
|
||||||
|
|
||||||
// wait until bits are sent on wire
|
|
||||||
delayMicroseconds(EMSUART_TX_WAIT_BYTE - EMSUART_TX_LAG + EMSUART_TX_WAIT_GAP);
|
|
||||||
}
|
|
||||||
emsuart_tx_brk(); // send <BRK>
|
|
||||||
} else if (EMS_Sys_Status.emsTxMode == 2) {
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* based on 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
|
||||||
@@ -321,14 +263,6 @@ _EMS_TX_STATUS ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
|
|||||||
}
|
}
|
||||||
ETS_UART_INTR_ENABLE(); // receive anything from FIFO...
|
ETS_UART_INTR_ENABLE(); // receive anything from FIFO...
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Send the Poll (our own ID) to Tx as a single byte and end with a <BRK>
|
|
||||||
* *** moved to ems.cpp, renamed to ems_tx_pollAck
|
|
||||||
void ICACHE_FLASH_ATTR emsuart_tx_poll() {
|
|
||||||
static uint8_t buf[1] = {EMS_ID_ME ^ EMS_Sys_Status.emsIDMask};
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
Reference in New Issue
Block a user