Hoymiles Lib: Rename ChannelMaxPower to StringMaxPower

This commit is contained in:
Thomas Basler 2023-02-06 19:56:12 +01:00
parent d4c838a16e
commit ceaf08c1a0
5 changed files with 14 additions and 14 deletions

View File

@ -147,15 +147,15 @@ std::list<ChannelNum_t> StatisticsParser::getChannelsByType(ChannelType_t type)
return l; return l;
} }
uint16_t StatisticsParser::getChannelMaxPower(uint8_t channel) uint16_t StatisticsParser::getStringMaxPower(uint8_t channel)
{ {
return _chanMaxPower[channel]; return _stringMaxPower[channel];
} }
void StatisticsParser::setChannelMaxPower(uint8_t channel, uint16_t power) void StatisticsParser::setStringMaxPower(uint8_t channel, uint16_t power)
{ {
if (channel < sizeof(_chanMaxPower) / sizeof(_chanMaxPower[0])) { if (channel < sizeof(_stringMaxPower) / sizeof(_stringMaxPower[0])) {
_chanMaxPower[channel] = power; _stringMaxPower[channel] = power;
} }
} }
@ -230,8 +230,8 @@ static float calcEffiencyCh0(StatisticsParser* iv, uint8_t arg0)
static float calcIrradiation(StatisticsParser* iv, uint8_t arg0) static float calcIrradiation(StatisticsParser* iv, uint8_t arg0)
{ {
if (NULL != iv) { if (NULL != iv) {
if (iv->getChannelMaxPower(arg0) > 0) if (iv->getStringMaxPower(arg0) > 0)
return iv->getChannelFieldValue(TYPE_DC, static_cast<ChannelNum_t>(arg0), FLD_PDC) / iv->getChannelMaxPower(arg0) * 100.0f; return iv->getChannelFieldValue(TYPE_DC, static_cast<ChannelNum_t>(arg0), FLD_PDC) / iv->getStringMaxPower(arg0) * 100.0f;
} }
return 0.0; return 0.0;
} }

View File

@ -100,8 +100,8 @@ public:
const char* getChannelTypeName(ChannelType_t type); const char* getChannelTypeName(ChannelType_t type);
std::list<ChannelNum_t> getChannelsByType(ChannelType_t type); std::list<ChannelNum_t> getChannelsByType(ChannelType_t type);
uint16_t getChannelMaxPower(uint8_t channel); uint16_t getStringMaxPower(uint8_t channel);
void setChannelMaxPower(uint8_t channel, uint16_t power); void setStringMaxPower(uint8_t channel, uint16_t power);
void resetRxFailureCount(); void resetRxFailureCount();
void incrementRxFailureCount(); void incrementRxFailureCount();
@ -110,7 +110,7 @@ public:
private: private:
uint8_t _payloadStatistic[STATISTIC_PACKET_SIZE] = {}; uint8_t _payloadStatistic[STATISTIC_PACKET_SIZE] = {};
uint8_t _statisticLength = 0; uint8_t _statisticLength = 0;
uint16_t _chanMaxPower[CH4]; uint16_t _stringMaxPower[CH4];
const std::list<byteAssign_t>* _byteAssignment; const std::list<byteAssign_t>* _byteAssignment;

View File

@ -167,7 +167,7 @@ void WebApiInverterClass::onInverterAdd(AsyncWebServerRequest* request)
if (inv != nullptr) { if (inv != nullptr) {
for (uint8_t c = 0; c < INV_MAX_CHAN_COUNT; c++) { for (uint8_t c = 0; c < INV_MAX_CHAN_COUNT; c++) {
inv->Statistics()->setChannelMaxPower(c, inverter->channel[c].MaxChannelPower); inv->Statistics()->setStringMaxPower(c, inverter->channel[c].MaxChannelPower);
} }
} }
@ -296,7 +296,7 @@ void WebApiInverterClass::onInverterEdit(AsyncWebServerRequest* request)
if (inv != nullptr) { if (inv != nullptr) {
for (uint8_t c = 0; c < INV_MAX_CHAN_COUNT; c++) { for (uint8_t c = 0; c < INV_MAX_CHAN_COUNT; c++) {
inv->Statistics()->setChannelMaxPower(c, inverter.channel[c].MaxChannelPower); inv->Statistics()->setStringMaxPower(c, inverter.channel[c].MaxChannelPower);
} }
} }

View File

@ -137,7 +137,7 @@ void WebApiWsLiveClass::generateJsonResponse(JsonVariant& root)
addField(invObject, i, inv, t, c, FLD_PF); addField(invObject, i, inv, t, c, FLD_PF);
addField(invObject, i, inv, t, c, FLD_PRA); addField(invObject, i, inv, t, c, FLD_PRA);
addField(invObject, i, inv, t, c, FLD_EFF); addField(invObject, i, inv, t, c, FLD_EFF);
if (t == TYPE_DC && inv->Statistics()->getChannelMaxPower(c) > 0) { if (t == TYPE_DC && inv->Statistics()->getStringMaxPower(c) > 0) {
addField(invObject, i, inv, t, c, FLD_IRR); addField(invObject, i, inv, t, c, FLD_IRR);
} }
} }

View File

@ -149,7 +149,7 @@ void setup()
if (inv != nullptr) { if (inv != nullptr) {
for (uint8_t c = 0; c < INV_MAX_CHAN_COUNT; c++) { for (uint8_t c = 0; c < INV_MAX_CHAN_COUNT; c++) {
inv->Statistics()->setChannelMaxPower(c, config.Inverter[i].channel[c].MaxChannelPower); inv->Statistics()->setStringMaxPower(c, config.Inverter[i].channel[c].MaxChannelPower);
} }
} }
MessageOutput.println(F(" done")); MessageOutput.println(F(" done"));