newlib requires malloc if printf is used with %f. Since PR 28486, the heap
space in RAM is only reserved if explicitly used by the application
(independent of the value of CONFIG_HEAP_MEM_POOL_SIZE) in order to free
some stack memory. As printf calls malloc internally, this commit forces
Zephyr to build with heap support enabled.
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.
These variables define the voltage at zero current, which is the y axis
intercept of the droop curve (voltage vs. current).
As they do not always specifiy minimum or maximum boundary depending on
the sign of the droop resistance, intercept is a more suitable name.
Previously, the interval was not exactly 1s, which could have a negative
impact on energy calculations.
This commit also moves the 1s interval tasks from control loop to the main
loop to avoid duplicated loops running at 1s interval.
When switching to edge-aligned PWM, the ADC measurement was accidentally
triggered at the beginning of the switching cycle.
Fixing this using TIM1 OC6, triggering at falling edge.
New control states allow to specify the reason for derating more detailed,
also considering the input side.
The operation mode is now also used as a return value for
check_start_conditions function to get rid of magic numbers.
The check for high-side MOSFET shorts and startup inhibit are moved to
separate functions to keep the general control function more clean.
Also declared check_start_conditions weak to allow custom overriding.
Using 16-bit for calculation allows to increase resolution by oversampling.
The ADC was already configured to use left-aligned 12-bit readings, which can
be treated the same as 16-bit native readings.
This increases the resolution of the PWM duty cycle of the DC/DC converter by a
factor of 2, which helps to set the ratio between input and output voltage for
the MPPT algorithm more precisely.
Some restructuring of the half_bridge functions was necessary.
Removes some of the hard-coded configuration in half_bridge.cpp and moves it
to board configuration.
The previous manual pinmux for the PWM output pins is now completely replaced
with Zephyr pinmux.
Depending on the amount of data nodes, calling ?rec caused a stack overflow.
Larger stack memory solves the issue, for further improvement see also #103.
Stops using CONFIG_device_x style configuration items and checks the
devicetree to determine if the nodes are enabled.
Fixes UEXT serial port not working.