From 12a49427143e901c62c7a6e6873086392b8d32b6 Mon Sep 17 00:00:00 2001 From: proddy Date: Wed, 3 Jul 2024 22:39:41 +0200 Subject: [PATCH] minor updates for modbus --- CHANGELOG_LATEST.md | 1 + interface/package.json | 2 +- interface/yarn.lock | 32 ++++++++++++++++---------------- src/helpers.cpp | 2 +- src/helpers.h | 2 +- src/modbus.cpp | 4 +++- src/version.h | 2 +- 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 97047f74f..bcee95903 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -26,6 +26,7 @@ - make remote control timeout editable [#1774](https://github.com/emsesp/EMS-ESP32/issues/1774) - added extra pump characteristics (mode and pressure for EMS+) by @SLTKA [#1802](https://github.com/emsesp/EMS-ESP32/pull/1802) - allow device name to be customized [#1174](https://github.com/emsesp/EMS-ESP32/issues/1174) +- Modbus support by @mheyse [#1744](https://github.com/emsesp/EMS-ESP32/issues/1744) ## Fixed diff --git a/interface/package.json b/interface/package.json index e2fc7d328..a882db1b2 100644 --- a/interface/package.json +++ b/interface/package.json @@ -44,7 +44,7 @@ "react-dom": "latest", "react-dropzone": "^14.2.3", "react-icons": "^5.2.1", - "react-router-dom": "^6.24.0", + "react-router-dom": "^6.24.1", "react-toastify": "^10.0.5", "typesafe-i18n": "^5.26.2", "typescript": "^5.5.3" diff --git a/interface/yarn.lock b/interface/yarn.lock index d6f3305a2..2cce2f16a 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -1404,10 +1404,10 @@ __metadata: languageName: node linkType: hard -"@remix-run/router@npm:1.17.0": - version: 1.17.0 - resolution: "@remix-run/router@npm:1.17.0" - checksum: 10c0/6f39cb81c5dec3d3cb901cfc05ef1c745d23192def7d83e6d1a53c43cbb5d7ff488055fd1418ac72f904ff41b3d3ca339d223677994150f276c648123ce166f7 +"@remix-run/router@npm:1.17.1": + version: 1.17.1 + resolution: "@remix-run/router@npm:1.17.1" + checksum: 10c0/bee1631feb03975b64e1c7b574da432a05095dda2ff0f164c737e4952841a58d7b9861de87bd13a977fd970c74dcf8c558fc2d26c6ec01a9ae9041b1b4430869 languageName: node linkType: hard @@ -2016,7 +2016,7 @@ __metadata: react-dom: "npm:latest" react-dropzone: "npm:^14.2.3" react-icons: "npm:^5.2.1" - react-router-dom: "npm:^6.24.0" + react-router-dom: "npm:^6.24.1" react-toastify: "npm:^10.0.5" rollup-plugin-visualizer: "npm:^5.12.0" terser: "npm:^5.31.1" @@ -6130,27 +6130,27 @@ __metadata: languageName: node linkType: hard -"react-router-dom@npm:^6.24.0": - version: 6.24.0 - resolution: "react-router-dom@npm:6.24.0" +"react-router-dom@npm:^6.24.1": + version: 6.24.1 + resolution: "react-router-dom@npm:6.24.1" dependencies: - "@remix-run/router": "npm:1.17.0" - react-router: "npm:6.24.0" + "@remix-run/router": "npm:1.17.1" + react-router: "npm:6.24.1" peerDependencies: react: ">=16.8" react-dom: ">=16.8" - checksum: 10c0/2cb41120c1ff58fd1e187807214cf581e78e2845e5f411aa6a04f4748bd100431fd1ac5f8a45db281ea03d0d2354b66896b938c0b77adf7b343a6c1be52411de + checksum: 10c0/458c6c539304984c47b0ad8d5d5b1f8859cc0845e47591d530cb4fcb13498f70a89b42bc4daeea55d57cfa08408b453bcf601cabb2c987f554cdcac13805caa8 languageName: node linkType: hard -"react-router@npm:6.24.0": - version: 6.24.0 - resolution: "react-router@npm:6.24.0" +"react-router@npm:6.24.1": + version: 6.24.1 + resolution: "react-router@npm:6.24.1" dependencies: - "@remix-run/router": "npm:1.17.0" + "@remix-run/router": "npm:1.17.1" peerDependencies: react: ">=16.8" - checksum: 10c0/ad9c924d16dc4f5c90dff588e9a69d37488d2ad537de1ddbdf3b68561658c6e3fd1b8b12d16d50f19177f6547748c54e948d477e921f9230799ac71acfec24cf + checksum: 10c0/f50c78ca52c5154ab933c17708125e8bf71ccf2072993a80302526a0a23db9ceac6e36d5c891d62ccd16f13e60cd1b6533a2036523d1b09e0148ac49e34b2e83 languageName: node linkType: hard diff --git a/src/helpers.cpp b/src/helpers.cpp index f1316d313..a86dd54f9 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -837,7 +837,7 @@ uint16_t Helpers::string2minutes(const std::string & str) { } } -float Helpers::numericoperator2scalefactor(uint8_t numeric_operator) { +float Helpers::numericoperator2scalefactor(int8_t numeric_operator) { if (numeric_operator == 0) return 1.0f; else if (numeric_operator > 0) diff --git a/src/helpers.h b/src/helpers.h index cbd600f41..09fb654b8 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -50,7 +50,7 @@ class Helpers { static bool check_abs(const int32_t i); static uint32_t abs(const int32_t i); static uint16_t string2minutes(const std::string & str); - static float numericoperator2scalefactor(uint8_t numeric_operator); + static float numericoperator2scalefactor(int8_t numeric_operator); static float transformNumFloat(float value, const int8_t numeric_operator, const uint8_t fahrenheit = 0); diff --git a/src/modbus.cpp b/src/modbus.cpp index a67c15ba7..ba1423903 100644 --- a/src/modbus.cpp +++ b/src/modbus.cpp @@ -52,7 +52,8 @@ void Modbus::start(uint8_t systemServerId, uint16_t port, uint8_t max_clients, u void Modbus::stop() { #ifndef EMSESP_STANDALONE modbusServer_->stop(); - delete modbusServer_; + // virtual ~ModbusServerTCPasync() = default; + // delete modbusServer_; modbusServer_ = nullptr; #endif } @@ -65,6 +66,7 @@ bool Modbus::check_parameter_order() { if (isFirst) { isFirst = false; } else if (prev == nullptr || !prev->isLessThan(mi)) { + // TODO fix nullptr dereference when printing LOG_ERROR("Error in modbus parameters: %s must be listed before %s.", mi.short_name, prev->short_name); return false; } diff --git a/src/version.h b/src/version.h index 7d49b7130..344e2f19f 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.7.0-dev.20" +#define EMSESP_APP_VERSION "3.7.0-dev.21"