Skip to content

Commit d096b72

Browse files
committed
VW e-Up: fix uninitialized variables for charge capacity processing
1 parent dc396e2 commit d096b72

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

vehicle/OVMS.V3/components/vehicle_vweup/src/vehicle_vweup.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <string>
3030
static const char *TAG = "v-vweup";
3131

32-
#define VERSION "0.22.1"
32+
#define VERSION "0.22.2"
3333

3434
#include <stdio.h>
3535
#include <string>
@@ -97,6 +97,18 @@ OvmsVehicleVWeUp::OvmsVehicleVWeUp()
9797

9898
m_use_phase = UP_None;
9999
m_obd_state = OBDS_Init;
100+
101+
m_soc_norm_start = 0;
102+
m_soc_abs_start = 0;
103+
m_energy_recd_start = 0;
104+
m_energy_used_start = 0;
105+
m_energy_charged_start = 0;
106+
m_coulomb_recd_start = 0;
107+
m_coulomb_used_start = 0;
108+
m_coulomb_charged_start = 0;
109+
m_charge_kwh_grid_start = 0;
110+
m_charge_kwh_grid = 0;
111+
100112
m_chargestart_ticker = 0;
101113
m_chargestop_ticker = 0;
102114
m_chargestate_lastsoc = 100;

vehicle/OVMS.V3/components/vehicle_vweup/src/vweup_obd.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,9 @@ void OvmsVehicleVWeUp::UpdateChargeCap(bool charging)
13841384
static int checkpoint = 9999;
13851385
bool log_data = false, update_caps = false, update_soh = false;
13861386

1387+
if (m_soc_abs_start == 0 || m_coulomb_charged_start == 0)
1388+
return;
1389+
13871390
int charge_time = StdMetrics.ms_v_charge_time->AsInt();
13881391
float soc_abs_diff = BatMgmtSoCAbs->AsFloat() - m_soc_abs_start;
13891392
float soc_norm_diff = StdMetrics.ms_v_bat_soc->AsFloat() - m_soc_norm_start;

0 commit comments

Comments
 (0)