fix(aardvark-sys): i2c_scan ret > 0 to detect ACK, not >= 0

This commit is contained in:
ehushubhamshaw 2026-03-04 19:38:35 -05:00
parent afbe437f72
commit da091b2ba2

View File

@ -310,7 +310,10 @@ impl AardvarkHandle {
let mut buf = [0u8; 1];
for addr in 0x08u16..=0x77 {
let ret = unsafe { f(self.handle, addr, AA_I2C_NO_FLAGS, 1, buf.as_mut_ptr()) };
if ret >= 0 {
// ret > 0: bytes received → device ACKed
// ret == 0: NACK → no device at this address
// ret < 0: error code → skip
if ret > 0 {
found.push(addr as u8);
}
}