Skip to content

Commit

Permalink
Merge pull request #48 from jsphuebner/feature/limit_reason
Browse files Browse the repository at this point in the history
Added LimitationReasons "Charger" and "Battery"
  • Loading branch information
uhi22 authored Dec 13, 2024
2 parents 579817b + 6a1b97e commit 8e9cea0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 9 additions & 2 deletions ccs/hardwareInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,15 @@ int16_t hardwareInterface_getChargingTargetCurrent(void)
Param::SetInt(Param::LimitationReason, LIMITATIONREASON_INLET_HOT);
iEVTarget = iLimit;
} else {
/* no limitation */
Param::SetInt(Param::LimitationReason, LIMITATIONREASON_NONE);
int chargerLimit = Param::GetInt(Param::EvseMaxCurrent);

//Who is the weaker link in the chain - battery or charger?
if (iOriginalDemand >= chargerLimit)
Param::SetInt(Param::LimitationReason, LIMITATIONREASON_CHARGER);
else
Param::SetInt(Param::LimitationReason, LIMITATIONREASON_BATTERY);

/* no temperature limitation */
iEVTarget = iOriginalDemand;
}
Param::SetInt(Param::EVTargetCurrent, iEVTarget);
Expand Down
6 changes: 4 additions & 2 deletions include/param_prj.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/

//Define a version string of your firmware here
#define VERSION 0.42
#define VERSION 0.43

#include "myLogging.h"

Expand Down Expand Up @@ -128,7 +128,7 @@
#define CAT_CHARGE "Charge parameters"
#define CAT_COMM "Communication"
#define CAT_TEST "Testing"
#define LIMITREASONS "0=None, 1=InletHot"
#define LIMITREASONS "0=None, 1=Charger, 2=Battery, 3=InletHot"
#define PPVARIANT "0=Foccci4.1_3V3_1k, 1=Foccci4.2_5V_330up_3000down, 2=Foccci4.5_5V_330up_no_down"
#define ACOBCSTT "0=Idle, 1=Lock, 2=Charging, 3=Pause, 4=Complete, 5=Error"
#define PORTSTAT "0=Idle, 1=PluggedIn, 2=Ready, 3=ChargingAC, 4=ChargingDC, 5=Stopping, 6=Unlock, 7=PortError"
Expand Down Expand Up @@ -206,6 +206,8 @@ enum _stopreasons
enum _limitationreasons
{
LIMITATIONREASON_NONE,
LIMITATIONREASON_CHARGER,
LIMITATIONREASON_BATTERY,
LIMITATIONREASON_INLET_HOT
};

Expand Down

0 comments on commit 8e9cea0

Please sign in to comment.