mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Make sure second Leaf battery starts with voltage_dV=0
This commit is contained in:
parent
e43cc8c266
commit
6fc8e59092
2 changed files with 4 additions and 5 deletions
|
@ -16,12 +16,7 @@ static CanBattery* battery2 = nullptr;
|
||||||
void setup_battery() {
|
void setup_battery() {
|
||||||
// Instantiate the battery only once just in case this function gets called multiple times.
|
// Instantiate the battery only once just in case this function gets called multiple times.
|
||||||
if (battery == nullptr) {
|
if (battery == nullptr) {
|
||||||
#ifdef DOUBLE_BATTERY
|
|
||||||
battery = new SELECTED_BATTERY_CLASS(&datalayer.battery, &datalayer.system.status.battery_allows_contactor_closing,
|
|
||||||
EXTENDED_DATA_PTR, can_config.battery);
|
|
||||||
#else
|
|
||||||
battery = new SELECTED_BATTERY_CLASS();
|
battery = new SELECTED_BATTERY_CLASS();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
battery->setup();
|
battery->setup();
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,18 @@
|
||||||
|
|
||||||
class NissanLeafBattery : public CanBattery {
|
class NissanLeafBattery : public CanBattery {
|
||||||
public:
|
public:
|
||||||
|
// Use this constructor for the second battery.
|
||||||
NissanLeafBattery(DATALAYER_BATTERY_TYPE* datalayer_ptr, bool* allows_contactor_closing_ptr,
|
NissanLeafBattery(DATALAYER_BATTERY_TYPE* datalayer_ptr, bool* allows_contactor_closing_ptr,
|
||||||
DATALAYER_INFO_NISSAN_LEAF* extended, int targetCan) {
|
DATALAYER_INFO_NISSAN_LEAF* extended, int targetCan) {
|
||||||
datalayer_battery = datalayer_ptr;
|
datalayer_battery = datalayer_ptr;
|
||||||
allows_contactor_closing = allows_contactor_closing_ptr;
|
allows_contactor_closing = allows_contactor_closing_ptr;
|
||||||
datalayer_nissan = extended;
|
datalayer_nissan = extended;
|
||||||
can_interface = targetCan;
|
can_interface = targetCan;
|
||||||
|
|
||||||
|
battery_Total_Voltage2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use the default constructor to create the first or single battery.
|
||||||
NissanLeafBattery() {
|
NissanLeafBattery() {
|
||||||
datalayer_battery = &datalayer.battery;
|
datalayer_battery = &datalayer.battery;
|
||||||
allows_contactor_closing = &datalayer.system.status.battery_allows_contactor_closing;
|
allows_contactor_closing = &datalayer.system.status.battery_allows_contactor_closing;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue