Skip to content

Commit

Permalink
add BatteryVoltage to function getVoltage
Browse files Browse the repository at this point in the history
  • Loading branch information
SW-Niko authored and schlimmchen committed Oct 24, 2024
1 parent bb92a73 commit f58fccf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/VictronMppt.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class VictronMpptClass {
enum class MPPTVoltage : uint8_t {
ABSORPTION = 0,
FLOAT = 1,
BATTERY = 2
};
float getVoltage(MPPTVoltage kindOf) const;

Expand Down
6 changes: 6 additions & 0 deletions src/VictronMppt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>(voltX.second / 1000.0);
Expand Down

0 comments on commit f58fccf

Please sign in to comment.