tx-mode: auto, default bus-id 0x49

This commit is contained in:
MichaelDvP
2026-05-07 18:44:02 +02:00
parent ae5beccb9d
commit fed15f0f96
9 changed files with 27 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ For more details go to [emsesp.org](https://emsesp.org/).
- heatpump reset [#2933](https://github.com/emsesp/EMS-ESP32/issues/2933)
- 2.nd freshwater module (dhw4, dhw5) [#2991](https://github.com/emsesp/EMS-ESP32/issues/2991)
- full system backup and restore
- auto-logic to set ht3/ems+ tx-mode
## Fixed
@@ -36,3 +37,4 @@ For more details go to [emsesp.org](https://emsesp.org/).
- move http client from stack to heap
- heap optimizations [#3021](https://github.com/emsesp/EMS-ESP32/discussions/3021)
- check and read 0x470 as summer2_typeids[0] only if received [#2686](https://github.com/emsesp/EMS-ESP32/issues/2686), [#3055](https://github.com/emsesp/EMS-ESP32/issues/3055)
- default bus-id: gateway1(0x49), tx-mode: auto

View File

@@ -677,6 +677,7 @@ const ApplicationSettings = () => {
<MenuItem value={2}>EMS+</MenuItem>
<MenuItem value={3}>HT3</MenuItem>
<MenuItem value={4}>{LL.HARDWARE()}</MenuItem>
<MenuItem value={5}>Auto</MenuItem>
</TextField>
</Grid>
<Grid>

View File

@@ -22,10 +22,11 @@
#include "Arduino.h"
#define EMS_TXMODE_OFF 0
#define EMS_TXMODE_DEFAULT 1
#define EMS_TXMODE_EMS 1
#define EMS_TXMODE_EMSPLUS 2
#define EMS_TXMODE_HT3 3
#define EMS_TXMODE_HW 4
#define EMS_TXMODE_AUTO 5
namespace emsesp {

View File

@@ -26,11 +26,11 @@
#endif
#ifndef EMSESP_DEFAULT_TX_MODE
#define EMSESP_DEFAULT_TX_MODE 1 // EMS1.0
#define EMSESP_DEFAULT_TX_MODE 5 // Auto
#endif
#ifndef EMSESP_DEFAULT_EMS_BUS_ID
#define EMSESP_DEFAULT_EMS_BUS_ID 0x0B // service key
#define EMSESP_DEFAULT_EMS_BUS_ID 0x49 // gateway 1
#endif
#ifndef EMSESP_DEFAULT_SYSLOG_ENABLED

View File

@@ -43,6 +43,7 @@ uint8_t EMSbus::ems_mask_ = EMS_MASK_UNSET; // unset so its triggered
uint8_t EMSbus::ems_bus_id_ = EMSESP_DEFAULT_EMS_BUS_ID;
uint8_t EMSbus::tx_mode_ = EMSESP_DEFAULT_TX_MODE;
uint8_t EMSbus::tx_state_ = Telegram::Operation::NONE;
bool EMSbus::isEMS2_ = false;
uuid::log::Logger EMSbus::logger_{F_(telegram), uuid::log::Facility::CONSOLE};
@@ -206,7 +207,9 @@ void RxService::add(uint8_t * data, uint8_t length) {
message_data = data + 6;
message_length = length - 7;
}
if (type_id > 0x0FF && message_length > 1) { // used for auto tx_mode
set_ems2();
}
// if we're watching and "raw" print out actual telegram as bytes to the console
// including the CRC at the end
if (EMSESP::watch() == EMSESP::Watch::WATCH_RAW) {

View File

@@ -168,6 +168,14 @@ class EMSbus {
return (ems_mask_ == EMS_MASK_HT3);
}
static bool is_ems2() {
return isEMS2_;
}
static void set_ems2() {
isEMS2_ = true;;
}
static uint8_t ems_mask() {
return ems_mask_;
}
@@ -242,6 +250,7 @@ class EMSbus {
static uint8_t ems_bus_id_; // the bus id, which configurable and stored in settings
static uint8_t tx_mode_; // local copy of the tx mode
static uint8_t tx_state_; // state of the Tx line (NONE or waiting on a TX_READ or TX_WRITE)
static bool isEMS2_;
};
class RxService : public EMSbus {

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.8.2-dev.21"
#define EMSESP_APP_VERSION "3.8.2-dev.22"

View File

@@ -149,8 +149,10 @@ uint8_t EMSuart::transmit(const uint8_t * buf, const uint8_t len) {
return EMS_TX_STATUS_OK;
}
auto tx_mode = tx_mode_ != EMS_TXMODE_AUTO ? tx_mode_ : EMSbus::is_ht3() ? EMS_TXMODE_HT3 : EMSbus::is_ems2() ? EMS_TXMODE_EMSPLUS : EMS_TXMODE_EMS;
// TXMODE is EMS+ with long delay
if (tx_mode_ == EMS_TXMODE_EMSPLUS) {
if (tx_mode == EMS_TXMODE_EMSPLUS) {
for (uint8_t i = 0; i < len; i++) {
uart_write_bytes(EMSUART_NUM, &buf[i], 1);
delayMicroseconds(EMSUART_TX_WAIT_PLUS);
@@ -160,7 +162,7 @@ uint8_t EMSuart::transmit(const uint8_t * buf, const uint8_t len) {
}
// TXMODE is HT3 with 7 bittimes delay
if (tx_mode_ == EMS_TXMODE_HT3) {
if (tx_mode == EMS_TXMODE_HT3) {
for (uint8_t i = 0; i < len; i++) {
uart_write_bytes(EMSUART_NUM, &buf[i], 1);
delayMicroseconds(EMSUART_TX_WAIT_HT3);

View File

@@ -42,10 +42,11 @@
#define EMS_TXMODE_INIT 0xFF
#define EMS_TXMODE_OFF 0
#define EMS_TXMODE_DEFAULT 1
#define EMS_TXMODE_EMS 1
#define EMS_TXMODE_EMSPLUS 2
#define EMS_TXMODE_HT3 3
#define EMS_TXMODE_HW 4
#define EMS_TXMODE_AUTO 5
// LEGACY
#define EMSUART_TX_BIT_TIME 104 // bit time @9600 baud