From ee75784f3a463c970ceee3d2d0d79633935fdcd8 Mon Sep 17 00:00:00 2001 From: DriftKingTW Date: Mon, 12 Oct 2020 07:19:20 +0800 Subject: [PATCH] Fix numeric type issue Convert integer to float before calculation. --- fan_control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fan_control.py b/fan_control.py index c9cda52..6a54955 100644 --- a/fan_control.py +++ b/fan_control.py @@ -44,7 +44,7 @@ def handleFanSpeed(): #print("Fan MAX") # Uncomment for testing # Caculate dynamic fan speed else: - step = (FAN_HIGH - FAN_LOW)/(MAX_TEMP - MIN_TEMP) + step = float(FAN_HIGH - FAN_LOW)/float(MAX_TEMP - MIN_TEMP) temp -= MIN_TEMP setFanSpeed(FAN_LOW + ( round(temp) * step )) #print(FAN_LOW + ( round(temp) * step )) # Uncomment for testing