From 909f292c75d9e220b7bc538f688d2f4ee7bdfd24 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Sun, 5 Jul 2020 21:47:30 +0200 Subject: [PATCH 1/4] uart fixed delay --- src/uart/emsuart_esp32.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uart/emsuart_esp32.cpp b/src/uart/emsuart_esp32.cpp index dde12c0e0..660728929 100644 --- a/src/uart/emsuart_esp32.cpp +++ b/src/uart/emsuart_esp32.cpp @@ -213,7 +213,8 @@ uint16_t EMSuart::transmit(const uint8_t * buf, const uint8_t len) { } if (tx_mode_ == 5) { // wait before sending - vTaskDelay(4 / portTICK_PERIOD_MS); + //vTaskDelay(4 / portTICK_PERIOD_MS); + delayMicroseconds(4000); for (uint8_t i = 0; i < len; i++) { EMS_UART.fifo.rw_byte = buf[i]; } From 5261a42c302a730a2bfafd962d79f8113ac765f3 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Mon, 6 Jul 2020 08:40:36 +0200 Subject: [PATCH 2/4] no prompt in logging --- lib/uuid-console/src/shell_log.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/uuid-console/src/shell_log.cpp b/lib/uuid-console/src/shell_log.cpp index a33c7463a..8556f18a7 100644 --- a/lib/uuid-console/src/shell_log.cpp +++ b/lib/uuid-console/src/shell_log.cpp @@ -97,8 +97,8 @@ void Shell::output_logs() { ::yield(); - display_prompt(); } + display_prompt(); } } From 37b35d395ba2d39953b854e73ab2a1072e02c8d1 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Tue, 7 Jul 2020 06:16:42 +0200 Subject: [PATCH 3/4] ISM-values, typo in web --- .../src/project/EMSESPSettingsController.tsx | 30 +++++++++---------- src/devices/solar.cpp | 3 ++ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/interface/src/project/EMSESPSettingsController.tsx b/interface/src/project/EMSESPSettingsController.tsx index 7bb2923ca..3b743ad30 100644 --- a/interface/src/project/EMSESPSettingsController.tsx +++ b/interface/src/project/EMSESPSettingsController.tsx @@ -108,18 +108,6 @@ function EMSESPSettingsControllerForm(props: EMSESPSettingsControllerFormProps) onChange={handleValueChange('publish_time')} margin="normal" /> - - OFF - ERR - INFO - DEBUG - + + OFF + ERR + INFO + DEBUG + {data.syslog_level !== -1 && telegram) } telegram->read_bitvalue(pump_, 8, 0); // Solar pump on (1) or off (0) telegram->read_value(pumpWorkMin_, 10, 3); // force to 3 bytes + + telegram->read_bitvalue(tankHeated_, 9, 2); // issue #422 + telegram->read_bitvalue(collectorOnOff_, 9, 0); } /* From 40ac7bbf5b90928a8f34865b75da43dfbb775511 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Tue, 7 Jul 2020 16:46:27 +0200 Subject: [PATCH 4/4] fix: mqtt subscriptions, web devcelist, roomcontrol replys after switchoff --- interface/src/project/EMSESPSettingsController.tsx | 2 +- src/EMSESPDevicesService.cpp | 5 ++--- src/mqtt.cpp | 3 +++ src/roomcontrol.cpp | 9 ++++----- src/telegram.cpp | 11 +++++------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/interface/src/project/EMSESPSettingsController.tsx b/interface/src/project/EMSESPSettingsController.tsx index 8385577e1..9a139ec2f 100644 --- a/interface/src/project/EMSESPSettingsController.tsx +++ b/interface/src/project/EMSESPSettingsController.tsx @@ -155,7 +155,7 @@ function EMSESPSettingsControllerForm(props: EMSESPSettingsControllerFormProps) /> product_id(); deviceRoot["version"] = emsdevice->version(); } - - response->setLength(); - request->send(response); } + response->setLength(); + request->send(response); } } // namespace emsesp \ No newline at end of file diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 6232d92eb..25b00e4a3 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -256,6 +256,9 @@ void Mqtt::start(AsyncMqttClient * mqttClient) { #ifndef EMSESP_STANDALONE mqttClient_->setWill(make_topic(will_topic_, "status"), 1, true, "offline"); // with qos 1, retain true + mqttClient_->onMessage([this](char * topic, char * payload, AsyncMqttClientMessageProperties properties, size_t len, size_t index, size_t total) { + on_message(topic, payload, len); + }); #endif } diff --git a/src/roomcontrol.cpp b/src/roomcontrol.cpp index e1ab12430..96e801dbb 100644 --- a/src/roomcontrol.cpp +++ b/src/roomcontrol.cpp @@ -65,18 +65,17 @@ void Roomctrl::check(const uint8_t addr, const uint8_t * data) { if (hc_ > 3) { return; } - // no reply if the temperature is not set - if (remotetemp[hc_] == EMS_VALUE_SHORT_NOTSET) { - return; - } // reply to writes with write nack byte if (addr & 0x80) { // it's a write to us nack_write(); // we don't accept writes. return; } - // for now we only reply to version and remote temperature + // reads: for now we only reply to version and remote temperature + // empty message back if temperature not set or unknown message type if (data[2] == 0x02) { version(addr, data[0]); + } else if (remotetemp[hc_] == EMS_VALUE_SHORT_NOTSET) { + unknown(addr, data[0], data[2], data[3]); } else if (data[2] == 0xAF && data[3] == 0) { temperature(addr, data[0]); } else { diff --git a/src/telegram.cpp b/src/telegram.cpp index e8092c211..d0309195c 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -205,11 +205,6 @@ void RxService::add(uint8_t * data, uint8_t length) { message_length = length - 6 - shift; } - // if we don't have a type_id or empty data block, exit - if ((type_id == 0) || (message_length == 0)) { - return; - } - // if we're watching and "raw" print out actual telegram as bytes to the console if (EMSESP::watch() == EMSESP::Watch::WATCH_RAW) { uint16_t trace_watch_id = EMSESP::watch_id(); @@ -222,6 +217,11 @@ void RxService::add(uint8_t * data, uint8_t length) { LOG_DEBUG(F("[DEBUG] New Rx [#%d] telegram, message length %d"), rx_telegram_id_, message_length); #endif + // if we don't have a type_id or empty data block, exit + if ((type_id == 0) || (message_length == 0)) { + return; + } + // create the telegram auto telegram = std::make_shared(Telegram::Operation::RX, src, dest, type_id, offset, message_data, message_length); @@ -233,7 +233,6 @@ void RxService::add(uint8_t * data, uint8_t length) { rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue } - // // Tx CODE starts here... //