...
prv_ack_handler(): acks center console during startup
prv_..._tx(): transmits data about …
prv_periodic_tx(): periodically calls all ...tx() functions
can_handler_init(): starts the periodic tx
Addendum: also sends state_of_charge
Bps_heartbeat
prv_handle_ack(): checks the ack from heartbeats are ok
prv_heartbeat_tx(): periodically transmits BPS heartbeat
bps_heartbeat_init(): starts the periodic heartbeat
...
Needs afe storage for temps
prv_calc_speed(): offset linear fan curve calculation based on aggregate temps
prv_fan_stuck_cb(): broadcasts if the fans get stuck
prv_periodic_set_speed(): periodically calcs speed and sets it with the fan controller driver
fan_control_init(): starts periodic set speed
when using the ADT7470 driver, in the interrupt handler for SMBAlert, grab status from both fan controllers and set state in FanStorage.
Need to update design to reflect that state should be stored per fan, not all together. This should help diagnosing which fan isn’t working.
Relay_control_fsm
State machine is:
Open
Close ground
Close hv
Closed
Must check relay state after each close and open, BPS fault if relays didn’t follow instructions
Wait 100 ms to check relay state, wait 200 ms between closing gnd and closing hv
prv_open(): opens gnd then hv, can do them both nearly the same time without checking state in between, but check state afterwards
relay_control_init(): inits pins
relay_process_event(): opens relays upon relay open event, advances state machine after checks
Note: relay sense pins are hidden behind a GPIO expander and will have to be queried through I2C
Should register interrupt to tell when relay states change and read latest status
Killswitch
Killswitch is basically just a debounced GPIO pin
prv_killswitch_cb(): BPS fault
killswitch_init(): inits pins. Hidden behind gpio expander, will have to go through that driver.
...
Also holds DebounceStorage, required for killswitch.
IMPORTANT: Also holds state_of_charge as a uint32_t or something from raspi
Drivers
ADT7470
fan controller, exposes init() and update_speed(). The ‘stuck’ interrupt is in a GPIO pin, can be registered by the module.
...