From e3996d84f7e60a3e95321755890118976b3eda08 Mon Sep 17 00:00:00 2001
From: Carl Philipp Klemm <philipp@uvos.xyz>
Date: Thu, 15 Feb 2024 17:23:26 +0100
Subject: [PATCH] Print maximum current correctly

---
 main.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/main.cpp b/main.cpp
index dd740ac..756c54e 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));
-- 
GitLab