Skip to content

Commit

Permalink
Merge pull request #166 from damienmaguire/Vehicle_Testing
Browse files Browse the repository at this point in the history
Vehicle testing push into DEV branch - Brings DEV branch inline to reduce future merge efforts
  • Loading branch information
Tom-evnut authored Feb 28, 2025
2 parents 8a2f7fa + 8bd5f2f commit 709796d
Show file tree
Hide file tree
Showing 10 changed files with 662 additions and 146 deletions.
72 changes: 72 additions & 0 deletions Documentation/CAN dbcs/oi-inverter.dbc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
VERSION ""


NS_ :
NS_DESC_
CM_
BA_DEF_
BA_
VAL_
CAT_DEF_
CAT_
FILTER
BA_DEF_DEF_
EV_DATA_
ENVVAR_DATA_
SGTYPE_
SGTYPE_VAL_
BA_DEF_SGTYPE_
BA_SGTYPE_
SIG_TYPE_REF_
VAL_TABLE_
SIG_GROUP_
SIG_VALTYPE_
SIGTYPE_VALTYPE_
BO_TX_BU_
BA_DEF_REL_
BA_REL_
BA_DEF_DEF_REL_
BU_SG_REL_
BU_EV_REL_
BU_BO_REL_
SG_MUL_VAL_

BS_:

BU_:
VAL_TABLE_ Opmode 2 "ManualRun" 1 "Run" 0 "Off" ;


BO_ 400 InverterFeedback: 8 Vector__XXX
SG_ Inv_Voltage : 8|16@1+ (0.1,0) [0|6553.5] "V" Vector__XXX
SG_ Inv_Speed : 24|16@1+ (1,0) [0|65535] "rpm" Vector__XXX
SG_ Inv_Opmode : 7|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ Inv_MotorTemp : 55|8@0+ (1,-30) [-30|225] "C" Vector__XXX
SG_ Inv_HeatsinkTemp : 47|8@0+ (1,-30) [-30|225] "C" Vector__XXX

BO_ 2147483711 Vector__XXXMsg99: 8 Vector__XXX
SG_ pot : 0|12@1+ (1,0) [0|1] "" Vector__XXX
SG_ pot2 : 12|12@1+ (1,0) [0|1] "" Vector__XXX
SG_ cruise : 24|1@1+ (1,0) [0|1] "" Vector__XXX
SG_ start : 25|1@1+ (1,0) [0|1] "" Vector__XXX
SG_ brake : 26|1@1+ (1,0) [0|1] "" Vector__XXX
SG_ forward : 27|1@1+ (1,0) [0|1] "" Vector__XXX
SG_ reverse : 28|1@1+ (1,0) [0|1] "" Vector__XXX
SG_ bms : 29|1@1+ (1,0) [0|1] "" Vector__XXX
SG_ cruisespeed : 32|14@1+ (1,0) [0|1] "" Vector__XXX
SG_ regenpreset : 48|8@1+ (1,0) [0|1] "" Vector__XXX



BA_DEF_ BO_ "GenMsgBackgroundColor" STRING ;
BA_DEF_ BO_ "GenMsgForegroundColor" STRING ;
BA_DEF_ BO_ "matchingcriteria" INT 0 0;
BA_DEF_ BO_ "filterlabeling" INT 0 0;
BA_DEF_DEF_ "GenMsgBackgroundColor" "#ffffff";
BA_DEF_DEF_ "GenMsgForegroundColor" "#000000";
BA_DEF_DEF_ "matchingcriteria" 0;
BA_DEF_DEF_ "filterlabeling" 1;
BA_ "GenMsgBackgroundColor" BO_ 2147483711 "#57e389";
BA_ "GenMsgForegroundColor" BO_ 2147483711 "#000000";
VAL_ 400 Inv_Opmode 2 "ManualRun" 1 "Run" 0 "Off" ;

File renamed without changes.
44 changes: 30 additions & 14 deletions include/Can_OI.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,41 @@
#include "canhardware.h"
#include <stdint.h>

#define NODEIDCANOI 1

class Can_OI: public Inverter
{
public:
void Task100Ms() override;
void DecodeCAN(int, uint32_t*) override;
void SetTorque(float torquePercent) override;
float GetMotorTemperature() override { return motor_temp; }
float GetInverterTemperature() override { return inv_temp; }
float GetInverterVoltage() override { return voltage; }
float GetMotorSpeed() override { return speed; }
int GetInverterState() override;
void SetCanInterface(CanHardware* c) override;
void Task100Ms() override;
void DecodeCAN(int, uint32_t*) override;
void SetTorque(float torquePercent) override;
float GetMotorTemperature() override
{
return motor_temp;
}
float GetInverterTemperature() override
{
return inv_temp;
}
float GetInverterVoltage() override
{
return voltage;
}
float GetMotorSpeed() override
{
return speed;
}
int GetInverterState() override;
void SetCanInterface(CanHardware* c) override;
void ConfigCan();

private:
static int16_t speed;
static int16_t inv_temp;
static int16_t motor_temp;
static uint16_t voltage;
static int16_t final_torque_request;
static int16_t speed;
static int16_t inv_temp;
static int16_t motor_temp;
static uint16_t voltage;
static int16_t final_torque_request;
static void handleSDO(uint32_t data[2]);
};

#endif // CAN_OI_H
2 changes: 1 addition & 1 deletion include/iomatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class IOMatrix
{
NONE, CHADEMOALLOW, OBCENABLE, HEATERENABLE, RUNINDICATION, WARNINDICATION,
COOLANTPUMP, NEGCONTACTOR, BRAKELIGHT, REVERSELIGHT, HEATREQ, HVREQ,
DCFCREQUEST, BRAKEVACPUMP, COOLINGFAN, HVACTIVE, PWM_TIM3,CP_SPOOF,
DCFCREQUEST, BRAKEVACPUMP, COOLINGFAN, HVACTIVE, SHIFTLOCKNO, PWM_TIM3,CP_SPOOF,
GS450HOIL,PWMTEMPGAUGE, PWMSOCGAUGE, LAST
};
//order of these matters!
Expand Down
32 changes: 19 additions & 13 deletions include/param_prj.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define VER 2.30.TA

#define VER 2.31.TE


/* Entries must be ordered as follows:
1. Saveable parameters (id != 0)
2. Temporary parameters (id = 0)
3. Display values
*/
//Next param id (increase when adding new parameter!): 139
//Next param id (increase when adding new parameter!): 149
/* category name unit min max default id */
#define PARAM_LIST \
PARAM_ENTRY(CAT_SETUP, Inverter, INVMODES, 0, 8, 0, 5 ) \
Expand All @@ -48,6 +49,7 @@
PARAM_ENTRY(CAT_SETUP, DCDCCan, CAN_DEV, 0, 1, 1, 107 ) \
PARAM_ENTRY(CAT_SETUP, HeaterCan, CAN_DEV, 0, 1, 1, 138 ) \
PARAM_ENTRY(CAT_SETUP, MotActive, MotorsAct,0, 3, 0, 129 ) \
PARAM_ENTRY(CAT_SETUP, ConfigCANOI, ONOFF, 0, 1, 0, 149 ) \
PARAM_ENTRY(CAT_THROTTLE, potmin, "dig", 0, 4095, 0, 7 ) \
PARAM_ENTRY(CAT_THROTTLE, potmax, "dig", 0, 4095, 4095, 8 ) \
PARAM_ENTRY(CAT_THROTTLE, pot2min, "dig", 0, 4095, 4095, 9 ) \
Expand All @@ -59,6 +61,8 @@
PARAM_ENTRY(CAT_THROTTLE, regenramp, "%/10ms", 0.1, 100, 1, 68 ) \
PARAM_ENTRY(CAT_THROTTLE, potmode, POTMODES, 0, 1, 0, 11 ) \
PARAM_ENTRY(CAT_THROTTLE, dirmode, DIRMODES, 0, 4, 1, 12 ) \
PARAM_ENTRY(CAT_THROTTLE, DirChange, DIRLIM, 0, 2, 0, 147 ) \
PARAM_ENTRY(CAT_THROTTLE, DirChangeRpm,"rpm", 0, 20000, 500, 139 ) \
PARAM_ENTRY(CAT_THROTTLE, reversemotor, ONOFF, 0, 1, 0, 127 ) \
PARAM_ENTRY(CAT_THROTTLE, throtramp, "%/10ms", 1, 100, 10, 13 ) \
PARAM_ENTRY(CAT_THROTTLE, throtramprpm,"rpm", 0, 20000, 20000, 14 ) \
Expand Down Expand Up @@ -119,14 +123,14 @@
PARAM_ENTRY(CAT_CLOCK, Pre_Min, "Mins", 0, 59, 0, 54 ) \
PARAM_ENTRY(CAT_CLOCK, Pre_Dur, "Mins", 0, 60, 0, 55 ) \
PARAM_ENTRY(CAT_IOPINS, PumpPWM, PumpOutType,0, 2, 0, 135 ) \
PARAM_ENTRY(CAT_IOPINS, Out1Func, PINFUNCS, 0, 15, 6, 80 ) \
PARAM_ENTRY(CAT_IOPINS, Out2Func, PINFUNCS, 0, 15, 7, 81 ) \
PARAM_ENTRY(CAT_IOPINS, Out3Func, PINFUNCS, 0, 15, 3, 82 ) \
PARAM_ENTRY(CAT_IOPINS, SL1Func, PINFUNCS, 0, 15, 0, 83 ) \
PARAM_ENTRY(CAT_IOPINS, SL2Func, PINFUNCS, 0, 15, 0, 84 ) \
PARAM_ENTRY(CAT_IOPINS, PWM1Func, PINFUNCS, 0, 20, 0, 85 ) \
PARAM_ENTRY(CAT_IOPINS, PWM2Func, PINFUNCS, 0, 20, 4, 86 ) \
PARAM_ENTRY(CAT_IOPINS, PWM3Func, PINFUNCS, 0, 20, 2, 87 ) \
PARAM_ENTRY(CAT_IOPINS, Out1Func, PINFUNCS, 0, 16, 6, 80 ) \
PARAM_ENTRY(CAT_IOPINS, Out2Func, PINFUNCS, 0, 16, 7, 81 ) \
PARAM_ENTRY(CAT_IOPINS, Out3Func, PINFUNCS, 0, 16, 3, 82 ) \
PARAM_ENTRY(CAT_IOPINS, SL1Func, PINFUNCS, 0, 16, 0, 83 ) \
PARAM_ENTRY(CAT_IOPINS, SL2Func, PINFUNCS, 0, 16, 0, 84 ) \
PARAM_ENTRY(CAT_IOPINS, PWM1Func, PINFUNCS, 0, 21, 0, 85 ) \
PARAM_ENTRY(CAT_IOPINS, PWM2Func, PINFUNCS, 0, 21, 4, 86 ) \
PARAM_ENTRY(CAT_IOPINS, PWM3Func, PINFUNCS, 0, 21, 2, 87 ) \
PARAM_ENTRY(CAT_IOPINS, GP12VInFunc, PINFUNCS, 0, 13, 12, 98 ) \
PARAM_ENTRY(CAT_IOPINS, HVReqFunc, PINFUNCS, 0, 13, 12, 99 ) \
PARAM_ENTRY(CAT_IOPINS, PB1InFunc, PINFUNCS, 0, 13, 12, 140 ) \
Expand Down Expand Up @@ -204,6 +208,7 @@
VALUE_ENTRY(din_reverse, ONOFF, 2039 ) \
VALUE_ENTRY(din_bms, ONOFF, 2040 ) \
VALUE_ENTRY(din_12Vgp, ONOFF, 2071 ) \
VALUE_ENTRY(ShiftLock, ONOFF, 2108 ) \
VALUE_ENTRY(handbrk, ONOFF, 2041 ) \
VALUE_ENTRY(Gear1, ONOFF, 2042 ) \
VALUE_ENTRY(Gear2, ONOFF, 2043 ) \
Expand Down Expand Up @@ -247,7 +252,7 @@
VALUE_ENTRY(powerheater, "W", 2098 ) \
VALUE_ENTRY(VehLockSt, ONOFF, 2100 ) \

//Next value Id: 2108
//Next value Id: 2109

//Dead params
/*
Expand All @@ -259,8 +264,8 @@
#define VERSTR STRINGIFY(4=VER)
#define PINFUNCS "0=None, 1=ChaDeMoAlw, 2=OBCEnable, 3=HeaterEnable, 4=RunIndication, 5=WarnIndication," \
"6=CoolantPump, 7=NegContactor, 8=BrakeLight, 9=ReverseLight, 10=HeatReq, 11=HVRequest," \
"12=DCFCRequest, 13=BrakeVacPump, 14=CoolingFan, 15=HvActive, 16=PwmTim3, 17=CpSpoof,"\
"18=GS450pump, 19=PwmTempGauge, 20=PwmSocGauge"
"12=DCFCRequest, 13=BrakeVacPump, 14=CoolingFan, 15=HvActive, 16=ShiftLockNO, 17=PwmTim3, 18=CpSpoof,"\
"19=GS450pump, 20=PwmTempGauge, 21=PwmSocGauge"
#define APINFUNCS "0=None, 1=ProxPilot, 2=BrakeVacSensor"
#define SHIFTERS "0=None, 1=BMW_F30, 2=JLR_G1, 3=JLR_G2, 4=BMW_E65"
#define SHNTYPE "0=None, 1=ISA, 2=SBOX, 3=VAG"
Expand Down Expand Up @@ -315,6 +320,7 @@
#define MotorsAct "0=Mg1and2, 1=Mg1, 2=Mg2, 3=BlendingMG2and1"
#define PumpOutType "0=GS450hOil, 1=TachoOut, 2=SpeedoOut"
#define LIMITREASON "0=None, 1=UDClimLow, 2=UDClimHigh, 4=IDClimLow, 8=IDClimHigh, 16=TempLim"
#define DIRLIM "0=None, 1=SpeedThres, 2=SpeedBrake"

#define CAN_PERIOD_100MS 0
#define CAN_PERIOD_10MS 1
Expand Down
Loading

0 comments on commit 709796d

Please sign in to comment.