Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature update sept24 - corrections #108

Merged
merged 5 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/bms.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#ifndef BMS_H
#define BMS_H
#include <stdint.h>
#include "canhardware.h"
#include "params.h"

/* This is an interface for a BMS to provide minimal data required
* for safe battery charging. The BMS must be able to provide the
Expand Down
4 changes: 2 additions & 2 deletions include/iomatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class IOMatrix
{
NONE, CHADEMOALLOW, OBCENABLE, HEATERENABLE, RUNINDICATION, WARNINDICATION,
COOLANTPUMP, NEGCONTACTOR, BRAKELIGHT, REVERSELIGHT, HEATREQ, HVREQ,
DCFCREQUEST, BRAKEVACPUMP, PWM_TIM3,CP_SPOOF,
LAST
DCFCREQUEST, BRAKEVACPUMP, COOLINGFAN, HVACTIVE, PWM_TIM3,CP_SPOOF,
GS450HOIL, LAST
};
//order of these matters!
enum analoguepinfuncs
Expand Down
44 changes: 24 additions & 20 deletions include/leafbms.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,33 @@
*/
#ifndef LEAFBMS_H
#define LEAFBMS_H
#include <stdint.h>
#include "bms.h"

class LeafBMS
class LeafBMS: public BMS
{
public:
static void DecodeCAN(int id, uint32_t data[2], uint32_t time);
static void RequestNextFrame();
static uint16_t GetCellVoltage(int idx);
static int GetCellStatus(int idx);
static void Send10msMessages();
static void Send100msMessages();
static bool Alive(uint32_t time);
static const int NUMCELLS = 96;
public:
virtual void SetCanInterface(CanHardware* can);
void DecodeCAN(int id, uint8_t * data);
static void RequestNextFrame(CanHardware* can);
static uint16_t GetCellVoltage(int idx);
static int GetCellStatus(int idx);
static const int NUMCELLS = 96;
static float Voltage;
static float Voltage2;
static int32_t Temperature;
static int32_t Amperes; // Floating point with current in Amperes
static int32_t SOC;
static int32_t KW;
static int32_t KWh;


private:
static uint8_t Crc8ForHCM(int n, uint8_t *msg);
static int bmsGrp;
static int bmsGrpIndex;
static uint8_t voltBytes[NUMCELLS * 2];
static uint8_t statusBits[NUMCELLS / 4];

private:
static uint8_t Crc8ForHCM(int n, uint8_t *msg);
static int bmsGrp;
static int bmsGrpIndex;
static uint8_t voltBytes[NUMCELLS * 2];
static uint8_t statusBits[NUMCELLS / 4];
static uint8_t run10ms;
static uint8_t run100ms;
static uint32_t lastRecv;
};

#endif // LEAFBMS_H
5 changes: 3 additions & 2 deletions include/param_prj.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* 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.TJ
#define VER 2.20.TK


/* Entries must be ordered as follows:
Expand Down Expand Up @@ -161,6 +161,7 @@
VALUE_ENTRY(SOC, "%", 2015 ) \
VALUE_ENTRY(BMS_Vmin, "V", 2084 ) \
VALUE_ENTRY(BMS_Vmax, "V", 2085 ) \
VALUE_ENTRY(BMS_Tavg, "°C", 2103 ) \
VALUE_ENTRY(BMS_Tmin, "°C", 2086 ) \
VALUE_ENTRY(BMS_Tmax, "°C", 2087 ) \
VALUE_ENTRY(BMS_ChargeLim, "A", 2088 ) \
Expand Down Expand Up @@ -232,7 +233,7 @@
VALUE_ENTRY(powerheater, "W", 2098 ) \
VALUE_ENTRY(VehLockSt, ONOFF, 2100 ) \

//Next value Id: 2102
//Next value Id: 2104

//Dead params
/*
Expand Down
3 changes: 2 additions & 1 deletion include/stm32_vcu.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
/*
* This file is part of the stm32-vcu project.
*
Expand Down Expand Up @@ -80,7 +81,7 @@
#include "TeslaDCDC.h"
#include "BMW_E31.h"
#include "shifter.h"
#include "DigiPot.h"
#include "digipot.h"
#include "F30_Lever.h"
#include "E65_Lever.h"
#include "JLR_G1.h"
Expand Down
6 changes: 1 addition & 5 deletions include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@

namespace utils
{
inline int32_t change(int32_t x, int32_t in_min, int32_t in_max, int32_t out_min, int32_t out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

int32_t change(int32_t x, int32_t in_min, int32_t in_max, int32_t out_min, int32_t out_max);
float GetUserThrottleCommand(CanHardware*);
float ProcessThrottle(int);
float ProcessUdc(int);
Expand Down
6 changes: 0 additions & 6 deletions src/BMW_E65.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,3 @@ void BMW_E65::Engine_Data()

}


bool BMW_E65::GetGear(Vehicle::gear& outGear __attribute__((unused)))
{
return false;
}

Loading
Loading