Skip to content

Commit

Permalink
Fix some cpplint linting errors in Powerlimiter files
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard Kaszt committed Feb 13, 2023
1 parent a1e579a commit fd297d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/PowerLimiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PowerLimiterClass {
float _powerMeter3Power;

bool canUseDirectSolarPower();
long getDirectSolarPower();
uint32_t getDirectSolarPower();
float getLoadCorrectedVoltage(std::shared_ptr<InverterAbstract> inverter);
bool isStartThresholdReached(std::shared_ptr<InverterAbstract> inverter);
bool isStopThresholdReached(std::shared_ptr<InverterAbstract> inverter);
Expand Down
14 changes: 7 additions & 7 deletions src/PowerLimiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ void PowerLimiterClass::onMqttMessage(const espMqttClientTypes::MessagePropertie
CONFIG_T& config = Configuration.get();

if (strcmp(topic, config.PowerLimiter_MqttTopicPowerMeter1) == 0) {
_powerMeter1Power = std::stof(std::string((char *)payload, (unsigned int)len));
_powerMeter1Power = std::stof(std::string(reinterpret_cast<const char*>(payload), (unsigned int)len));
}

if (strcmp(topic, config.PowerLimiter_MqttTopicPowerMeter2) == 0) {
_powerMeter2Power = std::stof(std::string((char *)payload, (unsigned int)len));
_powerMeter2Power = std::stof(std::string(reinterpret_cast<const char*>(payload), (unsigned int)len));
}

if (strcmp(topic, config.PowerLimiter_MqttTopicPowerMeter3) == 0) {
_powerMeter3Power = std::stof(std::string((char *)payload, (unsigned int)len));
_powerMeter3Power = std::stof(std::string(reinterpret_cast<const char*>(payload), (unsigned int)len));
}

_lastPowerMeterUpdate = millis();
Expand Down Expand Up @@ -89,10 +89,10 @@ void PowerLimiterClass::loop()
return;
}

long victronChargePower = this->getDirectSolarPower();
uint32_t victronChargePower = this->getDirectSolarPower();

Hoymiles.getMessageOutput()->printf("[PowerLimiterClass::loop] victronChargePower: %d\n",
(int)victronChargePower);
static_cast<int>(victronChargePower));

if (millis() - _lastPowerMeterUpdate < (30 * 1000)) {
Hoymiles.getMessageOutput()->printf("[PowerLimiterClass::loop] dcVoltage: %f config.PowerLimiter_VoltageStartThreshold: %f config.PowerLimiter_VoltageStopThreshold: %f inverter->isProducing(): %d\n",
Expand Down Expand Up @@ -149,7 +149,7 @@ void PowerLimiterClass::loop()
int32_t newPowerLimit = 0;

if (millis() - _lastPowerMeterUpdate < (30 * 1000)) {
newPowerLimit = int(_powerMeter1Power + _powerMeter2Power + _powerMeter3Power);
newPowerLimit = static_cast<int>(_powerMeter1Power + _powerMeter2Power + _powerMeter3Power);

if (config.PowerLimiter_IsInverterBehindPowerMeter) {
// If the inverter the behind the power meter (part of measurement),
Expand Down Expand Up @@ -202,7 +202,7 @@ bool PowerLimiterClass::canUseDirectSolarPower()
return true;
}

long PowerLimiterClass::getDirectSolarPower()
uint32_t PowerLimiterClass::getDirectSolarPower()
{
if (!this->canUseDirectSolarPower()) {
return 0;
Expand Down

0 comments on commit fd297d2

Please sign in to comment.