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

@@ -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 {