From f02f66277907875cb6debc71e85b81c640bf2c6f Mon Sep 17 00:00:00 2001 From: Matti Airas Date: Wed, 14 Aug 2024 19:15:41 +0300 Subject: [PATCH] Update for SensESP v3 --- examples/vedirect-bmv.cpp | 7 +------ examples/vedirect-solar.cpp | 7 +------ library.json | 6 +++--- platformio.ini | 19 +++++++++++++------ src/sevedirect/sensors/vedirect.cpp | 4 +--- src/sevedirect/sensors/vedirect.h | 3 +-- 6 files changed, 20 insertions(+), 26 deletions(-) diff --git a/examples/vedirect-bmv.cpp b/examples/vedirect-bmv.cpp index 07641d1..b1001b5 100644 --- a/examples/vedirect-bmv.cpp +++ b/examples/vedirect-bmv.cpp @@ -22,10 +22,7 @@ using namespace sensesp; reactesp::ReactESP app; void setup() { -// Some initialization boilerplate when in debug mode... -#ifndef SERIAL_DEBUG_DISABLED - SetupSerialDebug(115200); -#endif + SetupLogging(); SensESPAppBuilder builder; @@ -99,8 +96,6 @@ void setup() { vedi->parser.data.maximum_auxiliary_voltage.connect_to( new SKOutputFloat("electrical.batteries.start.maximumVoltage", "/Signal K/Start Battery Maximum Voltage")); - - sensesp_app->start(); } void loop() { app.tick(); } diff --git a/examples/vedirect-solar.cpp b/examples/vedirect-solar.cpp index 67623e7..ef65a3a 100644 --- a/examples/vedirect-solar.cpp +++ b/examples/vedirect-solar.cpp @@ -24,10 +24,7 @@ using namespace sensesp; reactesp::ReactESP app; void setup() { -// Some initialization boilerplate when in debug mode... -#ifndef SERIAL_DEBUG_DISABLED - SetupSerialDebug(115200); -#endif + SetupLogging(); SensESPAppBuilder builder; @@ -68,8 +65,6 @@ void setup() { "electrical.solar." SOLAR_CHARGE_CONTROLLER_ID ".maxPowerToday", "/Signal K/Solar Charger " SOLAR_CHARGE_CONTROLLER_ID " Max Power Today")); - - sensesp_app->start(); } void loop() { app.tick(); } diff --git a/library.json b/library.json index ed226cf..4ff2b56 100644 --- a/library.json +++ b/library.json @@ -18,10 +18,10 @@ { "name": "SensESP", "owner": "SignalK", - "version": "^2.5.1" + "version": ">=3.0.0-beta.1,<4.0.0-alpha.1" } ], - "version": "1.0.0", + "version": "3.0.0", "frameworks": "arduino", "platforms": "*" -} \ No newline at end of file +} diff --git a/platformio.ini b/platformio.ini index 79e6cf8..155ebbc 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,16 +9,16 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -default_envs = +default_envs = esp32dev [env] framework = arduino lib_ldf_mode = deep monitor_speed = 115200 -lib_deps = - SignalK/SensESP @ ^2.5.1 - +lib_deps = + SignalK/SensESP@>=3.0.0-beta.1,<4.0.0 + [espressif32_base] platform = espressif32 build_unflags = -Werror=reorder @@ -28,5 +28,12 @@ monitor_filters = esp32_exception_decoder [env:esp32dev] extends = espressif32_base board = esp32dev -build_flags = - -D LED_BUILTIN=2 +build_flags = + -D LED_BUILTIN=2 + ; Max (and default) debugging level in Arduino ESP32 Core + -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE + ; Arduino Core bug workaround: define the log tag for the Arduino + ; logging macros. + -D TAG='"Arduino"' + ; Use the ESP-IDF logging library - required by SensESP. + -D USE_ESP_IDF_LOG diff --git a/src/sevedirect/sensors/vedirect.cpp b/src/sevedirect/sensors/vedirect.cpp index 202854f..4ead90c 100644 --- a/src/sevedirect/sensors/vedirect.cpp +++ b/src/sevedirect/sensors/vedirect.cpp @@ -4,9 +4,7 @@ #include "sensesp.h" VEDirectInput::VEDirectInput(Stream* rx_stream) - : Sensor(), rx_stream_{rx_stream} {} - -void VEDirectInput::start() { + : rx_stream_{rx_stream} { // enable reading the serial port ReactESP::app->onAvailable(*rx_stream_, [this]() { while (rx_stream_->available()) { diff --git a/src/sevedirect/sensors/vedirect.h b/src/sevedirect/sensors/vedirect.h index fadafe6..e6c7f8a 100644 --- a/src/sevedirect/sensors/vedirect.h +++ b/src/sevedirect/sensors/vedirect.h @@ -8,10 +8,9 @@ using namespace sensesp; namespace sensesp { -class VEDirectInput : public Sensor { +class VEDirectInput { public: VEDirectInput(Stream* rx_stream); - virtual void start() override final; VEDirect::Parser parser; private: