pull/18/head
alanbjohnston 7 years ago committed by GitHub
parent 751da0655e
commit af3c96f3c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -122,7 +122,7 @@ struct SensorData read_sensor_data(struct SensorConfig sensor) {
delay(1); // Max 12-bit conversion time is 586us per sample
int value1 = wiringPiI2CRead(sensor.fd);
int value2 = wiringPiI2CRead(sensor.fd);
int16_t valuex = (int16_t)(value1 << 8 ) | value2);
int16_t valuex = (int16_t)((value1 << 8) | value2);
// uint16_t valuex = (uint16_t)wireReadRegister(sensor.fd, INA219_REG_CURRENT);
data.current = (double)valuex / (double)sensor.currentDivider;

Loading…
Cancel
Save

Powered by TurnKey Linux.