DC/DC: Use high/low DcBus instead of PowerPort for control

This makes more sense because the DC/DC converter actually connects two
DcBuses and does not need separate PowerPorts. Also makes the code look
more clean as variable access like dcdc.hvs->bus->voltage is avoided.

The DcBus pointers in the Dcdc are now called hvb and lvb for high-
voltage side bus and low-voltage side bus.
This commit is contained in:
Martin Jäger
2020-11-05 20:42:34 +01:00
parent 0756341b29
commit b63cdaa06d
9 changed files with 122 additions and 105 deletions
+4 -4
View File
@@ -198,15 +198,15 @@ void daq_update()
#endif
#if DT_NODE_EXISTS(DT_PATH(dcdc))
dcdc_lv_port.current =
dcdc.inductor_current =
adc_scaled(ADC_POS(i_dcdc), vref, ADC_GAIN(i_dcdc), dcdc_current_offset_raw);
lv_terminal_current += dcdc_lv_port.current;
lv_terminal_current += dcdc.inductor_current;
hv_terminal.current = -dcdc_lv_port.current * lv_terminal.bus->voltage /
hv_terminal.current = -dcdc.inductor_current * lv_terminal.bus->voltage /
hv_terminal.bus->voltage;
dcdc_lv_port.power = dcdc_lv_port.bus->voltage * dcdc_lv_port.current;
dcdc.power = dcdc.lvb->voltage * dcdc.inductor_current;
hv_terminal.power = hv_terminal.bus->voltage * hv_terminal.current;
#endif
lv_terminal.current = lv_terminal_current;