Refactoring of load control and state machine

- State machine and control merged to one function
- Load states marked as deprecated, global error flags used instead
- Reduced duplicated code and made load control function easier to read
This commit is contained in:
Martin Jaeger
2019-11-11 09:35:26 +01:00
parent d1ff837c5e
commit f254c77ab6
13 changed files with 452 additions and 514 deletions
+1 -3
View File
@@ -163,8 +163,6 @@ int main()
bat_terminal.pass_voltage_targets(&pwm_port_int);
#endif
load.state_machine();
// update regularly to cover changed battery configurations
adc_set_lv_alerts(bat_conf.voltage_absolute_max * charger.num_batteries,
bat_conf.voltage_absolute_min * charger.num_batteries);
@@ -172,7 +170,7 @@ int main()
eeprom_update();
leds_update_1s();
leds_update_soc(charger.soc, load.state == LOAD_STATE_OFF_LOW_SOC);
leds_update_soc(charger.soc, dev_stat.has_error(ERR_LOAD_LOW_SOC));
uext.process_1s();
ts_interfaces.process_1s();