mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 08:41:37 +08:00
power_monitor: Determine I2C communication errors
This commit is contained in:
@@ -114,7 +114,9 @@ int INA238::init()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
write(INA238_REG_CONFIG, (uint16_t)(INA238_RST_RESET | _range));
|
if (write(INA238_REG_CONFIG, (uint16_t)(INA238_RST_RESET | _range)) != PX4_OK) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t shunt_calibration = static_cast<uint16_t>(INA238_CONST * _current_lsb * _rshunt);
|
uint16_t shunt_calibration = static_cast<uint16_t>(INA238_CONST * _current_lsb * _rshunt);
|
||||||
|
|
||||||
@@ -127,7 +129,9 @@ int INA238::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the CONFIG for max I
|
// Set the CONFIG for max I
|
||||||
write(INA238_REG_CONFIG, (uint16_t) _range);
|
if (write(INA238_REG_CONFIG, (uint16_t) _range) != PX4_OK) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// Start ADC continous mode here
|
// Start ADC continous mode here
|
||||||
ret = write(INA238_REG_ADCCONFIG, (uint16_t)INA238_ADCCONFIG);
|
ret = write(INA238_REG_ADCCONFIG, (uint16_t)INA238_ADCCONFIG);
|
||||||
|
|||||||
Reference in New Issue
Block a user