diff --git a/lib/Hoymiles/src/inverters/InverterAbstract.cpp b/lib/Hoymiles/src/inverters/InverterAbstract.cpp index 77250bfe..386a4b06 100644 --- a/lib/Hoymiles/src/inverters/InverterAbstract.cpp +++ b/lib/Hoymiles/src/inverters/InverterAbstract.cpp @@ -40,6 +40,15 @@ const char* InverterAbstract::name() return _name; } +bool InverterAbstract::isProducing() +{ + if (!Statistics()->hasChannelFieldValue(CH0, FLD_PAC)) { + return false; + } + + return Statistics()->getChannelFieldValue(CH0, FLD_PAC) > 0; +} + AlarmLogParser* InverterAbstract::EventLog() { return _alarmLogParser.get(); @@ -112,8 +121,7 @@ uint8_t InverterAbstract::verifyAllFragments(CommandAbstract* cmd) Serial.println(F("All missing")); if (cmd->getSendCount() <= MAX_RESEND_COUNT) { return FRAGMENT_ALL_MISSING_RESEND; - } - else { + } else { cmd->gotTimeout(this); return FRAGMENT_ALL_MISSING_TIMEOUT; } diff --git a/lib/Hoymiles/src/inverters/InverterAbstract.h b/lib/Hoymiles/src/inverters/InverterAbstract.h index 7fedcd79..3738f97d 100644 --- a/lib/Hoymiles/src/inverters/InverterAbstract.h +++ b/lib/Hoymiles/src/inverters/InverterAbstract.h @@ -37,6 +37,8 @@ public: virtual const byteAssign_t* getByteAssignment() = 0; virtual const uint8_t getAssignmentCount() = 0; + bool isProducing(); + void clearRxFragmentBuffer(); void addRxFragment(uint8_t fragment[], uint8_t len); uint8_t verifyAllFragments(CommandAbstract* cmd);