Added new classes and menu item for BMW i3

This commit is contained in:
Jan Matik
2020-12-20 12:44:20 +01:00
parent 4532105adb
commit b7c93fe472
5 changed files with 124 additions and 2 deletions

104
CarBmwI3.cpp Normal file
View File

@@ -0,0 +1,104 @@
#include "CarBmwI3.h"
#include <vector>
/**
activateliveData->commandQueue
*/
void CarBmwI3::activateCommandQueue() {
const uint16_t commandQueueLoopFrom = 8;
const std::vector<String> commandQueue = {
"AT Z", // Reset all
"AT D", // All to defaults
"AT I", // Print the version ID
"AT E0", // Echo off
"AT PP2COFF", // Disable prog parameter 2C
//"AT SH6F1", // Set header to 6F1
"AT CF600", // Set the ID filter to 600
"AT CM700", // Set the ID mask to 700
"AT PBC001", // Protocol B options and baudrate (div 1 = 500k)
"AT SPB", // Set protocol to B and save it (USER1 11bit, 125kbaud)
"AT AT0", // Adaptive timing off
"AT STFF", // Set timeout to ff x 4ms
"AT AL", // Allow long messages ( > 7 Bytes)
"AT H1", // Additional headers on
"AT S0", // Printing of spaces off
"AT L0", // Linefeeds off
"AT CSM0", // Silent monitoring off
"AT CTM5", // Set timer multiplier to 5
"AT JE", // Use J1939 SAE data format
// Loop from (BMW i3)
// BMS
"ATSH6F1",
"22DDBC" /*, // SOC
// VMCU
"ATSH7E2",
"2101",
// speed, ...
"2102",
// aux, ...
//"ATSH7Df",
//"2106",
//"220106",
// Aircondition
// IONIQ OK
"ATSH7B3",
"220100",
// in/out temp
"220102",
// coolant temp1, 2
// BCM / TPMS
// IONIQ OK
"ATSH7A0",
"22c00b",
// tire pressure/temp
// CLUSTER MODULE
// IONIQ OK
"ATSH7C6",
"22B002",
// odo
*/
};
// 28kWh version
liveData->params.batteryTotalAvailableKWh = 18.8;
liveData->params.batModuleTempCount = 5; //?
// Empty and fill command queue
for(auto item : liveData->commandQueue) {
item = "";
}
for (int i = 0; i < commandQueue.size(); i++) {
liveData->commandQueue[i] = commandQueue[i];
}
liveData->commandQueueLoopFrom = commandQueueLoopFrom;
liveData->commandQueueCount = commandQueue.size();
}
/**
parseRowMerged
*/
void CarBmwI3::parseRowMerged()
{
}
/**
loadTestData
*/
void CarBmwI3::loadTestData()
{
}

13
CarBmwI3.h Normal file
View File

@@ -0,0 +1,13 @@
#pragma once
#include "CarInterface.h"
class CarBmwI3 : public CarInterface {
protected:
public:
void activateCommandQueue() override;
void parseRowMerged() override;
void loadTestData() override;
};

View File

@@ -18,6 +18,7 @@
#define CAR_HYUNDAI_KONA_2020_39 4 #define CAR_HYUNDAI_KONA_2020_39 4
#define CAR_RENAULT_ZOE 5 #define CAR_RENAULT_ZOE 5
#define CAR_KIA_NIRO_PHEV 6 #define CAR_KIA_NIRO_PHEV 6
#define CAR_BMW_I3_2014 7
#define CAR_DEBUG_OBD2_KIA 999 #define CAR_DEBUG_OBD2_KIA 999
// //

View File

@@ -59,6 +59,7 @@
#include "CarRenaultZoe.h" #include "CarRenaultZoe.h"
#include "CarKiaNiroPhev.h" #include "CarKiaNiroPhev.h"
#include "CarKiaDebugObd2.h" #include "CarKiaDebugObd2.h"
#include "CarBmwI3.h"
#ifdef SIM800L_ENABLED #ifdef SIM800L_ENABLED
#include <ArduinoJson.h> #include <ArduinoJson.h>
@@ -551,8 +552,10 @@ void setup(void) {
car = new CarHyundaiIoniq(); car = new CarHyundaiIoniq();
} else if (liveData->settings.carType == CAR_KIA_NIRO_PHEV) { } else if (liveData->settings.carType == CAR_KIA_NIRO_PHEV) {
car = new CarKiaNiroPhev(); car = new CarKiaNiroPhev();
} else if (liveData->settings.carType == CAR_RENAULT_ZOE) { } else if(liveData->settings.carType == CAR_RENAULT_ZOE) {
car = new CarRenaultZoe(); car = new CarRenaultZoe();
} else if(liveData->settings.carType == CAR_BMW_I3_2014) {
car = new CarBmwI3();
} else { } else {
// if (liveData->settings.carType == CAR_DEBUG_OBD2_KIA) // if (liveData->settings.carType == CAR_DEBUG_OBD2_KIA)
car = new CarKiaDebugObd2(); car = new CarKiaDebugObd2();

1
menu.h
View File

@@ -22,6 +22,7 @@ MENU_ITEM menuItemsSource[100] = {
{105, 1, -1, "Hyundai Kona 2020 39kWh"}, {105, 1, -1, "Hyundai Kona 2020 39kWh"},
{106, 1, -1, "Renault Zoe 22kWh (DEV)"}, {106, 1, -1, "Renault Zoe 22kWh (DEV)"},
{107, 1, -1, "Kia Niro PHEV 8.9kWh"}, {107, 1, -1, "Kia Niro PHEV 8.9kWh"},
{108, 1, -1, "BMW i3 2014 22kWh (DEV)"},
{120, 1, -1, "Debug OBD2 Kia"}, {120, 1, -1, "Debug OBD2 Kia"},
{300, 3, 0, "<- parent menu"}, {300, 3, 0, "<- parent menu"},