Skip to content

Commit

Permalink
Merge pull request #109 from Tom-evnut/FeatureUpdateSept24
Browse files Browse the repository at this point in the history
Feature update sept24 - Jamie Jones Special Edition
  • Loading branch information
damienmaguire authored Sep 26, 2024
2 parents 90b7d64 + 38d2b9c commit 6408be7
Show file tree
Hide file tree
Showing 21 changed files with 677 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ OBJSL = $(BINARY).o hwinit.o stm32scheduler.o params.o terminal.o terminal_prj.
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\
E65_Lever.o leafbms.o V_Classic.o
OutlanderHeartBeat.o E65_Lever.o leafbms.o V_Classic.o kangoobms.o OutlanderCanHeater.o

OBJS = $(patsubst %.o,$(OUT_DIR)/%.o, $(OBJSL))
vpath %.c src/ libopeninv/src/
Expand Down
3 changes: 2 additions & 1 deletion include/BMW_E65.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ class BMW_E65: public Vehicle
bool Start() { return terminal15On; }
void DashOff();
void handle130(uint32_t data[2]);
void handle192(uint32_t data[2]);
void handle1A0(uint32_t data[2]);
void handle2FC(uint32_t data[2]);
void handle480(uint32_t data[2]);
void SetE90(bool e90) { isE90 = e90; }
void Engine_Data();
void SetFuelGauge(float level);

private:
void SendAbsDscMessages(bool Brake_In);
Expand Down
44 changes: 44 additions & 0 deletions include/OutlanderCanHeater.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* This file is part of the Zombieverter VCU project.
*
* Copyright (C) 2018 Johannes Huebner <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OUTLANDERCANHEATER_H
#define OUTLANDERCANHEATER_H

//#include <libopencm3/stm32/usart.h>
#include <heater.h>


class OutlanderCanHeater : public Heater
{
public:
void SetTargetTemperature(float temp);
void SetCanInterface(CanHardware* c);
void DecodeCAN(int id, uint32_t data[2]);
void SetPower(uint16_t power, bool HeatReq);
void Task100Ms();

private:
int8_t currentTemperature;
int8_t desiredTemperature;

bool shouldHeat;
static void handle398(uint32_t data[2]);

};

#endif // OUTLANDERCANHEATER_H
43 changes: 43 additions & 0 deletions include/OutlanderHeartBeat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* This file is part of the ZombieVerter project.
*
* Copyright (C) 2021-2023 Johannes Huebner <[email protected]>
* Damien Maguire <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*Control of the Mitsubishi Outlander PHEV on board charger (OBC) and DCDC Converter.
*
*/
#ifndef OUTLANDERHEARTBEAT_H
#define OUTLANDERHEARTBEAT_H

#include <stdint.h>
#include "params.h"
#include "canhardware.h"

class OutlanderHeartBeat
{

public:
static void Task100Ms();
static void SetCanInterface(CanHardware* c);
static void SetPullInEVSE(bool pullInEVSE);


protected:

};

#endif // OUTLANDERHEARTBEAT_H
1 change: 0 additions & 1 deletion include/chargerint.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class Chargerint
virtual void DeInit() {} //called when switching to another charger, similar to a destructor
virtual void SetCanInterface(CanHardware* c) { can = c; }


protected:
CanHardware* can;
};
Expand Down
1 change: 1 addition & 0 deletions include/heater.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Heater
virtual void SetPower(uint16_t power, bool HeatReq) = 0; //Must be called cyclically with power in watts
virtual void DeInit() {} //called when switching to another heater, similar to a destructor
virtual void SetCanInterface(CanHardware* c) { can = c; }
virtual void Task100Ms() {};

protected:
CanHardware* can;
Expand Down
51 changes: 51 additions & 0 deletions include/kangoobms.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* This file is part of the ZombieVerter project.
*
* Copyright (C) 2022 Charlie Smurthwaite
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef KANGOOBMS_H
#define KANGOOBMS_H
#include <stdint.h>

class KangooBMS: public BMS
{
public:
virtual void SetCanInterface(CanHardware* c);
void DecodeCAN(int id, uint8_t * data);
float MaxChargeCurrent();
float GetCurrent();
void Task100Ms();
private:
bool BMSDataValid();
bool ChargeAllowed();
int messageCounter = 0;
int chargeCurrentLimit = 0;
int timeoutCounter = 0;
uint16_t maxChargeAllowed = 0;
uint8_t maxInput = 0;
uint8_t maxOutput = 0;
uint16_t isolationResistance = 0;
float minCellV = 0;
float maxCellV = 0;
float minTempC = 0;
float maxTempC = 0;
float stateOfCharge = 0;
float current = 0;
float remainingKHW = 0;
float batteryVoltage = 500; //higher than possible so cannot complete precharge until BMS reports battery voltage
};
#endif // SIMPBMS_H
23 changes: 15 additions & 8 deletions include/param_prj.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
* 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.20.TK
#define VER 2.20.TN


/* 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!): 138
//Next param id (increase when adding new parameter!): 139
/* category name unit min max default id */
#define PARAM_LIST \
PARAM_ENTRY(CAT_SETUP, Inverter, INVMODES, 0, 8, 0, 5 ) \
Expand All @@ -34,7 +34,7 @@
PARAM_ENTRY(CAT_SETUP, Transmission, TRNMODES, 0, 1, 0, 78 ) \
PARAM_ENTRY(CAT_SETUP, interface, CHGINT, 0, 4, 0, 39 ) \
PARAM_ENTRY(CAT_SETUP, chargemodes, CHGMODS, 0, 6, 0, 37 ) \
PARAM_ENTRY(CAT_SETUP, BMS_Mode, BMSMODES, 0, 4, 0, 90 ) \
PARAM_ENTRY(CAT_SETUP, BMS_Mode, BMSMODES, 0, 5, 0, 90 ) \
PARAM_ENTRY(CAT_SETUP, ShuntType, SHNTYPE, 0, 3, 0, 88 ) \
PARAM_ENTRY(CAT_SETUP, InverterCan, CAN_DEV, 0, 1, 0, 70 ) \
PARAM_ENTRY(CAT_SETUP, VehicleCan, CAN_DEV, 0, 1, 1, 71 ) \
Expand All @@ -45,6 +45,7 @@
PARAM_ENTRY(CAT_SETUP, OBD2Can, CAN_DEV, 0, 1, 0, 96 ) \
PARAM_ENTRY(CAT_SETUP, CanMapCan, CAN_DEV, 0, 1, 0, 97 ) \
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, 2, 0, 129 ) \
PARAM_ENTRY(CAT_THROTTLE, potmin, "dig", 0, 4095, 0, 7 ) \
PARAM_ENTRY(CAT_THROTTLE, potmax, "dig", 0, 4095, 4095, 8 ) \
Expand Down Expand Up @@ -102,7 +103,7 @@
PARAM_ENTRY(CAT_BMS, BMS_VmaxLimit, "V", 0, 10, 4.2, 93 ) \
PARAM_ENTRY(CAT_BMS, BMS_TminLimit, "°C", -100, 100, 5, 94 ) \
PARAM_ENTRY(CAT_BMS, BMS_TmaxLimit, "°C", -100, 100, 50, 95 ) \
PARAM_ENTRY(CAT_HEATER, Heater, HTTYPE, 0, 2, 0, 57 ) \
PARAM_ENTRY(CAT_HEATER, Heater, HTTYPE, 0, 3, 0, 57 ) \
PARAM_ENTRY(CAT_HEATER, Control, HTCTRL, 0, 2, 0, 58 ) \
PARAM_ENTRY(CAT_HEATER, HeatPwr, "W", 0, 6500, 0, 59 ) \
PARAM_ENTRY(CAT_HEATER, HeatPercnt, "%", 0, 100, 0, 124 ) \
Expand Down Expand Up @@ -165,6 +166,10 @@
VALUE_ENTRY(BMS_Tmin, "°C", 2086 ) \
VALUE_ENTRY(BMS_Tmax, "°C", 2087 ) \
VALUE_ENTRY(BMS_ChargeLim, "A", 2088 ) \
VALUE_ENTRY(BMS_MaxInput, "kW", 2105 ) \
VALUE_ENTRY(BMS_MaxOutput, "kW", 2106 ) \
VALUE_ENTRY(BMS_MaxCharge, "W", 2101 ) \
VALUE_ENTRY(BMS_Isolation, "Ohm", 2104 ) \
VALUE_ENTRY(BMS_IsoMeas, "mV", 2099 ) \
VALUE_ENTRY(speed, "rpm", 2016 ) \
VALUE_ENTRY(Veh_Speed, "kph", 2017 ) \
Expand Down Expand Up @@ -257,7 +262,7 @@
#define INVMODES "0=None, 1=Leaf_Gen1, 2=GS450H, 3=UserCAN, 4=OpenI, 5=Prius_Gen3, 6=Outlander, 7=GS300H, 8=RearOutlander"
#define PLTMODES "0=Absent, 1=ACStd, 2=ACchg, 3=Error, 4=CCS_Not_Rdy, 5=CCS_Rdy, 6=Static"
#define VEHMODES "0=BMW_E46, 1=BMW_E6x+, 2=Classic, 3=None, 5=BMW_E39, 6=VAG, 7=Subaru, 8=BMW_E31"
#define BMSMODES "0=Off, 1=SimpBMS, 2=TiDaisychainSingle, 3=TiDaisychainDual, 4=LeafBms"
#define BMSMODES "0=Off, 1=SimpBMS, 2=TiDaisychainSingle, 3=TiDaisychainDual, 4=LeafBms, 5=RenaultKangoo33"
#define OPMODES "0=Off, 1=Run, 2=Precharge, 3=PchFail, 4=Charge"
#define DOW "0=Sun, 1=Mon, 2=Tue, 3=Wed, 4=Thu, 5=Fri, 6=Sat"
#define CHGTYPS "0=Off, 1=AC, 2=DCFC"
Expand All @@ -274,7 +279,7 @@
#define ERRLIGHTS "0=Off, 4=EPC, 8=engine"
#define CRUISESTATES "0=None, 1=On, 2=Disable, 4=Set, 8=Resume"
#define CDMSTAT "1=Charging, 2=Malfunction, 4=ConnLock, 8=BatIncomp, 16=SystemMalfunction, 32=Stop"
#define HTTYPE "0=None, 1=Ampera, 2=VW"
#define HTTYPE "0=None, 1=Ampera, 2=VW, 3=OutlanderCan"
#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"
Expand Down Expand Up @@ -382,7 +387,8 @@ enum HeatType
{
Noheater = 0,
AmpHeater = 1,
VW = 2
VW = 2,
OutlanderHeater = 3
};

enum BMSModes
Expand All @@ -391,7 +397,8 @@ enum BMSModes
BMSModeSimpBMS = 1,
BMSModeDaisychainSingleBMS = 2,
BMSModeDaisychainDualBMS = 3,
BMSModeLeafBMS = 4
BMSModeLeafBMS = 4,
BMSRenaultKangoo33BMS = 5
};

enum DCDCModes
Expand Down
4 changes: 3 additions & 1 deletion include/stm32_vcu.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/*
/*
* This file is part of the stm32-vcu project.
*
Expand Down Expand Up @@ -96,6 +95,9 @@
#include "rearoutlanderinverter.h"
#include "NoVehicle.h"
#include "V_Classic.h"
#include "kangoobms.h"
#include "OutlanderCanHeater.h"
#include "OutlanderHeartBeat.h"

#define PRECHARGE_TIMEOUT 5 //5s

Expand Down
19 changes: 2 additions & 17 deletions include/utils.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
#ifndef UTILS_H
#define UTILS_H


#include "my_fp.h"
#include "my_math.h"
#include "errormessage.h"
#include "params.h"
#include "digio.h"
#include <libopencm3/stm32/rtc.h>
#include "canhardware.h"
#include "anain.h"
#include "throttle.h"
#include "isa_shunt.h"
#include "bmw_sbox.h"
#include "vag_sbox.h"
#include "vehicle.h"
#include "shifter.h"
#include <libopencm3/stm32/timer.h>
#include "iomatrix.h"
#include "hwinit.h"

#include "canhardware.h"
#include "errormessage.h"

namespace utils
{
Expand Down
Loading

0 comments on commit 6408be7

Please sign in to comment.