ExitAirSensor: Fix off by 1 error
We were applying pwmPercent-- on success loop where
we shouldn't be.
Tested: Default fan setting was 100 in bios
Change-Id: Id5f0b139979db7f5fe570934a76d7f3ed56c2785
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/ExitAirTempSensor.cpp b/src/ExitAirTempSensor.cpp
index 6befd35..5e9fc29 100644
--- a/src/ExitAirTempSensor.cpp
+++ b/src/ExitAirTempSensor.cpp
@@ -327,8 +327,18 @@
return pwmPercent;
}
+ bool firstLoop = true;
while (totalCFM > cfmMaxSetting)
{
+ if (firstLoop)
+ {
+ firstLoop = false;
+ }
+ else
+ {
+ pwmPercent--;
+ }
+
double ci = 0;
if (pwmPercent == 0)
{
@@ -355,12 +365,12 @@
// divide by 100 since pwm is in percent
totalCFM /= 100;
- pwmPercent--;
if (pwmPercent <= 0)
{
break;
}
}
+
return pwmPercent;
}