Skip to content

Commit

Permalink
Fix: check config.Vedirect.Enabled for passthrough
Browse files Browse the repository at this point in the history
Guarded all solar_passthrough_enabled checks with a check for config.Vedirect.Enabled to prevent that setups without a solarcharger connected to the DTU from accidentally trying to start full-solar-passthrough. Those checks are needed because the default value for solar_passthrough_enabled is true.
  • Loading branch information
AndreasBoehm committed Jan 8, 2025
1 parent 1bbf531 commit b23fdb4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/PowerLimiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void PowerLimiterClass::loop()
config.PowerLimiter.VoltageStopThreshold,
config.PowerLimiter.BatterySocStopThreshold);

if (config.PowerLimiter.SolarPassThroughEnabled) {
if (config.Vedirect.Enabled && config.PowerLimiter.SolarPassThroughEnabled) {
MessageOutput.printf("[DPL] full solar-passthrough %s, start %.2f V or %u %%, stop %.2f V\r\n",
(isFullSolarPassthroughActive()?"active":"dormant"),
config.PowerLimiter.FullSolarPassThroughStartVoltage,
Expand Down Expand Up @@ -676,7 +676,8 @@ uint16_t PowerLimiterClass::getSolarPassthroughPower()
{
auto const& config = Configuration.get();

if (!config.PowerLimiter.SolarPassThroughEnabled
if (!config.Vedirect.Enabled
|| !config.PowerLimiter.SolarPassThroughEnabled
|| isBelowStopThreshold()
|| !VictronMppt.isDataValid()) {
return 0;
Expand Down Expand Up @@ -849,8 +850,11 @@ bool PowerLimiterClass::isFullSolarPassthroughActive()
// solar passthrough only applies to setups with battery-powered inverters
if (!usesBatteryPoweredInverter()) { return false; }

// solarcharger is needed for solar passthrough
if (!config.Vedirect.Enabled) { return false; }

// We only do full solar PT if general solar PT is enabled
if(!config.PowerLimiter.SolarPassThroughEnabled) { return false; }
if (!config.PowerLimiter.SolarPassThroughEnabled) { return false; }

if (testThreshold(config.PowerLimiter.FullSolarPassThroughSoc,
config.PowerLimiter.FullSolarPassThroughStartVoltage,
Expand Down

0 comments on commit b23fdb4

Please sign in to comment.