File tree Expand file tree Collapse file tree 1 file changed +5
-17
lines changed
Expand file tree Collapse file tree 1 file changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -106,29 +106,17 @@ void loop() {
106106 iRemaining = (byte)(round ((float )100 *iBattSoc/1024 ));
107107 iRunTimeToEmpty = (uint16_t )round ((float )iAvgTimeToEmpty*iRemaining/100 );
108108
109- // Charging
110- if (bCharging)
111- iPresentStatus.CHARGING = 1 ;
112- else
113- iPresentStatus.CHARGING = 0 ;
114- if (bACPresent)
115- iPresentStatus.ACPRESENT = 1 ;
116- else
117- iPresentStatus.ACPRESENT = 0 ;
118- if (iRemaining == iFullChargeCapacity)
119- iPresentStatus.FULLCHARGE = 1 ;
120- else
121- iPresentStatus.FULLCHARGE = 0 ;
109+ // Charging
110+ iPresentStatus.CHARGING = bCharging;
111+ iPresentStatus.ACPRESENT = bACPresent;
112+ iPresentStatus.FULLCHARGE = (iRemaining == iFullChargeCapacity);
122113
123114 // Discharging
124115 if (bDischarging) {
125116 iPresentStatus.DISCHARGING = 1 ;
126117 // if(iRemaining < iRemnCapacityLimit) iPresentStatus.BELOWRCL = 1;
127118
128- if (iRunTimeToEmpty < iRemainTimeLimit)
129- iPresentStatus.RTLEXPIRED = 1 ;
130- else
131- iPresentStatus.RTLEXPIRED = 0 ;
119+ iPresentStatus.RTLEXPIRED = (iRunTimeToEmpty < iRemainTimeLimit);
132120
133121 }
134122 else {
You can’t perform that action at this time.
0 commit comments