sensors:Rework battery connected logic

A battery is considered connected when a) V > BOARD_ADC_OPEN_CIRCUIT_V
   and if BOARD_ADC_OPEN_CIRCUIT_V > BOARD_VALID_UV connected
   is further qualifed by the Valid signal.
This commit is contained in:
David Sidrane 2017-09-06 16:35:04 -10:00 committed by Daniel Agar
parent d95e985f59
commit c6eec29dec

View File

@ -545,8 +545,15 @@ Sensors::adc_poll(struct sensor_combined_s &raw)
for (int b = 0; b < BOARD_NUMBER_BRICKS; b++) {
/* Consider the brick connected if there is a voltage */
bool connected = bat_voltage_v[b] > BOARD_ADC_OPEN_CIRCUIT_V;
bool connected = bat_voltage_v[b] > 1.5f;
/* In the case where the BOARD_ADC_OPEN_CIRCUIT_V is
* greater than the BOARD_VALID_UV let the HW qualify that it
* is connected.
*/
if (BOARD_ADC_OPEN_CIRCUIT_V > BOARD_VALID_UV) {
connected &= valid_chan[b];
}
actuator_controls_s ctrl;
orb_copy(ORB_ID(actuator_controls_0), _actuator_ctrl_0_sub, &ctrl);