ADS1115: skip negative values.
This commit is contained in:
parent
eadddf7334
commit
8837368a14
@ -94,6 +94,9 @@ int ads1115_read_conversation_result(const struct ads1115_dev *ads1115,
|
||||
return res;
|
||||
}
|
||||
result->raw = buffer[0] << 8 | buffer[1];
|
||||
if(result->raw & 0x8000) {
|
||||
result->raw = 0;
|
||||
}
|
||||
result->voltage = result->raw * VPS;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user