mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
added tx_delay
This commit is contained in:
@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [1.7.0 dev] 2019-04-07
|
## [1.7.0 dev] 2019-04-14
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- MQTT 'restart' topic to reboot ESP (thanks @balk77)
|
- MQTT 'restart' topic to reboot ESP (thanks @balk77)
|
||||||
- Support for multiple thermostat heating circuits like the HC1/HC2 on a RC35, also via MQTT (thanks @lobocobra)
|
- Support for multiple thermostat heating circuits like the HC1/HC2 on a RC35, also via MQTT (thanks @lobocobra)
|
||||||
- `boiler flowtemp` command to set the flow temperature [(issue 59)](https://github.com/proddy/EMS-ESP/issues/59)
|
- `boiler flowtemp` command to set the flow temperature [(issue 59)](https://github.com/proddy/EMS-ESP/issues/59)
|
||||||
|
- `tx_delay` setting for circuits where we needed to slow down Tx transmission
|
||||||
|
|
||||||
## [1.6.0] 2019-03-24
|
## [1.6.0] 2019-03-24
|
||||||
|
|
||||||
|
|||||||
@@ -357,6 +357,8 @@ The onboard LED will flash if there is no connection with the EMS bus. You can d
|
|||||||
|
|
||||||
If you want to completely erase the ESP and rebuild the firmware then do a `pio run -t erase` which will wipe the onboard flash including the SPIFFs where all the settings are stored.
|
If you want to completely erase the ESP and rebuild the firmware then do a `pio run -t erase` which will wipe the onboard flash including the SPIFFs where all the settings are stored.
|
||||||
|
|
||||||
|
If you're unable to send commands then the Tx is most likely not working. Check with `info` to see if the Tx is available and that the rx poll is less than 200ms. Then trying putting a delay in the Tx by using `set tx_delay on` and `reboot`. See if that helps.
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
Some annoying issues that need fixing:
|
Some annoying issues that need fixing:
|
||||||
|
|||||||
@@ -854,12 +854,16 @@ void MyESP::showSystemStats() {
|
|||||||
if (_boottime != NULL) {
|
if (_boottime != NULL) {
|
||||||
myDebug_P(PSTR(" [APP] Boot time: %s"), _boottime);
|
myDebug_P(PSTR(" [APP] Boot time: %s"), _boottime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// uptime
|
||||||
uint32_t t = _getUptime(); // seconds
|
uint32_t t = _getUptime(); // seconds
|
||||||
uint32_t h = (uint32_t)t / (uint32_t)3600L;
|
uint32_t d = t / 86400L;
|
||||||
uint32_t rem = (uint32_t)t % (uint32_t)3600L;
|
uint32_t h = (t / 3600L) % 60;
|
||||||
uint32_t m = rem / 60;
|
uint32_t rem = t % 3600L;
|
||||||
uint32_t s = rem % 60;
|
uint8_t m = rem / 60;
|
||||||
myDebug_P(PSTR(" [APP] Uptime: %d seconds (%02d:%02d:%02d)"), t, h, m, s);
|
uint8_t s = rem % 60;
|
||||||
|
myDebug_P(PSTR(" [APP] Uptime: %d days, %d hours, %d minutes, %d seconds"), d, h, m, s);
|
||||||
|
|
||||||
myDebug_P(PSTR(" [APP] System Load: %d%%"), getSystemLoadAverage());
|
myDebug_P(PSTR(" [APP] System Load: %d%%"), getSystemLoadAverage());
|
||||||
|
|
||||||
if (isAPmode()) {
|
if (isAPmode()) {
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ command_t PROGMEM project_cmds[] = {
|
|||||||
{true, "shower_alert <on | off>", "send a warning of cold water after shower time is exceeded"},
|
{true, "shower_alert <on | off>", "send a warning of cold water after shower time is exceeded"},
|
||||||
{true, "publish_wait <seconds>", "set frequency for publishing to MQTT"},
|
{true, "publish_wait <seconds>", "set frequency for publishing to MQTT"},
|
||||||
{true, "heating_circuit <1 | 2>", "set the thermostat HC to work with if using multiple heating circuits"},
|
{true, "heating_circuit <1 | 2>", "set the thermostat HC to work with if using multiple heating circuits"},
|
||||||
|
{true, "tx_delay <on | off>", "turn on if Tx not working on newer boilers"},
|
||||||
|
|
||||||
{false, "info", "show data captured on the EMS bus"},
|
{false, "info", "show data captured on the EMS bus"},
|
||||||
{false, "log <n | b | t | r | v>", "set logging mode to none, basic, thermostat only, raw or verbose"},
|
{false, "log <n | b | t | r | v>", "set logging mode to none, basic, thermostat only, raw or verbose"},
|
||||||
@@ -340,7 +341,7 @@ void showInfo() {
|
|||||||
EMS_Sys_Status.emxCrcErr);
|
EMS_Sys_Status.emxCrcErr);
|
||||||
|
|
||||||
if (ems_getTxCapable()) {
|
if (ems_getTxCapable()) {
|
||||||
myDebug(" Tx: available, # Tx telegrams sent=%d", EMS_Sys_Status.emsTxPkgs);
|
myDebug(" Tx: available, Tx delay is %s, # Tx telegrams sent=%d", (ems_getTxDelay() ? "on" : "off"), EMS_Sys_Status.emsTxPkgs);
|
||||||
} else {
|
} else {
|
||||||
myDebug(" Tx: no signal");
|
myDebug(" Tx: no signal");
|
||||||
}
|
}
|
||||||
@@ -887,6 +888,9 @@ bool FSCallback(MYESP_FSACTION action, const JsonObject json) {
|
|||||||
// shower_alert
|
// shower_alert
|
||||||
EMSESP_Status.shower_alert = json["shower_alert"];
|
EMSESP_Status.shower_alert = json["shower_alert"];
|
||||||
|
|
||||||
|
// tx delay
|
||||||
|
ems_setTxDelay(json["tx_delay"]);
|
||||||
|
|
||||||
// publish_wait
|
// publish_wait
|
||||||
if (!(EMSESP_Status.publish_wait = json["publish_wait"])) {
|
if (!(EMSESP_Status.publish_wait = json["publish_wait"])) {
|
||||||
EMSESP_Status.publish_wait = DEFAULT_PUBLISHWAIT; // default value
|
EMSESP_Status.publish_wait = DEFAULT_PUBLISHWAIT; // default value
|
||||||
@@ -914,6 +918,7 @@ bool FSCallback(MYESP_FSACTION action, const JsonObject json) {
|
|||||||
json["shower_alert"] = EMSESP_Status.shower_alert;
|
json["shower_alert"] = EMSESP_Status.shower_alert;
|
||||||
json["publish_wait"] = EMSESP_Status.publish_wait;
|
json["publish_wait"] = EMSESP_Status.publish_wait;
|
||||||
json["heating_circuit"] = EMSESP_Status.heating_circuit;
|
json["heating_circuit"] = EMSESP_Status.heating_circuit;
|
||||||
|
json["tx_delay"] = ems_getTxDelay();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1043,6 +1048,19 @@ bool SettingsCallback(MYESP_FSACTION action, uint8_t wc, const char * setting, c
|
|||||||
myDebug("Error. Usage: set heating_circuit <1 | 2>");
|
myDebug("Error. Usage: set heating_circuit <1 | 2>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// tx delay
|
||||||
|
if ((strcmp(setting, "tx_delay") == 0) && (wc == 2)) {
|
||||||
|
if (strcmp(value, "on") == 0) {
|
||||||
|
ems_setTxDelay(true);
|
||||||
|
ok = true;
|
||||||
|
} else if (strcmp(value, "off") == 0) {
|
||||||
|
ems_setTxDelay(false);
|
||||||
|
ok = true;
|
||||||
|
} else {
|
||||||
|
myDebug("Error. Usage: set tx_delay <on | off>");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == MYESP_FSACTION_LIST) {
|
if (action == MYESP_FSACTION_LIST) {
|
||||||
@@ -1069,6 +1087,7 @@ bool SettingsCallback(MYESP_FSACTION action, uint8_t wc, const char * setting, c
|
|||||||
myDebug(" shower_timer=%s", EMSESP_Status.shower_timer ? "on" : "off");
|
myDebug(" shower_timer=%s", EMSESP_Status.shower_timer ? "on" : "off");
|
||||||
myDebug(" shower_alert=%s", EMSESP_Status.shower_alert ? "on" : "off");
|
myDebug(" shower_alert=%s", EMSESP_Status.shower_alert ? "on" : "off");
|
||||||
myDebug(" publish_wait=%d", EMSESP_Status.publish_wait);
|
myDebug(" publish_wait=%d", EMSESP_Status.publish_wait);
|
||||||
|
myDebug(" tx_delay=%s", ems_getTxDelay() ? "on" : "off");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
@@ -1523,7 +1542,7 @@ void setup() {
|
|||||||
// start up all the services
|
// start up all the services
|
||||||
myESP.begin(APP_HOSTNAME, APP_NAME, APP_VERSION);
|
myESP.begin(APP_HOSTNAME, APP_NAME, APP_VERSION);
|
||||||
|
|
||||||
// at this point we have the settings from our internall SPIFFS config file
|
// at this point we have all the settings from our internall SPIFFS config file
|
||||||
|
|
||||||
// enable regular checks if not in test mode
|
// enable regular checks if not in test mode
|
||||||
if (!EMSESP_Status.silent_mode) {
|
if (!EMSESP_Status.silent_mode) {
|
||||||
@@ -1553,7 +1572,7 @@ void loop() {
|
|||||||
myESP.loop();
|
myESP.loop();
|
||||||
|
|
||||||
// check Dallas sensors, every 2 seconds
|
// check Dallas sensors, every 2 seconds
|
||||||
// these values are published to MQTT seperately via the timer publishSensorValuesTimer
|
// these values are published to MQTT separately via the timer publishSensorValuesTimer
|
||||||
if (EMSESP_Status.dallas_sensors != 0) {
|
if (EMSESP_Status.dallas_sensors != 0) {
|
||||||
ds18.loop();
|
ds18.loop();
|
||||||
}
|
}
|
||||||
|
|||||||
30
src/ems.cpp
30
src/ems.cpp
@@ -189,6 +189,7 @@ 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.emsTxDelay = false;
|
||||||
|
|
||||||
// thermostat
|
// thermostat
|
||||||
EMS_Thermostat.setpoint_roomTemp = EMS_VALUE_SHORT_NOTSET;
|
EMS_Thermostat.setpoint_roomTemp = EMS_VALUE_SHORT_NOTSET;
|
||||||
@@ -295,6 +296,15 @@ bool ems_getPoll() {
|
|||||||
return EMS_Sys_Status.emsPollEnabled;
|
return EMS_Sys_Status.emsPollEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ems_setTxDelay(bool b) {
|
||||||
|
EMS_Sys_Status.emsTxDelay = b;
|
||||||
|
myDebug("EMS Tx delay is %s", EMS_Sys_Status.emsTxDelay ? "enabled" : "disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ems_getTxDelay() {
|
||||||
|
return EMS_Sys_Status.emsTxDelay;
|
||||||
|
}
|
||||||
|
|
||||||
bool ems_getEmsRefreshed() {
|
bool ems_getEmsRefreshed() {
|
||||||
return EMS_Sys_Status.emsRefreshed;
|
return EMS_Sys_Status.emsRefreshed;
|
||||||
}
|
}
|
||||||
@@ -718,19 +728,19 @@ void _printMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
uint8_t * telegram = EMS_RxTelegram->telegram;
|
uint8_t * telegram = EMS_RxTelegram->telegram;
|
||||||
|
|
||||||
// header info
|
// header info
|
||||||
uint8_t src = telegram[0] & 0x7F;
|
uint8_t src = telegram[0] & 0x7F;
|
||||||
uint8_t dest = telegram[1] & 0x7F; // remove 8th bit to handle both reads and writes
|
uint8_t dest = telegram[1] & 0x7F; // remove 8th bit to handle both reads and writes
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
bool emsp;
|
bool emsp;
|
||||||
|
|
||||||
// check if EMS or EMS+ by checking 3rd byte of telegram
|
// check if EMS or EMS+ by checking 3rd byte of telegram
|
||||||
if (telegram[2] >= 0xF0) {
|
if (telegram[2] >= 0xF0) {
|
||||||
// EMS+
|
// EMS+
|
||||||
type = telegram[3];
|
type = telegram[3];
|
||||||
emsp = true;
|
emsp = true;
|
||||||
} else {
|
} else {
|
||||||
type = telegram[2];
|
type = telegram[2];
|
||||||
emsp = false;
|
emsp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char output_str[200] = {0};
|
char output_str[200] = {0};
|
||||||
@@ -1265,7 +1275,6 @@ void _process_SM10Monitor(uint8_t src, uint8_t * data, uint8_t length) {
|
|||||||
* UBASetPoint 0x1A
|
* UBASetPoint 0x1A
|
||||||
*/
|
*/
|
||||||
void _process_SetPoints(uint8_t src, uint8_t * data, uint8_t length) {
|
void _process_SetPoints(uint8_t src, uint8_t * data, uint8_t length) {
|
||||||
|
|
||||||
if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_VERBOSE) {
|
if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_VERBOSE) {
|
||||||
if (length != 0) {
|
if (length != 0) {
|
||||||
uint8_t setpoint = data[0]; // flow temp
|
uint8_t setpoint = data[0]; // flow temp
|
||||||
@@ -1283,7 +1292,6 @@ void _process_SetPoints(uint8_t src, uint8_t * data, uint8_t length) {
|
|||||||
myDebug(" Boiler flow temperature is %d C", setpoint);
|
myDebug(" Boiler flow temperature is %d C", setpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1985,7 +1993,6 @@ void ems_setWarmWaterTemp(uint8_t temperature) {
|
|||||||
* Set the boiler flow temp
|
* Set the boiler flow temp
|
||||||
*/
|
*/
|
||||||
void ems_setFlowTemp(uint8_t temperature) {
|
void ems_setFlowTemp(uint8_t temperature) {
|
||||||
|
|
||||||
myDebug("Setting boiler flow temperature to %d C", temperature);
|
myDebug("Setting boiler flow temperature to %d C", temperature);
|
||||||
|
|
||||||
_EMS_TxTelegram EMS_TxTelegram = EMS_TX_TELEGRAM_NEW; // create new Tx
|
_EMS_TxTelegram EMS_TxTelegram = EMS_TX_TELEGRAM_NEW; // create new Tx
|
||||||
@@ -2006,7 +2013,6 @@ void ems_setFlowTemp(uint8_t temperature) {
|
|||||||
EMS_TxTelegram.forceRefresh = false;
|
EMS_TxTelegram.forceRefresh = false;
|
||||||
|
|
||||||
EMS_TxQueue.push(EMS_TxTelegram);
|
EMS_TxQueue.push(EMS_TxTelegram);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ typedef struct {
|
|||||||
bool emsTxCapable; // able to send via Tx
|
bool emsTxCapable; // able to send via Tx
|
||||||
bool emsTxDisabled; // true to prevent all Tx
|
bool emsTxDisabled; // true to prevent all Tx
|
||||||
uint8_t txRetryCount; // # times the last Tx was re-sent
|
uint8_t txRetryCount; // # times the last Tx was re-sent
|
||||||
|
bool emsTxDelay; // if true, slows down the Tx transmit
|
||||||
} _EMS_Sys_Status;
|
} _EMS_Sys_Status;
|
||||||
|
|
||||||
// The Tx send package
|
// The Tx send package
|
||||||
@@ -286,6 +287,7 @@ void ems_setFlowTemp(uint8_t temperature);
|
|||||||
void ems_setWarmWaterActivated(bool activated);
|
void ems_setWarmWaterActivated(bool activated);
|
||||||
void ems_setWarmTapWaterActivated(bool activated);
|
void ems_setWarmTapWaterActivated(bool activated);
|
||||||
void ems_setPoll(bool b);
|
void ems_setPoll(bool b);
|
||||||
|
void ems_setTxDelay(bool b);
|
||||||
void ems_setLogging(_EMS_SYS_LOGGING loglevel);
|
void ems_setLogging(_EMS_SYS_LOGGING loglevel);
|
||||||
void ems_setEmsRefreshed(bool b);
|
void ems_setEmsRefreshed(bool b);
|
||||||
void ems_setWarmWaterModeComfort(uint8_t comfort);
|
void ems_setWarmWaterModeComfort(uint8_t comfort);
|
||||||
@@ -300,6 +302,7 @@ bool ems_getPoll();
|
|||||||
bool ems_getTxEnabled();
|
bool ems_getTxEnabled();
|
||||||
bool ems_getThermostatEnabled();
|
bool ems_getThermostatEnabled();
|
||||||
bool ems_getBoilerEnabled();
|
bool ems_getBoilerEnabled();
|
||||||
|
bool ems_getTxDelay();
|
||||||
bool ems_getBusConnected();
|
bool ems_getBusConnected();
|
||||||
_EMS_SYS_LOGGING ems_getLogging();
|
_EMS_SYS_LOGGING ems_getLogging();
|
||||||
bool ems_getEmsRefreshed();
|
bool ems_getEmsRefreshed();
|
||||||
|
|||||||
@@ -177,7 +177,12 @@ void ICACHE_FLASH_ATTR emsuart_tx_brk() {
|
|||||||
void ICACHE_FLASH_ATTR emsuart_tx_buffer(uint8_t * buf, uint8_t len) {
|
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];
|
||||||
//delayMicroseconds(EMS_TX_BRK_WAIT);
|
|
||||||
|
// check if we need to force a delay to slow down Tx
|
||||||
|
// https://github.com/proddy/EMS-ESP/issues/23#
|
||||||
|
if (EMS_Sys_Status.emsTxDelay) {
|
||||||
|
delayMicroseconds(EMS_TX_BRK_WAIT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
emsuart_tx_brk();
|
emsuart_tx_brk();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define APP_NAME "EMS-ESP"
|
#define APP_NAME "EMS-ESP"
|
||||||
#define APP_VERSION "1.7.0b4"
|
#define APP_VERSION "1.7.0b5"
|
||||||
#define APP_HOSTNAME "ems-esp"
|
#define APP_HOSTNAME "ems-esp"
|
||||||
|
|||||||
Reference in New Issue
Block a user