|
|
|
@ -410,13 +410,15 @@ int get_tlm(int tlm[][5]) {
|
|
|
|
// read i2c current sensors //
|
|
|
|
// read i2c current sensors //
|
|
|
|
// code added back from master
|
|
|
|
// code added back from master
|
|
|
|
double x_current, y_current, z_current;
|
|
|
|
double x_current, y_current, z_current;
|
|
|
|
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
|
|
|
|
double x_voltage, x_power, y_voltage, y_power, z_voltage, z_power;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
if (x_fd != -1) {
|
|
|
|
if (x_fd != -1) {
|
|
|
|
wiringPiI2CWriteReg16(x_fd, INA219_REG_CALIBRATION, x_calValue_x);
|
|
|
|
wiringPiI2CWriteReg16(x_fd, INA219_REG_CALIBRATION, x_calValue_x);
|
|
|
|
wiringPiI2CWriteReg16(x_fd, INA219_REG_CONFIG, x_config);
|
|
|
|
wiringPiI2CWriteReg16(x_fd, INA219_REG_CONFIG, x_config);
|
|
|
|
wiringPiI2CWriteReg16(x_fd, INA219_REG_CALIBRATION, x_calValue_x);
|
|
|
|
wiringPiI2CWriteReg16(x_fd, INA219_REG_CALIBRATION, x_calValue_x);
|
|
|
|
x_current = wiringPiI2CReadReg16(x_fd, INA219_REG_CURRENT) / x_currentDivider;
|
|
|
|
x_current = wiringPiI2CReadReg16(x_fd, INA219_REG_CURRENT) / x_currentDivider;
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
double x_voltage, x_power;
|
|
|
|
|
|
|
|
x_voltage = wiringPiI2CReadReg16(x_fd, INA219_REG_BUSVOLTAGE) / 1000;
|
|
|
|
x_voltage = wiringPiI2CReadReg16(x_fd, INA219_REG_BUSVOLTAGE) / 1000;
|
|
|
|
x_power = wiringPiI2CReadReg16(x_fd, INA219_REG_POWER) * x_powerMultiplier;
|
|
|
|
x_power = wiringPiI2CReadReg16(x_fd, INA219_REG_POWER) * x_powerMultiplier;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
@ -425,7 +427,6 @@ int get_tlm(int tlm[][5]) {
|
|
|
|
wiringPiI2CWriteReg16(y_fd, INA219_REG_CALIBRATION, x_calValue_x);
|
|
|
|
wiringPiI2CWriteReg16(y_fd, INA219_REG_CALIBRATION, x_calValue_x);
|
|
|
|
y_current = wiringPiI2CReadReg16(y_fd, INA219_REG_CURRENT) / x_currentDivider;
|
|
|
|
y_current = wiringPiI2CReadReg16(y_fd, INA219_REG_CURRENT) / x_currentDivider;
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
double y_voltage, y_power;
|
|
|
|
|
|
|
|
y_voltage = wiringPiI2CReadReg16(y_fd, INA219_REG_BUSVOLTAGE) / 1000;
|
|
|
|
y_voltage = wiringPiI2CReadReg16(y_fd, INA219_REG_BUSVOLTAGE) / 1000;
|
|
|
|
y_power = wiringPiI2CReadReg16(y_fd, INA219_REG_POWER) * x_powerMultiplier;
|
|
|
|
y_power = wiringPiI2CReadReg16(y_fd, INA219_REG_POWER) * x_powerMultiplier;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
@ -434,7 +435,6 @@ int get_tlm(int tlm[][5]) {
|
|
|
|
wiringPiI2CWriteReg16(z_fd, INA219_REG_CALIBRATION, x_calValue_x);
|
|
|
|
wiringPiI2CWriteReg16(z_fd, INA219_REG_CALIBRATION, x_calValue_x);
|
|
|
|
z_current = wiringPiI2CReadReg16(z_fd, INA219_REG_CURRENT) / x_currentDivider;
|
|
|
|
z_current = wiringPiI2CReadReg16(z_fd, INA219_REG_CURRENT) / x_currentDivider;
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
double z_voltage, z_power;
|
|
|
|
|
|
|
|
z_voltage = wiringPiI2CReadReg16(z_fd, INA219_REG_BUSVOLTAGE) / 1000;
|
|
|
|
z_voltage = wiringPiI2CReadReg16(z_fd, INA219_REG_BUSVOLTAGE) / 1000;
|
|
|
|
z_power = wiringPiI2CReadReg16(z_fd, INA219_REG_POWER) * x_powerMultiplier;
|
|
|
|
z_power = wiringPiI2CReadReg16(z_fd, INA219_REG_POWER) * x_powerMultiplier;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|