mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 02:09:30 +02:00
add wake up pin for BMW I3 double battery
This commit is contained in:
parent
789d021d22
commit
ca1da7ed13
6 changed files with 54 additions and 8 deletions
|
@ -425,9 +425,15 @@ void update_values_battery2() { //This function maps all the values fetched via
|
|||
|
||||
void update_values_battery() { //This function maps all the values fetched via CAN to the battery datalayer
|
||||
if (datalayer.system.settings.equipment_stop_active == true) {
|
||||
digitalWrite(WUP_PIN, LOW); // Turn off WUP_PIN
|
||||
digitalWrite(WUP_PIN1, LOW); // Turn off WUP_PIN1
|
||||
#if defined(WUP_PIN2) && defined(DOUBLE_BATTERY)
|
||||
digitalWrite(WUP_PIN2, LOW); // Turn off WUP_PIN2
|
||||
#endif // defined(WUP_PIN2) && defined (DOUBLE_BATTERY)
|
||||
} else {
|
||||
digitalWrite(WUP_PIN, HIGH); // Wake up the battery
|
||||
digitalWrite(WUP_PIN1, HIGH); // Wake up the battery
|
||||
#if defined(WUP_PIN2) && defined(DOUBLE_BATTERY)
|
||||
digitalWrite(WUP_PIN2, HIGH); // Wake up the battery2
|
||||
#endif // defined(WUP_PIN2) && defined (DOUBLE_BATTERY)
|
||||
}
|
||||
|
||||
if (!battery_awake) {
|
||||
|
@ -1134,8 +1140,12 @@ void setup_battery(void) { // Performs one time setup at startup
|
|||
datalayer.battery2.status.voltage_dV =
|
||||
0; //Init voltage to 0 to allow contactor check to operate without fear of default values colliding
|
||||
#endif
|
||||
pinMode(WUP_PIN, OUTPUT);
|
||||
digitalWrite(WUP_PIN, HIGH); // Wake up the battery
|
||||
pinMode(WUP_PIN1, OUTPUT);
|
||||
digitalWrite(WUP_PIN1, HIGH); // Wake up the battery
|
||||
#if defined(DOUBLE_BATTERY) && defined(WUP_PIN2)
|
||||
pinMode(WUP_PIN2, OUTPUT);
|
||||
digitalWrite(WUP_PIN2, HIGH); // Wake up the battery
|
||||
#endif // defined(WUP_PIN2) && defined (DOUBLE_BATTERY)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#define BATTERY_SELECTED
|
||||
|
||||
#define WUP_PIN 25
|
||||
#define MAX_CELL_VOLTAGE_60AH 4110 // Battery is put into emergency stop if one cell goes over this value
|
||||
#define MIN_CELL_VOLTAGE_60AH 2700 // Battery is put into emergency stop if one cell goes below this value
|
||||
#define MAX_CELL_VOLTAGE_94AH 4140 // Battery is put into emergency stop if one cell goes over this value
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#define BATTERY_SELECTED
|
||||
|
||||
//#define WUP_PIN 25 //Not used
|
||||
#define MAX_PACK_VOLTAGE_DV 4650 //4650 = 465.0V
|
||||
#define MIN_PACK_VOLTAGE_DV 3000
|
||||
#define MAX_CELL_DEVIATION_MV 250
|
||||
|
|
|
@ -72,6 +72,14 @@
|
|||
// Equipment stop pin
|
||||
#define EQUIPMENT_STOP_PIN 35
|
||||
|
||||
// BMW_I3_BATTERY wake up pin
|
||||
#ifdef BMW_I3_BATTERY
|
||||
#define WUP_PIN1 GPIO_NUM_25 // Wake up pin for battery 1
|
||||
#ifdef DOUBLE_BATTERY
|
||||
#define WUP_PIN2 GPIO_NUM_32 // Wake up pin for battery 2
|
||||
#endif // DOUBLE_BATTERY
|
||||
#endif // BMW_I3_BATTERY
|
||||
|
||||
/* ----- Error checks below, don't change (can't be moved to separate file) ----- */
|
||||
#ifndef HW_CONFIGURED
|
||||
#define HW_CONFIGURED
|
||||
|
@ -98,9 +106,12 @@
|
|||
#endif
|
||||
|
||||
#ifdef BMW_I3_BATTERY
|
||||
#ifdef CONTACTOR_CONTROL
|
||||
#if defined(CONTACTOR_CONTROL) && defined(WUP_PIN1)
|
||||
#error GPIO PIN 25 cannot be used for both BMWi3 Wakeup and contactor control. Disable CONTACTOR_CONTROL
|
||||
#endif
|
||||
#if defined(CONTACTOR_CONTROL) && defined(WUP_PIN2)
|
||||
#error GPIO PIN 32 cannot be used for both BMWi3 Wakeup and contactor control. Disable CONTACTOR_CONTROL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -68,6 +68,14 @@
|
|||
// Equipment stop pin
|
||||
#define EQUIPMENT_STOP_PIN 35
|
||||
|
||||
// BMW_I3_BATTERY wake up pin
|
||||
#ifdef BMW_I3_BATTERY
|
||||
#define WUP_PIN1 GPIO_NUM_25 // Wake up pin for battery 1
|
||||
#ifdef DOUBLE_BATTERY
|
||||
#define WUP_PIN2 GPIO_NUM_32 // Wake up pin for battery 2
|
||||
#endif // DOUBLE_BATTERY
|
||||
#endif // BMW_I3_BATTERY
|
||||
|
||||
/* ----- Error checks below, don't change (can't be moved to separate file) ----- */
|
||||
#ifndef HW_CONFIGURED
|
||||
#define HW_CONFIGURED
|
||||
|
@ -94,9 +102,12 @@
|
|||
#endif
|
||||
|
||||
#ifdef BMW_I3_BATTERY
|
||||
#ifdef CONTACTOR_CONTROL
|
||||
#if defined(CONTACTOR_CONTROL) && defined(WUP_PIN1)
|
||||
#error GPIO PIN 25 cannot be used for both BMWi3 Wakeup and contactor control. Disable CONTACTOR_CONTROL
|
||||
#endif
|
||||
#if defined(CONTACTOR_CONTROL) && defined(WUP_PIN2)
|
||||
#error GPIO PIN 32 cannot be used for both BMWi3 Wakeup and contactor control. Disable CONTACTOR_CONTROL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -61,6 +61,14 @@ GPIOs on extra header
|
|||
// Equipment stop pin
|
||||
#define EQUIPMENT_STOP_PIN 2
|
||||
|
||||
// BMW_I3_BATTERY wake up pin
|
||||
#ifdef BMW_I3_BATTERY
|
||||
#define WUP_PIN1 GPIO_NUM_25 // Wake up pin for battery 1
|
||||
#ifdef DOUBLE_BATTERY
|
||||
#define WUP_PIN2 GPIO_NUM_32 // Wake up pin for battery 2
|
||||
#endif // DOUBLE_BATTERY
|
||||
#endif // BMW_I3_BATTERY
|
||||
|
||||
/* ----- Error checks below, don't change (can't be moved to separate file) ----- */
|
||||
#ifndef HW_CONFIGURED
|
||||
#define HW_CONFIGURED
|
||||
|
@ -68,4 +76,12 @@ GPIOs on extra header
|
|||
#error Multiple HW defined! Please select a single HW
|
||||
#endif
|
||||
|
||||
#ifdef BMW_I3_BATTERY
|
||||
#if defined(CONTACTOR_CONTROL) && defined(WUP_PIN1)
|
||||
#error GPIO PIN 25 cannot be used for both BMWi3 Wakeup and contactor control. Disable CONTACTOR_CONTROL
|
||||
#endif
|
||||
#if defined(CONTACTOR_CONTROL) && defined(WUP_PIN2)
|
||||
#error GPIO PIN 32 cannot be used for both BMWi3 Wakeup and contactor control. Disable CONTACTOR_CONTROL
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue