Separate load and USB out, improve state handling

Identified issues:
- The load output and USB charging port shared the same state machine,
  which did not allow to set different switch-off thresholds.
- Load error codes were global, so it was not possible to have multiple
  load instances.

This commit introduces load-specific error_flags, makes the LoadOutput
class inherit from PowerPort (to improve code readability), separates
the load driver better from higher level implementation and adds a
second LoadOutput object for the USB charging port.
This commit is contained in:
Martin Jäger
2020-02-21 18:27:36 +01:00
parent 3c0bc41164
commit fa9d15e796
18 changed files with 341 additions and 474 deletions
+2 -2
View File
@@ -47,8 +47,8 @@ PwmSwitch pwm_switch(&lv_bus);
#endif
#if CONFIG_HAS_LOAD_OUTPUT
PowerPort load_terminal(&lv_bus); // load terminal (also connected to lv_bus)
LoadOutput load(&load_terminal);
LoadOutput load(&lv_bus, &load_out_set, &load_out_init);
LoadOutput usb_pwr(&lv_bus, &usb_out_set, &usb_out_init);
#endif
#if CONFIG_HV_TERMINAL_SOLAR