fix: remove incorrect !readLast check

Signed-off-by: Navendu Pottekkat <navendu@apache.org>
This commit is contained in:
Navendu Pottekkat
2026-08-13 14:41:53 +05:30
committed by Ron Evans
parent 6136fb7b95
commit dc97300c2e
+1 -3
View File
@@ -242,7 +242,6 @@ func (i2c *I2C) transmit(addr uint16, cmd []i2cCommand, timeoutMS int) error {
timeoutNS := int64(timeoutMS) * 1000000 timeoutNS := int64(timeoutMS) * 1000000
needAddress := true needAddress := true
needRestart := false needRestart := false
readLast := false
var readTo []byte var readTo []byte
for cmdIdx, reg := 0, &i2c.Bus.COMD0; cmdIdx < len(cmd); { for cmdIdx, reg := 0, &i2c.Bus.COMD0; cmdIdx < len(cmd); {
c := &cmd[cmdIdx] c := &cmd[cmdIdx]
@@ -310,7 +309,6 @@ func (i2c *I2C) transmit(addr uint16, cmd []i2cCommand, timeoutMS int) error {
} }
if split { if split {
readLast = true
reg.Set(i2cCMD_READLAST | 1) reg.Set(i2cCMD_READLAST | 1)
reg = nextAddress(reg) reg = nextAddress(reg)
readTo = c.data[c.head : c.head+bytes+1] // read bytes + 1 last byte readTo = c.data[c.head : c.head+bytes+1] // read bytes + 1 last byte
@@ -342,7 +340,7 @@ func (i2c *I2C) transmit(addr uint16, cmd []i2cCommand, timeoutMS int) error {
} }
} }
switch { switch {
case mask&esp.I2C_INT_STATUS_ACK_ERR_INT_ST_Msk != 0 && !readLast: case mask&esp.I2C_INT_STATUS_ACK_ERR_INT_ST_Msk != 0:
return errI2CAckExpected return errI2CAckExpected
case mask&esp.I2C_INT_STATUS_TIME_OUT_INT_ST_Msk != 0: case mask&esp.I2C_INT_STATUS_TIME_OUT_INT_ST_Msk != 0:
// timeout leaves the bus in an undefined state, reset // timeout leaves the bus in an undefined state, reset