watch_id on type can also be 7F..FF

This commit is contained in:
MichaelDvP
2020-09-10 17:13:16 +02:00
parent e99a1f0cd4
commit c10a619fbd
2 changed files with 4 additions and 8 deletions

View File

@@ -131,12 +131,7 @@ uint8_t EMSESP::actual_master_thermostat() {
// to watch both type IDs and device IDs // to watch both type IDs and device IDs
void EMSESP::watch_id(uint16_t watch_id) { void EMSESP::watch_id(uint16_t watch_id) {
// if it's a device ID, which is a single byte, remove the MSB so to support both Buderus and HT3 protocols watch_id_ = watch_id;
if (watch_id <= 0xFF) {
watch_id_ = (watch_id & 0x7F);
} else {
watch_id_ = watch_id;
}
} }
// change the tx_mode // change the tx_mode
@@ -491,7 +486,8 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
LOG_NOTICE(pretty_telegram(telegram).c_str()); LOG_NOTICE(pretty_telegram(telegram).c_str());
read_id_ = WATCH_ID_NONE; read_id_ = WATCH_ID_NONE;
} else if (watch() == WATCH_ON) { } else if (watch() == WATCH_ON) {
if ((watch_id_ == WATCH_ID_NONE) || (telegram->src == watch_id_) || (telegram->dest == watch_id_) || (telegram->type_id == watch_id_)) { if ((watch_id_ == WATCH_ID_NONE) || (telegram->type_id == watch_id_) ||
((watch_id_ < 0x80) && ((telegram->src == watch_id_) || (telegram->dest == watch_id_)))) {
LOG_NOTICE(pretty_telegram(telegram).c_str()); LOG_NOTICE(pretty_telegram(telegram).c_str());
} }
} }

View File

@@ -195,7 +195,7 @@ void RxService::add(uint8_t * data, uint8_t length) {
// if we're watching and "raw" print out actual telegram as bytes to the console // if we're watching and "raw" print out actual telegram as bytes to the console
if (EMSESP::watch() == EMSESP::Watch::WATCH_RAW) { if (EMSESP::watch() == EMSESP::Watch::WATCH_RAW) {
uint16_t trace_watch_id = EMSESP::watch_id(); uint16_t trace_watch_id = EMSESP::watch_id();
if ((trace_watch_id == WATCH_ID_NONE) || (src == trace_watch_id) || (dest == trace_watch_id) || (type_id == trace_watch_id)) { if ((trace_watch_id == WATCH_ID_NONE) || (type_id == trace_watch_id) || ((trace_watch_id < 0x80) && ((src == trace_watch_id) || (dest == trace_watch_id)))) {
LOG_NOTICE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); LOG_NOTICE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str());
} }
} }