remove tx-delay, wait for KM200 poll, v3.2.2b1

This commit is contained in:
MichaelDvP
2021-08-23 13:43:32 +02:00
parent 6b07651ed3
commit 4d1ba9bede
11 changed files with 14 additions and 50 deletions

View File

@@ -13,3 +13,4 @@
## Changed ## Changed
- Syslog BOM only for utf-8 messages [#91](https://github.com/emsesp/EMS-ESP32/issues/91) - Syslog BOM only for utf-8 messages [#91](https://github.com/emsesp/EMS-ESP32/issues/91)
- Check for KM200 by device-id 0x48, remove tx-delay[#90](https://github.com/emsesp/EMS-ESP32/issues/90)

View File

@@ -172,30 +172,6 @@ class EMSESPSettingsForm extends Component<EMSESPSettingsFormProps> {
<MenuItem value={0x12}>Alarm Module (0x12)</MenuItem> <MenuItem value={0x12}>Alarm Module (0x12)</MenuItem>
</SelectValidator> </SelectValidator>
</Grid> </Grid>
<Grid item xs={6}>
<TextValidator
validators={[
'required',
'isNumber',
'minNumber:0',
'maxNumber:120'
]}
errorMessages={[
'Tx delay is required',
'Must be a number',
'Must be 0 or higher',
'Max value is 120'
]}
name="tx_delay"
label="Tx start delay (seconds)"
fullWidth
variant="outlined"
value={data.tx_delay}
type="number"
onChange={handleValueChange('tx_delay')}
margin="normal"
/>
</Grid>
</Grid> </Grid>
<br></br> <br></br>

View File

@@ -1,6 +1,5 @@
export interface EMSESPSettings { export interface EMSESPSettings {
tx_mode: number; tx_mode: number;
tx_delay: number;
ems_bus_id: number; ems_bus_id: number;
syslog_enabled: boolean; syslog_enabled: boolean;
syslog_level: number; syslog_level: number;

View File

@@ -293,7 +293,6 @@ const WRITE_VALUE_ENDPOINT = REST_ENDPOINT_ROOT + 'writeValue'
const WRITE_SENSOR_ENDPOINT = REST_ENDPOINT_ROOT + 'writeSensor' const WRITE_SENSOR_ENDPOINT = REST_ENDPOINT_ROOT + 'writeSensor'
const emsesp_settings = { const emsesp_settings = {
tx_mode: 1, tx_mode: 1,
tx_delay: 0,
ems_bus_id: 11, ems_bus_id: 11,
syslog_enabled: false, syslog_enabled: false,
syslog_level: 3, syslog_level: 3,

View File

@@ -24,10 +24,6 @@
#define EMSESP_DEFAULT_TX_MODE 1 // EMS1.0 #define EMSESP_DEFAULT_TX_MODE 1 // EMS1.0
#endif #endif
#ifndef EMSESP_DEFAULT_TX_DELAY
#define EMSESP_DEFAULT_TX_DELAY 0 // no delay
#endif
#ifndef EMSESP_DEFAULT_EMS_BUS_ID #ifndef EMSESP_DEFAULT_EMS_BUS_ID
#define EMSESP_DEFAULT_EMS_BUS_ID 0x0B // service key #define EMSESP_DEFAULT_EMS_BUS_ID 0x0B // service key
#endif #endif

View File

@@ -74,7 +74,6 @@ uint32_t EMSESP::last_fetch_ = 0;
uint8_t EMSESP::publish_all_idx_ = 0; uint8_t EMSESP::publish_all_idx_ = 0;
uint8_t EMSESP::unique_id_count_ = 0; uint8_t EMSESP::unique_id_count_ = 0;
bool EMSESP::trace_raw_ = false; bool EMSESP::trace_raw_ = false;
uint64_t EMSESP::tx_delay_ = 0;
uint8_t EMSESP::bool_format_ = 1; uint8_t EMSESP::bool_format_ = 1;
uint8_t EMSESP::enum_format_ = 1; uint8_t EMSESP::enum_format_ = 1;
uint16_t EMSESP::wait_validate_ = 0; uint16_t EMSESP::wait_validate_ = 0;
@@ -181,7 +180,6 @@ void EMSESP::init_uart() {
uint8_t tx_gpio; uint8_t tx_gpio;
EMSESP::webSettingsService.read([&](WebSettings & settings) { EMSESP::webSettingsService.read([&](WebSettings & settings) {
tx_mode = settings.tx_mode; tx_mode = settings.tx_mode;
tx_delay_ = settings.tx_delay * 1000;
rx_gpio = settings.rx_gpio; rx_gpio = settings.rx_gpio;
tx_gpio = settings.tx_gpio; tx_gpio = settings.tx_gpio;
}); });
@@ -1132,16 +1130,19 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
// check for poll // check for poll
if (length == 1) { if (length == 1) {
static uint64_t delayed_tx_start_ = 0; // if ht3 poll must be ems_bus_id else if Buderus poll must be (ems_bus_id | 0x80)
if (!rxservice_.bus_connected() && (tx_delay_ > 0)) { uint8_t poll_id = (first_value ^ 0x80 ^ rxservice_.ems_mask());
delayed_tx_start_ = uuid::get_uptime_ms(); static bool waitKM = true;
LOG_DEBUG(F("Tx delay started")); 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 EMSbus::last_bus_activity(uuid::get_uptime()); // set the flag indication the EMS bus is active
} }
// first send delayed after connect if (poll_id == 0x48) {
if ((uuid::get_uptime_ms() - delayed_tx_start_) < tx_delay_) { waitKM = false; // KM200 is polled, from now on it is safe to send
}
if (waitKM) {
return; return;
} }
@@ -1156,12 +1157,11 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
} }
#endif #endif
// check for poll to us, if so send top message from Tx queue immediately and quit // 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 (poll_id == txservice_.ems_bus_id()) {
if ((first_value ^ 0x80 ^ rxservice_.ems_mask()) == txservice_.ems_bus_id()) {
txservice_.send(); txservice_.send();
} }
// send remote room temperature if active // send remote room temperature if active
Roomctrl::send(first_value ^ 0x80 ^ rxservice_.ems_mask()); Roomctrl::send(poll_id);
return; return;
} else { } else {
#ifdef EMSESP_UART_DEBUG #ifdef EMSESP_UART_DEBUG

View File

@@ -267,7 +267,6 @@ class EMSESP {
static uint8_t publish_all_idx_; static uint8_t publish_all_idx_;
static uint8_t unique_id_count_; static uint8_t unique_id_count_;
static bool trace_raw_; static bool trace_raw_;
static uint64_t tx_delay_;
static uint8_t bool_format_; static uint8_t bool_format_;
static uint8_t enum_format_; static uint8_t enum_format_;
static uint16_t wait_validate_; static uint16_t wait_validate_;

View File

@@ -887,7 +887,6 @@ bool System::command_settings(const char * value, const int8_t id, JsonObject &
EMSESP::webSettingsService.read([&](WebSettings & settings) { EMSESP::webSettingsService.read([&](WebSettings & settings) {
node = json.createNestedObject("Settings"); node = json.createNestedObject("Settings");
node["tx_mode"] = settings.tx_mode; node["tx_mode"] = settings.tx_mode;
node["tx_delay"] = settings.tx_delay;
node["ems_bus_id"] = settings.ems_bus_id; node["ems_bus_id"] = settings.ems_bus_id;
node["syslog_enabled"] = settings.syslog_enabled; node["syslog_enabled"] = settings.syslog_enabled;
node["syslog_level"] = settings.syslog_level; node["syslog_level"] = settings.syslog_level;

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.2.2b0" #define EMSESP_APP_VERSION "3.2.2b1"

View File

@@ -38,7 +38,6 @@ WebSettingsService::WebSettingsService(AsyncWebServer * server, FS * fs, Securit
void WebSettings::read(WebSettings & settings, JsonObject & root) { void WebSettings::read(WebSettings & settings, JsonObject & root) {
root["tx_mode"] = settings.tx_mode; root["tx_mode"] = settings.tx_mode;
root["tx_delay"] = settings.tx_delay;
root["ems_bus_id"] = settings.ems_bus_id; root["ems_bus_id"] = settings.ems_bus_id;
root["syslog_enabled"] = settings.syslog_enabled; root["syslog_enabled"] = settings.syslog_enabled;
root["syslog_level"] = settings.syslog_level; root["syslog_level"] = settings.syslog_level;
@@ -114,9 +113,6 @@ StateUpdateResult WebSettings::update(JsonObject & root, WebSettings & settings)
prev = settings.tx_mode; prev = settings.tx_mode;
settings.tx_mode = root["tx_mode"] | EMSESP_DEFAULT_TX_MODE; settings.tx_mode = root["tx_mode"] | EMSESP_DEFAULT_TX_MODE;
check_flag(prev, settings.tx_mode, ChangeFlags::UART); 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; prev = settings.rx_gpio;
settings.rx_gpio = root["rx_gpio"] | default_rx_gpio; settings.rx_gpio = root["rx_gpio"] | default_rx_gpio;
check_flag(prev, settings.rx_gpio, ChangeFlags::UART); check_flag(prev, settings.rx_gpio, ChangeFlags::UART);

View File

@@ -38,7 +38,6 @@ enum { ENUM_FORMAT_TEXT = 1, ENUM_FORMAT_NUMBER };
class WebSettings { class WebSettings {
public: public:
uint8_t tx_mode; uint8_t tx_mode;
uint8_t tx_delay;
uint8_t ems_bus_id; uint8_t ems_bus_id;
uint8_t master_thermostat; uint8_t master_thermostat;
bool shower_timer; bool shower_timer;