From 5b2b26d032e017313a82a97d418277668f75e120 Mon Sep 17 00:00:00 2001 From: anhorbc <60405237+anhorbc@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:22:53 +0200 Subject: [PATCH] Update driver_flowiq2200.h --- driver_flowiq2200.h | 62 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/driver_flowiq2200.h b/driver_flowiq2200.h index 83b3b58..62e2c1a 100644 --- a/driver_flowiq2200.h +++ b/driver_flowiq2200.h @@ -44,10 +44,10 @@ struct Flowiq2200: Driver if (tpl_ci_field == 0x78) { ret_val = this->get_0413(telegram); } - else if ((tpl_ci_field == 0x79) && (l_field > 49)) { - ESP_LOGVV(TAG, "Found compressed frame"); + else if ((tpl_ci_field == 0x79) && (l_field > 49)) { + uint32_t usage{0}; - uint8_t i = 29; + uint8_t i = 28; usage = (((uint32_t)telegram[i+3] << 24) | ((uint32_t)telegram[i+2] << 16) | ((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0])); ret_val = usage / 1000.0; @@ -64,13 +64,13 @@ struct Flowiq2200: Driver ret_val = this->get_4413(telegram); } else if ((tpl_ci_field == 0x79) && (l_field > 49)) { - ESP_LOGVV(TAG, "Found compressed frame"); - // uint32_t usage{0}; - // uint8_t i = 28; - // usage = (((uint32_t)telegram[i+3] << 24) | ((uint32_t)telegram[i+2] << 16) | - // ((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0])); - // ret_val = usage / 1000.0; - // ESP_LOGVV(TAG, "Found target_water with '%d'->'%f'", usage, ret_val.value()); + ESP_LOGD(TAG, "Received frame is compressed"); + uint32_t usage{0}; + uint8_t i = 28; + usage = (((uint32_t)telegram[i+3] << 24) | ((uint32_t)telegram[i+2] << 16) | + ((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0])); + ret_val = usage / 1000.0; + ESP_LOGVV(TAG, "Found target_water with '%d'->'%f'", usage, ret_val.value()); } return ret_val; }; @@ -83,14 +83,14 @@ struct Flowiq2200: Driver ret_val = this->get_04FF23(telegram); } else if ((tpl_ci_field == 0x79) && (l_field > 49)) { - ESP_LOGVV(TAG, "Found compressed frame"); - // uint32_t status{0}; - // uint8_t i = 24; - // status = (((uint32_t)telegram[i+3] << 24) | ((uint32_t)telegram[i+2] << 16) | - // ((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0])); - // ret_val = (double)status; - // ESP_LOGVV(TAG, "Found status with '%08X'", status); - // } + ESP_LOGD(TAG, "Received frame is compressed"); + uint32_t status{0}; + uint8_t i = 24; + status = (((uint32_t)telegram[i+3] << 24) | ((uint32_t)telegram[i+2] << 16) | + ((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0])); + ret_val = (double)status; + ESP_LOGVV(TAG, "Found status with '%08X'", status); + } return ret_val; }; @@ -101,13 +101,13 @@ struct Flowiq2200: Driver if (tpl_ci_field == 0x78) { ret_val = this->get_023B(telegram); } - else if ((tpl_ci_field == 0x79) && (l_field > 49)) { - ESP_LOGVV(TAG, "Found compressed frame"); - // uint32_t flow{0}; - // uint8_t i = 44; - // flow = (((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0])); - // ret_val = (double)flow; - // ESP_LOGVV(TAG, "Found volume_flow with '%d'->'%f'", flow, ret_val.value()); + else if ((tpl_ci_field == 0x79) && (l_field > 49)) { + ESP_LOGD(TAG, "Received frame is compressed"); + uint32_t flow{0}; + uint8_t i = 44; + flow = (((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0])); + ret_val = (double)flow; + ESP_LOGVV(TAG, "Found volume_flow with '%d'->'%f'", flow, ret_val.value()); } return ret_val; }; @@ -120,12 +120,12 @@ struct Flowiq2200: Driver ret_val = this->get_523B(telegram); } else if ((tpl_ci_field == 0x79) && (l_field > 49)) { - ESP_LOGVV(TAG, "Found compressed frame"); - // uint32_t flow{0}; - // uint8_t i = 32; - // flow = (((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0])); - // ret_val = (double)flow; - // ESP_LOGVV(TAG, "Found max_flow with '%d'->'%f'", flow, ret_val.value()); + ESP_LOGD(TAG, "Received frame is compressed"); + uint32_t flow{0}; + uint8_t i = 32; + flow = (((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0])); + ret_val = (double)flow; + ESP_LOGVV(TAG, "Found max_flow with '%d'->'%f'", flow, ret_val.value()); } return ret_val; };