Ocpp: fix setting measurands
This commit is contained in:
parent
9b9d816a85
commit
1672032143
1 changed files with 2 additions and 2 deletions
|
|
@ -271,8 +271,8 @@ func NewOCPP(id string, connector int, idtag string,
|
|||
// autodetect measurands
|
||||
if meterValues == "" && meterValuesSampledDataMaxLength > 0 {
|
||||
sampledMeasurands := c.tryMeasurands(desiredMeasurands, ocpp.KeyMeterValuesSampledData)
|
||||
if len(sampledMeasurands) > meterValuesSampledDataMaxLength {
|
||||
meterValues = strings.Join(sampledMeasurands[:meterValuesSampledDataMaxLength], ",")
|
||||
if l := len(sampledMeasurands); l > 0 {
|
||||
meterValues = strings.Join(sampledMeasurands[:min(l, meterValuesSampledDataMaxLength)], ",")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue