Fixing load output and improved overvoltage config

Previous load output expected the battery port as a parameter and checked if
discharging of the battery was allowed. New implementation has own load port
and needs to check if current output (i.e. positive direction) is allowed.

Overvoltage setting is now configured via power port sink_voltage_max.
This commit is contained in:
Martin Jaeger
2019-10-23 13:16:04 +02:00
parent 42751c83c2
commit ba10a2882c
6 changed files with 43 additions and 28 deletions
+2 -1
View File
@@ -119,6 +119,7 @@ int main()
charger.detect_num_batteries(&bat_conf); // check if we have 24V instead of 12V system
battery_init_dc_bus(&bat_terminal, &bat_conf, charger.num_batteries);
load_terminal.init_load(bat_conf.voltage_absolute_max * charger.num_batteries);
wait(2); // safety feature: be able to re-flash before starting
control_timer_start(CONTROL_FREQUENCY);
@@ -194,7 +195,7 @@ void system_control()
leds_set_charging(half_bridge_enabled());
#endif
load.control(bat_conf.voltage_absolute_max * charger.num_batteries);
load.control();
if (counter % CONTROL_FREQUENCY == 0) {
// called once per second (this timer is much more accurate than time(NULL) based on LSI)