ADS1115: skip negative values.

This commit is contained in:
Thomas Klaehn 2019-07-29 10:18:14 +01:00
parent eadddf7334
commit 8837368a14

View File

@ -94,6 +94,9 @@ int ads1115_read_conversation_result(const struct ads1115_dev *ads1115,
return res; return res;
} }
result->raw = buffer[0] << 8 | buffer[1]; result->raw = buffer[0] << 8 | buffer[1];
if(result->raw & 0x8000) {
result->raw = 0;
}
result->voltage = result->raw * VPS; result->voltage = result->raw * VPS;
return 0; return 0;