mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
remove tx-delay, wait for KM200 poll, v3.2.2b1
This commit is contained in:
@@ -24,10 +24,6 @@
|
||||
#define EMSESP_DEFAULT_TX_MODE 1 // EMS1.0
|
||||
#endif
|
||||
|
||||
#ifndef EMSESP_DEFAULT_TX_DELAY
|
||||
#define EMSESP_DEFAULT_TX_DELAY 0 // no delay
|
||||
#endif
|
||||
|
||||
#ifndef EMSESP_DEFAULT_EMS_BUS_ID
|
||||
#define EMSESP_DEFAULT_EMS_BUS_ID 0x0B // service key
|
||||
#endif
|
||||
|
||||
@@ -74,7 +74,6 @@ uint32_t EMSESP::last_fetch_ = 0;
|
||||
uint8_t EMSESP::publish_all_idx_ = 0;
|
||||
uint8_t EMSESP::unique_id_count_ = 0;
|
||||
bool EMSESP::trace_raw_ = false;
|
||||
uint64_t EMSESP::tx_delay_ = 0;
|
||||
uint8_t EMSESP::bool_format_ = 1;
|
||||
uint8_t EMSESP::enum_format_ = 1;
|
||||
uint16_t EMSESP::wait_validate_ = 0;
|
||||
@@ -181,7 +180,6 @@ void EMSESP::init_uart() {
|
||||
uint8_t tx_gpio;
|
||||
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
||||
tx_mode = settings.tx_mode;
|
||||
tx_delay_ = settings.tx_delay * 1000;
|
||||
rx_gpio = settings.rx_gpio;
|
||||
tx_gpio = settings.tx_gpio;
|
||||
});
|
||||
@@ -1132,16 +1130,19 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
||||
|
||||
// check for poll
|
||||
if (length == 1) {
|
||||
static uint64_t delayed_tx_start_ = 0;
|
||||
if (!rxservice_.bus_connected() && (tx_delay_ > 0)) {
|
||||
delayed_tx_start_ = uuid::get_uptime_ms();
|
||||
LOG_DEBUG(F("Tx delay started"));
|
||||
// if ht3 poll must be ems_bus_id else if Buderus poll must be (ems_bus_id | 0x80)
|
||||
uint8_t poll_id = (first_value ^ 0x80 ^ rxservice_.ems_mask());
|
||||
static bool waitKM = true;
|
||||
if (!rxservice_.bus_connected()) {
|
||||
waitKM = true;
|
||||
}
|
||||
if ((first_value ^ 0x80 ^ rxservice_.ems_mask()) == txservice_.ems_bus_id()) {
|
||||
if (poll_id == txservice_.ems_bus_id()) {
|
||||
EMSbus::last_bus_activity(uuid::get_uptime()); // set the flag indication the EMS bus is active
|
||||
}
|
||||
// first send delayed after connect
|
||||
if ((uuid::get_uptime_ms() - delayed_tx_start_) < tx_delay_) {
|
||||
if (poll_id == 0x48) {
|
||||
waitKM = false; // KM200 is polled, from now on it is safe to send
|
||||
}
|
||||
if (waitKM) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1156,12 +1157,11 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
||||
}
|
||||
#endif
|
||||
// check for poll to us, if so send top message from Tx queue immediately and quit
|
||||
// if ht3 poll must be ems_bus_id else if Buderus poll must be (ems_bus_id | 0x80)
|
||||
if ((first_value ^ 0x80 ^ rxservice_.ems_mask()) == txservice_.ems_bus_id()) {
|
||||
if (poll_id == txservice_.ems_bus_id()) {
|
||||
txservice_.send();
|
||||
}
|
||||
// send remote room temperature if active
|
||||
Roomctrl::send(first_value ^ 0x80 ^ rxservice_.ems_mask());
|
||||
Roomctrl::send(poll_id);
|
||||
return;
|
||||
} else {
|
||||
#ifdef EMSESP_UART_DEBUG
|
||||
|
||||
@@ -267,7 +267,6 @@ class EMSESP {
|
||||
static uint8_t publish_all_idx_;
|
||||
static uint8_t unique_id_count_;
|
||||
static bool trace_raw_;
|
||||
static uint64_t tx_delay_;
|
||||
static uint8_t bool_format_;
|
||||
static uint8_t enum_format_;
|
||||
static uint16_t wait_validate_;
|
||||
|
||||
@@ -887,7 +887,6 @@ bool System::command_settings(const char * value, const int8_t id, JsonObject &
|
||||
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
||||
node = json.createNestedObject("Settings");
|
||||
node["tx_mode"] = settings.tx_mode;
|
||||
node["tx_delay"] = settings.tx_delay;
|
||||
node["ems_bus_id"] = settings.ems_bus_id;
|
||||
node["syslog_enabled"] = settings.syslog_enabled;
|
||||
node["syslog_level"] = settings.syslog_level;
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define EMSESP_APP_VERSION "3.2.2b0"
|
||||
#define EMSESP_APP_VERSION "3.2.2b1"
|
||||
|
||||
@@ -38,7 +38,6 @@ WebSettingsService::WebSettingsService(AsyncWebServer * server, FS * fs, Securit
|
||||
|
||||
void WebSettings::read(WebSettings & settings, JsonObject & root) {
|
||||
root["tx_mode"] = settings.tx_mode;
|
||||
root["tx_delay"] = settings.tx_delay;
|
||||
root["ems_bus_id"] = settings.ems_bus_id;
|
||||
root["syslog_enabled"] = settings.syslog_enabled;
|
||||
root["syslog_level"] = settings.syslog_level;
|
||||
@@ -114,9 +113,6 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
|
||||
prev = settings.tx_mode;
|
||||
settings.tx_mode = root["tx_mode"] | EMSESP_DEFAULT_TX_MODE;
|
||||
check_flag(prev, settings.tx_mode, ChangeFlags::UART);
|
||||
prev = settings.tx_delay;
|
||||
settings.tx_delay = root["tx_delay"] | EMSESP_DEFAULT_TX_DELAY;
|
||||
check_flag(prev, settings.tx_delay, ChangeFlags::UART);
|
||||
prev = settings.rx_gpio;
|
||||
settings.rx_gpio = root["rx_gpio"] | default_rx_gpio;
|
||||
check_flag(prev, settings.rx_gpio, ChangeFlags::UART);
|
||||
|
||||
@@ -38,7 +38,6 @@ enum { ENUM_FORMAT_TEXT = 1, ENUM_FORMAT_NUMBER };
|
||||
class WebSettings {
|
||||
public:
|
||||
uint8_t tx_mode;
|
||||
uint8_t tx_delay;
|
||||
uint8_t ems_bus_id;
|
||||
uint8_t master_thermostat;
|
||||
bool shower_timer;
|
||||
|
||||
Reference in New Issue
Block a user