mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
remove tx-delay, wait for KM200 poll, v3.2.2b1
This commit is contained in:
@@ -13,3 +13,4 @@
|
||||
## Changed
|
||||
|
||||
- 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)
|
||||
|
||||
@@ -172,30 +172,6 @@ class EMSESPSettingsForm extends Component<EMSESPSettingsFormProps> {
|
||||
<MenuItem value={0x12}>Alarm Module (0x12)</MenuItem>
|
||||
</SelectValidator>
|
||||
</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>
|
||||
|
||||
<br></br>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
export interface EMSESPSettings {
|
||||
tx_mode: number;
|
||||
tx_delay: number;
|
||||
ems_bus_id: number;
|
||||
syslog_enabled: boolean;
|
||||
syslog_level: number;
|
||||
|
||||
@@ -293,7 +293,6 @@ const WRITE_VALUE_ENDPOINT = REST_ENDPOINT_ROOT + 'writeValue'
|
||||
const WRITE_SENSOR_ENDPOINT = REST_ENDPOINT_ROOT + 'writeSensor'
|
||||
const emsesp_settings = {
|
||||
tx_mode: 1,
|
||||
tx_delay: 0,
|
||||
ems_bus_id: 11,
|
||||
syslog_enabled: false,
|
||||
syslog_level: 3,
|
||||
|
||||
@@ -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