Skip to content

Commit

Permalink
Merge pull request #140 from Tom-evnut/FOCCCI_CCS
Browse files Browse the repository at this point in the history
Foccci ccs
  • Loading branch information
damienmaguire authored Jan 5, 2025
2 parents 6347a5a + 15b97b5 commit 37a7415
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ OBJSL = $(BINARY).o hwinit.o stm32scheduler.o params.o terminal.o terminal_prj.
param_save.o errormessage.o stm32_can.o leafinv.o utils.o terminalcommands.o i3LIM.o \
chademo.o amperaheater.o amperacharger.o subaruvehicle.o iomatrix.o bmw_sbox.o NissanPDM.o teslaCharger.o extCharger.o vag_sbox.o \
daisychainbms.o simpbms.o outlanderCharger.o Can_OBD2.o cansdo.o TeslaDCDC.o BMW_E31.o F30_Lever.o \
CPC.o ElconCharger.o RearOutlanderinverter.o linbus.o VWheater.o JLR_G1.o JLR_G2.o Focci.o digipot.o\
CPC.o ElconCharger.o RearOutlanderinverter.o linbus.o VWheater.o JLR_G1.o JLR_G2.o Foccci.o digipot.o\
OutlanderHeartBeat.o E65_Lever.o leafbms.o V_Classic.o kangoobms.o OutlanderCanHeater.o

OBJS = $(patsubst %.o,$(OUT_DIR)/%.o, $(OBJSL))
Expand Down
8 changes: 4 additions & 4 deletions include/Focci.h → include/Foccci.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef Focci_h
#define Focci_h
#ifndef Foccci_h
#define Foccci_h

/* This library supports the Focci
/* This library supports the Foccci
https://github.com/uhi22/foccci
https://github.com/uhi22/ccs32clara
2024 - Tom de Bree
Expand All @@ -16,7 +16,7 @@

#define NODEID 22

class FocciClass: public Chargerint
class FoccciClass: public Chargerint
{

public:
Expand Down
6 changes: 3 additions & 3 deletions include/param_prj.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
PARAM_ENTRY(CAT_CHARGER, Chgctrl, CHGCTRL, 0, 2, 0, 45 ) \
PARAM_ENTRY(CAT_CHARGER, ChgAcVolt, "Vac", 0, 250, 240, 120 ) \
PARAM_ENTRY(CAT_CHARGER, ChgEff, "%", 0, 100, 90, 121) \
PARAM_ENTRY(CAT_CHARGER, ConfigFocci, ONOFF, 0, 1, 0, 133) \
PARAM_ENTRY(CAT_CHARGER, ConfigFoccci, ONOFF, 0, 1, 0, 133) \
PARAM_ENTRY(CAT_DCDC, DCdc_Type, DCDCTYPES, 0, 1, 0, 105 ) \
PARAM_ENTRY(CAT_DCDC, DCSetPnt, "V", 9, 15, 14, 106 ) \
PARAM_ENTRY(CAT_BMS, BMS_Timeout, "sec", 1, 120, 10, 91 ) \
Expand Down Expand Up @@ -287,7 +287,7 @@
#define HTCTRL "0=Disable, 1=Enable, 2=Timer"
#define CHGMODS "0=Off, 1=EXT_DIGI, 2=Volt_Ampera, 3=Leaf_PDM, 4=TeslaOI, 5=Out_lander, 6=Elcon"
#define CHGCTRL "0=Enable, 1=Disable, 2=Timer"
#define CHGINT "0=Unused, 1=i3LIM, 2=Chademo, 3=CPC, 4=Focci"
#define CHGINT "0=Unused, 1=i3LIM, 2=Chademo, 3=CPC, 4=Foccci"
#define CAN3SPD "0=k33.3, 1=k500, 2=k100"
#define TRNMODES "0=Manual, 1=Auto"
#define CAN_DEV "0=CAN1, 1=CAN2"
Expand Down Expand Up @@ -379,7 +379,7 @@ enum ChargeInterfaces
i3LIM = 1,
Chademo = 2,
CPC = 3,
Focci = 4
Foccci = 4
};

enum HeatType
Expand Down
32 changes: 16 additions & 16 deletions src/Focci.cpp → src/Foccci.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Focci.h>
#include <Foccci.h>
static uint8_t ChargePort_IsoStop = 0;
static uint16_t ChargePort_ACLimit = 0;
static uint8_t ChargePort_Status = 0;
Expand Down Expand Up @@ -61,7 +61,7 @@ static uint8_t CanConfigRxArr[7][8]=
{0x58,0x03,0x00,0x00,0x20,0x00,0x07,0x1}
};

void FocciClass::SetCanInterface(CanHardware* c)
void FoccciClass::SetCanInterface(CanHardware* c)
{
can = c;

Expand All @@ -70,7 +70,7 @@ void FocciClass::SetCanInterface(CanHardware* c)
can->RegisterUserMessage(0x596);
}

void FocciClass::DecodeCAN(int id, uint32_t* data)
void FoccciClass::DecodeCAN(int id, uint32_t* data)
{

switch(id)
Expand All @@ -92,7 +92,7 @@ void FocciClass::DecodeCAN(int id, uint32_t* data)
}
}

void FocciClass::handle109(uint32_t data[2]) //FOCCI DCFC info
void FoccciClass::handle109(uint32_t data[2]) //FOCCCI DCFC info
{
uint8_t* bytes = (uint8_t*)data;// arrgghhh this converts the two 32bit array into bytes. See comments are useful:)

Expand All @@ -103,7 +103,7 @@ void FocciClass::handle109(uint32_t data[2]) //FOCCI DCFC info

}

void FocciClass::handle357(uint32_t data[2]) //FOCCI Charge Port Info
void FoccciClass::handle357(uint32_t data[2]) //FOCCCI Charge Port Info
{
uint8_t* bytes = (uint8_t*)data;// arrgghhh this converts the two 32bit array into bytes. See comments are useful:)

Expand Down Expand Up @@ -185,7 +185,7 @@ void FocciClass::handle357(uint32_t data[2]) //FOCCI Charge Port Info
Param::SetInt(Param::PilotTyp,CP_Mode);
}

void FocciClass::handle596(uint32_t data[2]) //FOCCI SDO responses
void FoccciClass::handle596(uint32_t data[2]) //FOCCCI SDO responses
{
uint8_t* bytes = (uint8_t*)data;// arrgghhh this converts the two 32bit array into bytes. See comments are useful:)
if(RespondReq == 1)//only look at this if we have sent a message looking for a response
Expand Down Expand Up @@ -220,21 +220,21 @@ void FocciClass::handle596(uint32_t data[2]) //FOCCI SDO responses
}


void FocciClass::Task10Ms()
void FoccciClass::Task10Ms()
{
if(Param::GetInt(Param::ConfigFocci)==1)//do the config shit
if(Param::GetInt(Param::ConfigFoccci)==1)//do the config shit
{
ConfigCan();
}
}


void FocciClass::Task200Ms()
void FoccciClass::Task200Ms()
{

}

void FocciClass::Task100Ms()
void FoccciClass::Task100Ms()
{
if(ChargePort_ReadyDCFC)
{
Expand Down Expand Up @@ -275,7 +275,7 @@ void FocciClass::Task100Ms()
can->Send(0x358, (uint32_t*)bytes,8); //
}

void FocciClass::Chg_Timers()
void FoccciClass::Chg_Timers()
{
Timer_1Sec--; //decrement the loop counter

Expand All @@ -291,7 +291,7 @@ void FocciClass::Chg_Timers()
}
}

bool FocciClass::DCFCRequest(bool RunCh)
bool FoccciClass::DCFCRequest(bool RunCh)
{
if(ChargePort_ReadyDCFC == true)
{
Expand All @@ -304,7 +304,7 @@ bool FocciClass::DCFCRequest(bool RunCh)
RunCh = RunCh;
}

bool FocciClass::ACRequest(bool RunCh)
bool FoccciClass::ACRequest(bool RunCh)
{
ChargeAllow = RunCh;
if (ChargePort_ReadyCharge == false)
Expand All @@ -317,7 +317,7 @@ bool FocciClass::ACRequest(bool RunCh)
}
}

void FocciClass::CCS_Pwr_Con() //here we control ccs charging during state 6.
void FoccciClass::CCS_Pwr_Con() //here we control ccs charging during state 6.
{
uint16_t Tmp_Vbatt=Param::GetInt(Param::udc);//Actual measured battery voltage by isa shunt
uint16_t Tmp_Vbatt_Spnt=Param::GetInt(Param::Voltspnt);
Expand All @@ -337,7 +337,7 @@ void FocciClass::CCS_Pwr_Con() //here we control ccs charging during state 6.
Param::SetInt(Param::CCS_Ireq,CCSI_Spnt);
}

void FocciClass::ConfigCan()
void FoccciClass::ConfigCan()
{

//CAN sending//
Expand Down Expand Up @@ -580,6 +580,6 @@ void FocciClass::ConfigCan()
}
else if(ConfigStep == 5)//Config completed
{
Param::SetInt(Param::ConfigFocci,0);
Param::SetInt(Param::ConfigFoccci,0);
}
}
2 changes: 1 addition & 1 deletion src/NissanPDM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ bool NissanPDM::ControlCharge(bool RunCh, bool ACReq) //Modeled off of Outlander
}
break;

case Focci:
case Foccci:
if(RunCh && ACReq)//we have a startup request to AC charge from a charge interface
{
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/outlanderCharger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ bool outlanderCharger::ControlCharge(bool RunCh, bool ACReq)
}
break;

case Focci:
case Foccci:
if(RunCh && ACReq)//we have a startup request to AC charge from a charge interface
{
clearToStart=true;
Expand Down
12 changes: 6 additions & 6 deletions src/stm32_vcu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
#include "JLR_G2.h"
#include "no_Lever.h"
#include "CPC.h"
#include "Focci.h"
#include "Foccci.h"
#include "NoInverter.h"
#include "linbus.h"
#include "VWheater.h"
Expand Down Expand Up @@ -159,7 +159,7 @@ static outlanderCharger outChg;
static FCChademo chademoFC;
static i3LIMClass LIMFC;
static CPCClass CPCcan;
static FocciClass Foccican;
static FoccciClass Focccican;
static Can_OI openInv;
static NoInverterClass NoInverter;
static OutlanderInverter outlanderInv;
Expand Down Expand Up @@ -278,7 +278,7 @@ static void Ms200Task(void)
//in chademo , we do not want to run the 200ms task unless in dc charge mode
if(targetChgint == ChargeInterfaces::Chademo && chargeModeDC) selectedChargeInt->Task200Ms();
//In case of the LIM we want to send it all the time if lim in use
if((targetChgint == ChargeInterfaces::i3LIM) || (targetChgint == ChargeInterfaces::Unused) || (targetChgint == ChargeInterfaces::CPC)|| (targetChgint == ChargeInterfaces::Focci)) selectedChargeInt->Task200Ms();
if((targetChgint == ChargeInterfaces::i3LIM) || (targetChgint == ChargeInterfaces::Unused) || (targetChgint == ChargeInterfaces::CPC)|| (targetChgint == ChargeInterfaces::Foccci)) selectedChargeInt->Task200Ms();
//and just to be thorough ...
if(targetChgint == ChargeInterfaces::Unused) selectedChargeInt->Task200Ms();

Expand Down Expand Up @@ -419,7 +419,7 @@ static void Ms100Task(void)
int32_t IsaTemp=ISA::Temperature;
Param::SetInt(Param::tmpaux,IsaTemp);

if(targetChgint == ChargeInterfaces::i3LIM || targetChgint == ChargeInterfaces::Focci || chargeModeDC) selectedChargeInt->Task100Ms();// send the 100ms task request for the lim all the time and for others if in DC charge mode
if(targetChgint == ChargeInterfaces::i3LIM || targetChgint == ChargeInterfaces::Foccci || chargeModeDC) selectedChargeInt->Task100Ms();// send the 100ms task request for the lim all the time and for others if in DC charge mode

if(selectedChargeInt->DCFCRequest(RunChg))//Request to run dc fast charge
{
Expand Down Expand Up @@ -856,8 +856,8 @@ static void UpdateChargeInt()
case ChargeInterfaces::CPC:
selectedChargeInt = &CPCcan;
break;
case ChargeInterfaces::Focci:
selectedChargeInt = &Foccican;
case ChargeInterfaces::Foccci:
selectedChargeInt = &Focccican;
break;
}
//This will call SetCanFilters() via the Clear Callback
Expand Down
2 changes: 1 addition & 1 deletion src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ void CpSpoofOutput()
{
uint16_t CpVal = 0;

if(Param::GetInt(Param::interface) == ChargeInterfaces::i3LIM || Param::GetInt(Param::interface) == ChargeInterfaces::CPC || Param::GetInt(Param::interface) == ChargeInterfaces::Focci)
if(Param::GetInt(Param::interface) == ChargeInterfaces::i3LIM || Param::GetInt(Param::interface) == ChargeInterfaces::CPC || Param::GetInt(Param::interface) == ChargeInterfaces::Foccci)
{
CpVal = float(Param::GetInt(Param::PilotLim) *1.6667);
Param::SetInt(Param::CP_PWM,CpVal);
Expand Down
12 changes: 8 additions & 4 deletions stm32-vcu.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,20 @@
<Unit filename="include/E65_Lever.h" />
<Unit filename="include/ElconCharger.h" />
<Unit filename="include/F30_Lever.h" />
<Unit filename="include/Focci.h" />
<Unit filename="include/Foccci.h" />
<Unit filename="include/GS450H.h" />
<Unit filename="include/JLR_G1.h" />
<Unit filename="include/JLR_G2.h" />
<Unit filename="include/MCP2515.h" />
<Unit filename="include/MGCoolantHeater.h" />
<Unit filename="include/NissanPDM.h" />
<Unit filename="include/NoInverter.h" />
<Unit filename="include/NoVehicle.h" />
<Unit filename="include/OutlanderCanHeater.h" />
<Unit filename="include/OutlanderHeartBeat.h" />
<Unit filename="include/TeslaDCDC.h" />
<Unit filename="include/VWheater.h" />
<Unit filename="include/VWAirHeater.h" />
<Unit filename="include/VWCoolantHeater.h" />
<Unit filename="include/V_Classic.h" />
<Unit filename="include/amperaheater.h" />
<Unit filename="include/anain_prj.h" />
Expand Down Expand Up @@ -157,17 +159,19 @@
<Unit filename="src/E65_Lever.cpp" />
<Unit filename="src/ElconCharger.cpp" />
<Unit filename="src/F30_Lever.cpp" />
<Unit filename="src/Focci.cpp" />
<Unit filename="src/Foccci.cpp" />
<Unit filename="src/GS450H.cpp" />
<Unit filename="src/JLR_G1.cpp" />
<Unit filename="src/JLR_G2.cpp" />
<Unit filename="src/MCP2515.cpp" />
<Unit filename="src/MGCoolantHeater.cpp" />
<Unit filename="src/NissanPDM.cpp" />
<Unit filename="src/OutlanderCanHeater.cpp" />
<Unit filename="src/OutlanderHeartBeat.cpp" />
<Unit filename="src/RearOutlanderinverter.cpp" />
<Unit filename="src/TeslaDCDC.cpp" />
<Unit filename="src/VWheater.cpp" />
<Unit filename="src/VWAirHeater.cpp" />
<Unit filename="src/VWCoolantHeater.cpp" />
<Unit filename="src/V_Classic.cpp" />
<Unit filename="src/amperacharger.cpp" />
<Unit filename="src/amperaheater.cpp" />
Expand Down

0 comments on commit 37a7415

Please sign in to comment.