diff --git a/yabl/protocol.go b/yabl/protocol.go index 4a41d20..f920796 100644 --- a/yabl/protocol.go +++ b/yabl/protocol.go @@ -116,7 +116,6 @@ func StartProtocolParsing(frames <-chan *can.CanFrame) <-chan *Event { var start uint8 = 0 for _, f := range param.fields { if val, found := get(start, f.length, frame.Payload); found { - start += f.length f.last = now if f.value != val { f.value = val @@ -130,6 +129,7 @@ func StartProtocolParsing(frames <-chan *can.CanFrame) <-chan *Event { } } } + start += f.length } } diff --git a/yabl/setters.go b/yabl/setters.go index 23b358c..7948eae 100644 --- a/yabl/setters.go +++ b/yabl/setters.go @@ -197,11 +197,11 @@ func (c *CpuErrors) setGridVoltageLowErr(val uint64) { } func (c *CpuErrors) setGridVoltageLow(val uint64) { - c.GridVoltageLow = Voltage11BitType(val / 100) + c.GridVoltageLow = Voltage11BitType(val) } func (c *CpuErrors) setGridVoltageHigh(val uint64) { - c.GridVoltageHigh = Voltage11BitType(val / 100) + c.GridVoltageHigh = Voltage11BitType(val) } func (c *CpuErrors) setGridVoltageEmpty(val uint64) {