Skip to content

Commit

Permalink
Add another check whether we exceeded the maximum I
Browse files Browse the repository at this point in the history
We have ++I after the first check so add another one at the end.
  • Loading branch information
cschleifenbaum committed Oct 29, 2022
1 parent 52f92b3 commit 19d8718
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/i3LIM.cpp
Expand Up @@ -808,6 +808,11 @@ void i3LIMClass::CCS_Pwr_Con() //here we control ccs charging during state 6.
if(Tmp_Vbatt>Tmp_Vbatt_Spnt)CCSI_Spnt--;//decrement if voltage equal to or greater than setpoint.
if(CCS_Ilim==0x1)CCSI_Spnt--;//decrement if current limit flag is set
if(CCS_Plim==0x1)CCSI_Spnt--;//decrement if Power limit flag is set

// force once more that we stay within our maximum bounds
if(CCSI_Spnt>=Tmp_ICCS_Avail)CCSI_Spnt=Tmp_ICCS_Avail; //never exceed available current
if(CCSI_Spnt>Tmp_ICCS_Lim)CCSI_Spnt=Tmp_ICCS_Lim; //clamp setpoint to current lim paramater.

Param::SetInt(Param::CCS_Ireq,CCSI_Spnt);
}

Expand Down

0 comments on commit 19d8718

Please sign in to comment.