File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ void RivianBattery::update_values() {
22
22
datalayer.battery .status .voltage_dV = battery_voltage;
23
23
datalayer.battery .status .current_dA = ((int16_t )battery_current / 10.0 - 3200 ) * 10 ;
24
24
25
- datalayer.battery .info . total_capacity_Wh = kWh_available_total * 5 ;
26
- datalayer.battery .status .remaining_capacity_Wh = kWh_available_max * 5 ;
25
+ datalayer.battery .status . remaining_capacity_Wh = static_cast < uint32_t >(
26
+ ( static_cast < double >( datalayer.battery .status .real_soc ) / 10000 ) * datalayer. battery . info . total_capacity_Wh ) ;
27
27
28
28
// static lower limits for testing
29
29
// datalayer.battery.info.total_capacity_Wh = 10000;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class RivianBattery : public CanBattery {
20
20
uint8_t BMS_state = 0 ;
21
21
uint16_t battery_voltage = 3700 ;
22
22
uint16_t battery_SOC = 5000 ;
23
- int32_t battery_current = 0 ;
23
+ int32_t battery_current = 32000 ;
24
24
uint16_t kWh_available_total = 135 ;
25
25
uint16_t kWh_available_max = 135 ;
26
26
int16_t battery_min_temperature = 0 ;
You can’t perform that action at this time.
0 commit comments