From cc4aedb5ccd849b51558cbea432dc289206dcec3 Mon Sep 17 00:00:00 2001 From: Markus Blaschke Date: Tue, 17 Aug 2021 20:00:40 +0200 Subject: [PATCH] fix cpm value Signed-off-by: Markus Blaschke --- serial.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serial.go b/serial.go index 51d2d52..d71a6ac 100644 --- a/serial.go +++ b/serial.go @@ -115,7 +115,7 @@ func (d *GqGmcDevice) GetCpm() (cpm *float64) { } if buf, err := d.read(2); err == nil { - if len(buf) == 1 { + if len(buf) == 2 { val := float64(binary.BigEndian.Uint16(buf)) cpm = &val }