diff --git a/main.cpp b/main.cpp index dd740ac4943bdd7000c41b6f940291661bc4565e..756c54e572d58096fe1fc02fdd9795826efa98f6 100644 --- a/main.cpp +++ b/main.cpp @@ -125,13 +125,13 @@ static void currentMonitorThreadFn(Heaters* heaters, Vcpps* psu, float minVoltag if(maxCurrent < 255 && !status.curent_limited) { maxCurrent = std::min(255, maxCurrent+20); - Log(Log::INFO)<<"Voltage has recovered at "<<status.voltage<<". Max current now: "<<maxCurrent; + Log(Log::INFO)<<"Voltage has recovered at "<<status.voltage<<". Max current now: "<<static_cast<int>(maxCurrent); heaters->setMaxCurrent(maxCurrent); } - else if(status.voltage < minVoltage && maxCurrent > 100) + else if(status.voltage < minVoltage && maxCurrent > 100 && status.curent_limited) { maxCurrent -= 20; - Log(Log::INFO)<<"Voltage low at "<<status.voltage<<", sheading load. Max current now: "<<maxCurrent; + Log(Log::INFO)<<"Voltage low at "<<status.voltage<<", sheading load. Max current now: "<<static_cast<int>(maxCurrent); heaters->setMaxCurrent(maxCurrent); } std::this_thread::sleep_for(std::chrono::seconds(10));