Skip to content

Commit 363fdbe

Browse files
authored
Merge pull request #56 from dalathegreat/user-config-rewrite
Rewrite with central user settings file
2 parents 120fa9b + b1ee3ae commit 363fdbe

21 files changed

Lines changed: 76 additions & 136 deletions

Software/BMW-I3-BATTERY.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ void update_values_i3_battery()
100100
CANstillAlive--;
101101
}
102102

103-
if(printValues)
104-
{ //values heading towards the inverter
103+
#ifdef DEBUG_VIA_USB
105104
Serial.print("SOC% battery: ");
106105
Serial.print(Display_SOC);
107106
Serial.print(" SOC% sent to inverter: ");
@@ -114,7 +113,7 @@ void update_values_i3_battery()
114113
Serial.print(max_target_charge_power);
115114
Serial.print(" Max discharge power: ");
116115
Serial.print(max_target_discharge_power);
117-
}
116+
#endif
118117
}
119118

120119
void receive_can_i3_battery(CAN_frame_t rx_frame)

Software/BMW-I3-BATTERY.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
#define BMW_I3_BATTERY_H
33
#include <Arduino.h>
44
#include "ESP32CAN.h"
5+
#include "USER_SETTINGS.h"
56

6-
#define BATTERY_WH_MAX 24000 //Battery size in Wh (Maximum value Fronius accepts is 60000 [60kWh] you can use larger batteries but do set value over 60000
77
#define ABSOLUTE_MAX_VOLTAGE 4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
88
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
9-
#define MAXPERCENTAGE 800 //80.0% , Max percentage the battery will charge to (App will show 100% once this value is reached)
10-
#define MINPERCENTAGE 200 //20.0% , Min percentage the battery will discharge to (App will show 0% once this value is reached)
11-
static byte printValues = 1; //Should debug values be printed to serial output?
129

1310
// These parameters need to be mapped for the inverter
1411
extern uint16_t SOC;

Software/BYD-CAN.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define BYD_CAN_H
33
#include <Arduino.h>
44
#include "ESP32CAN.h"
5+
#include "USER_SETTINGS.h"
56

67
extern uint16_t SOC;
78
extern uint16_t StateOfHealth;

Software/CHADEMO-BATTERY.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ void update_values_chademo_battery()
8585
CANstillAlive--;
8686
}
8787

88-
if(printValues)
89-
{ //values heading towards the modbus registers
88+
#ifdef DEBUG_VIA_USB
9089
if(errorCode > 0)
9190
{
9291
Serial.print("ERROR CODE ACTIVE IN SYSTEM. NUMBER: ");
@@ -120,7 +119,7 @@ void update_values_chademo_battery()
120119
Serial.println(temperature_min);
121120
Serial.print("Temperature Max: ");
122121
Serial.println(temperature_max);
123-
}
122+
#endif
124123
}
125124

126125
void receive_can_chademo_battery(CAN_frame_t rx_frame)

Software/CHADEMO-BATTERY.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
#define CHADEMO_BATTERY_H
33
#include <Arduino.h>
44
#include "ESP32CAN.h"
5+
#include "USER_SETTINGS.h"
56

6-
#define BATTERY_WH_MAX 24000 //Battery size in Wh (Maximum value Fronius accepts is 60000 [60kWh] you can use larger batteries but do set value over 60000
77
#define ABSOLUTE_MAX_VOLTAGE 4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
88
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
9-
#define MAXPERCENTAGE 800 //80.0% , Max percentage the battery will charge to (App will show 100% once this value is reached)
10-
#define MINPERCENTAGE 200 //20.0% , Min percentage the battery will discharge to (App will show 0% once this value is reached)
11-
static byte printValues = 0; //Should debug values be printed to serial output?
129

1310
// These parameters need to be mapped
1411
extern uint16_t SOC;

Software/IMIEV-CZERO-ION-BATTERY.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,14 @@ void update_values_imiev_battery()
7373
CANstillAlive--;
7474
}
7575

76-
if(printValues)
77-
{ //values heading towards the modbus registers
76+
#ifdef DEBUG_VIA_USB
7877
Serial.print("BMU SOC: ");
7978
Serial.println(BMU_SOC);
8079
Serial.print("BMU Current: ");
8180
Serial.println(BMU_Current);
8281
Serial.print("BMU Battery Voltage: ");
8382
Serial.println(BMU_PackVoltage);
84-
}
83+
#endif
8584
}
8685

8786
void receive_can_imiev_battery(CAN_frame_t rx_frame)

Software/IMIEV-CZERO-ION-BATTERY.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
#define IMIEV_CZERO_ION_BATTERY_H
33
#include <Arduino.h>
44
#include "ESP32CAN.h"
5+
#include "USER_SETTINGS.h"
56

6-
#define BATTERY_WH_MAX 22000 //Battery size in Wh (Maximum value Fronius accepts is 60000 [60kWh] you can use larger batteries but do set value over 60000
77
#define ABSOLUTE_MAX_VOLTAGE 4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
88
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
9-
#define MAXPERCENTAGE_ZOE 800 //80.0% , Max percentage the battery will charge to (App will show 100% once this value is reached)
10-
#define MINPERCENTAGE_ZOE 200 //20.0% , Min percentage the battery will discharge to (App will show 0% once this value is reached)
11-
static byte printValues = 1; //Should modbus values be printed to serial output?
129

1310
// These parameters need to be mapped for the Gen24
1411
extern uint16_t SOC;

Software/KIA-HYUNDAI-64-BATTERY.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,14 @@ void update_values_kiaHyundai_64_battery()
5151
CANstillAlive--;
5252
}
5353

54-
if(printValues)
55-
{ //values heading towards the inverter
54+
#ifdef DEBUG_VIA_USB
5655
Serial.print("SOC% candidate 1: ");
5756
Serial.println(SOC_1);
5857
Serial.print("SOC% candidate 2: ");
5958
Serial.println(SOC_2);
6059
Serial.print("SOC% candidate 3: ");
6160
Serial.println(SOC_3);
62-
}
61+
#endif
6362
}
6463

6564
void receive_can_kiaHyundai_64_battery(CAN_frame_t rx_frame)

Software/KIA-HYUNDAI-64-BATTERY.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
#define KIA_HYUNDAI_64_BATTERY_H
33
#include <Arduino.h>
44
#include "ESP32CAN.h"
5+
#include "USER_SETTINGS.h"
56

6-
#define BATTERY_WH_MAX 60000 //Battery size in Wh (Maximum value Fronius accepts is 60000 [60kWh] you can use larger batteries but do set value over 60000
77
#define ABSOLUTE_MAX_VOLTAGE 4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
88
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
9-
#define MAXPERCENTAGE 800 //80.0% , Max percentage the battery will charge to (App will show 100% once this value is reached)
10-
#define MINPERCENTAGE 200 //20.0% , Min percentage the battery will discharge to (App will show 0% once this value is reached)
11-
static byte printValues = 1; //Should debug values be printed to serial output?
129

1310
// These parameters need to be mapped for the Gen24
1411
extern uint16_t SOC;

Software/NISSAN-LEAF-BATTERY.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,7 @@ void update_values_leaf_battery()
293293
}
294294

295295
/*Finally print out values to serial if configured to do so*/
296-
if(printValues)
297-
{
296+
#ifdef DEBUG_VIA_USB
298297
if(errorCode > 0)
299298
{
300299
Serial.print("ERROR CODE ACTIVE IN SYSTEM. NUMBER: ");
@@ -350,7 +349,7 @@ void update_values_leaf_battery()
350349
Serial.print(Battery_current_1);
351350
Serial.print(" Current 2: ");
352351
Serial.println(Battery_current_2);
353-
}
352+
#endif
354353
}
355354

356355
void receive_can_leaf_battery(CAN_frame_t rx_frame)

0 commit comments

Comments
 (0)