From ff1bbdf445b7ec650c7e7b0901af1f7fc306de3f Mon Sep 17 00:00:00 2001 From: deadprogram Date: Tue, 29 Oct 2024 01:11:09 +0100 Subject: [PATCH] bugfix: correct casting of return value from adc as it was always overflowing the 8 bit result Signed-off-by: deadprogram --- pcf8591/pcf8591.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pcf8591/pcf8591.go b/pcf8591/pcf8591.go index cd57deeb2..3bb39baaa 100644 --- a/pcf8591/pcf8591.go +++ b/pcf8591/pcf8591.go @@ -76,7 +76,7 @@ func (p ADCPin) Get() uint16 { p.d.bus.Tx(p.d.Address, tx, rx) // scale result to 16bit value like other ADCs - return uint16(rx[1] << 8) + return uint16(rx[1]) << 8 } // Configure here just for interface compatibility.