added int16_t to current I2CRead

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

@ -110,7 +110,7 @@ struct SensorData read_sensor_data(struct SensorConfig sensor) {
wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CALIBRATION, sensor.calValue);
wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CONFIG, sensor.config);
wiringPiI2CWriteReg16(sensor.fd, INA219_REG_CALIBRATION, sensor.calValue);
data.current = (float)wiringPiI2CReadReg16(sensor.fd, INA219_REG_CURRENT) / (float)sensor.currentDivider;
data.current = (float)((int16_6)wiringPiI2CReadReg16(sensor.fd, INA219_REG_CURRENT)) / (float)sensor.currentDivider;
uint16_t value = (uint16_t)wireReadRegister(sensor.fd, INA219_REG_BUSVOLTAGE);
data.voltage = ((double)(value >> 3) * 4) / 1000;
data.power = (float)wiringPiI2CReadReg16(sensor.fd, INA219_REG_POWER) * (float)sensor.powerMultiplier;

Loading…
Cancel
Save

Powered by TurnKey Linux.