From f58fccf6133db7f4719cfffe534b4c7a4f0af210 Mon Sep 17 00:00:00 2001 From: SW-Nico Date: Thu, 15 Aug 2024 18:56:19 +0200 Subject: [PATCH] add BatteryVoltage to function getVoltage --- include/VictronMppt.h | 1 + src/VictronMppt.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/VictronMppt.h b/include/VictronMppt.h index 4ef9d0c69..c43fbb3cc 100644 --- a/include/VictronMppt.h +++ b/include/VictronMppt.h @@ -49,6 +49,7 @@ class VictronMpptClass { enum class MPPTVoltage : uint8_t { ABSORPTION = 0, FLOAT = 1, + BATTERY = 2 }; float getVoltage(MPPTVoltage kindOf) const; diff --git a/src/VictronMppt.cpp b/src/VictronMppt.cpp index cd9213e71..904d6be43 100644 --- a/src/VictronMppt.cpp +++ b/src/VictronMppt.cpp @@ -259,6 +259,12 @@ float VictronMpptClass::getVoltage(MPPTVoltage kindOf) const case MPPTVoltage::FLOAT: voltX = upController->getData().BatteryFloatMilliVolt; break; + case MPPTVoltage::BATTERY: + if (upController->isDataValid()) { + voltX.first = 1; + voltX.second = upController->getData().batteryVoltage_V_mV; + } + break; } if (voltX.first > 0) { return static_cast(voltX.second / 1000.0);