DPL: use vedirect isdatavalid (#283)

* DPL: use VeDirect.isDataValid()

in case the communication to the Victron charger is disrupted, the
respective values in VeDirect.veFrame are not invalidated such that we
would notice a problem. instead, isDataValid() should be used to make
sure that the Victron charger is actually alive and that we can trust to
use the reported values.

* DPL: simplify canUseDirectSolarPower return statement
This commit is contained in:
Bernhard Kirchen 2023-07-02 14:10:47 +02:00 committed by GitHub
parent 8433820529
commit 097d464bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,16 +216,12 @@ bool PowerLimiterClass::canUseDirectSolarPower()
CONFIG_T& config = Configuration.get();
if (!config.PowerLimiter_SolarPassThroughEnabled
|| !config.Vedirect_Enabled) {
|| !config.Vedirect_Enabled
|| !VeDirect.isDataValid()) {
return false;
}
if (VeDirect.veFrame.PPV < 20) {
// Not enough power
return false;
}
return true;
return VeDirect.veFrame.PPV >= 20; // enough power?
}