vw/eudataact: fall back to battery care mode field for target SoC (#32242)
This commit is contained in:
parent
614c91080b
commit
19ed27fa54
3 changed files with 14 additions and 2 deletions
|
|
@ -237,6 +237,17 @@ func TestSocBatteryStateReportOnlyFallbackField(t *testing.T) {
|
|||
assert.Equal(t, 40.0, soc)
|
||||
}
|
||||
|
||||
// TestGetLimitSocBcamThreshold reproduces issue #32241: the Audi Q4 e-tron
|
||||
// reports its battery care mode SoC limit only under the battery care mode
|
||||
// field, not under the generic target soc field.
|
||||
func TestGetLimitSocBcamThreshold(t *testing.T) {
|
||||
data := []point{{Name: FieldChargeBcamThreshold, Value: "80"}}
|
||||
|
||||
limit, err := testProvider(data).GetLimitSoc()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, int64(80), limit)
|
||||
}
|
||||
|
||||
// TestPoints guards that a data point with a generic field name ("value") is
|
||||
// stored once yet found by both its unique key and its name.
|
||||
func TestPoints(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ func (v *Provider) GetLimitSoc() (int64, error) {
|
|||
return 0, err
|
||||
}
|
||||
|
||||
if p := lookup(data, FieldTargetSoc); p != nil {
|
||||
if p := lookup(data, FieldTargetSoc, FieldChargeBcamThreshold); p != nil {
|
||||
f, err := strconv.ParseFloat(p.Value, 64)
|
||||
return int64(f), err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,8 @@ const (
|
|||
FieldHvBatteryLevelValue = "battery_level_HV.value"
|
||||
|
||||
// target soc
|
||||
FieldTargetSoc = "settings.target_soc"
|
||||
FieldTargetSoc = "settings.target_soc"
|
||||
FieldChargeBcamThreshold = "battery_care_mode.charge_bcam_threshold" // Audi Q4 e-tron battery care mode target soc
|
||||
|
||||
// range
|
||||
FieldRangeCombined = "cruising_range_combined"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue