WIP Digital PM Support

This commit is contained in:
David Sidrane
2019-05-31 12:03:57 -07:00
committed by Daniel Agar
parent 1cf4a2d953
commit 6fcc4cc6a2
3 changed files with 17 additions and 7 deletions

View File

@@ -404,7 +404,7 @@ Sensors::adc_poll()
* Selection is done in HW ala a LTC4417 or similar, or may be hard coded
* Like in the FMUv4
*/
#if !defined(BOARD_NUMBER_DIGITAL_BRICKS)
/* The ADC channels that are associated with each brick, in power controller
* priority order highest to lowest, as defined by the board config.
*/
@@ -415,6 +415,8 @@ Sensors::adc_poll()
bat_voltage_v_chan[0] = _parameters.battery_adc_channel;
}
#endif
/* The valid signals (HW dependent) are associated with each brick */
bool valid_chan[BOARD_NUMBER_BRICKS] = BOARD_BRICK_VALID_LIST;
@@ -479,7 +481,7 @@ Sensors::adc_poll()
*/
selected_source = b;
#if BOARD_NUMBER_BRICKS > 1
# if BOARD_NUMBER_BRICKS > 1
/* Move the selected_source to instance 0 */
if (_battery_pub_intance0ndx != selected_source) {
@@ -490,9 +492,11 @@ Sensors::adc_poll()
_battery_pub_intance0ndx = selected_source;
}
#endif /* BOARD_NUMBER_BRICKS > 1 */
# endif /* BOARD_NUMBER_BRICKS > 1 */
}
# if !defined(BOARD_NUMBER_DIGITAL_BRICKS)
// todo:per brick scaling
/* look for specific channels and process the raw voltage to measurement data */
if (bat_voltage_v_chan[b] == buf_adc[i].am_channel) {
@@ -503,6 +507,8 @@ Sensors::adc_poll()
bat_current_a[b] = ((buf_adc[i].am_data * _parameters.battery_current_scaling)
- _parameters.battery_current_offset) * _parameters.battery_a_per_v;
}
# endif /* !defined(BOARD_NUMBER_DIGITAL_BRICKS) */
}
#endif /* BOARD_NUMBER_BRICKS > 0 */