Displaying 2 results from an estimated 2 matches for "battvoltage".
2011 Oct 14
2
[PATCH] Fix logic error in rhino driver
...)
diff --git a/drivers/rhino.c b/drivers/rhino.c
index ca66169..e478bcb 100644
--- a/drivers/rhino.c
+++ b/drivers/rhino.c
@@ -187,7 +187,7 @@ AutonomyCalc( int ia ) /* all models */
{
currin = ( UtilPowerOut + ConstInt ) *1.0 / Vin;
auton = ( ( ( AmpH *1.0 / currin ) * 60 * ( ( BattVoltage - VbatMin ) * 1.0 /( VbatNom - VbatMin ) ) * FM ) + FA );
- if( ( BattVoltage > 129 ) || ( BattVoltage < 144 ) )
+ if( ( BattVoltage > 129 ) && ( BattVoltage < 144 ) )
result = 133;
else
result = (int) auton;
--
1.7.4.4
2013 Oct 08
1
nut-2.6.5:rhino.c:190: bad if test ?
Hello there,
Offending source code is
????? if(? ( BattVoltage> 129 ) || ( BattVoltage < 144 ) )
Maybe swap || for && would be better.
This problem I found by using cppcheck. It said
[rhino.c:190]: (warning) Logical disjunction always evaluates to true: BattVoltage> 129 || BattVoltage < 144.
Regards
David Binderman