It would be a lot nicer to have an interface with a tick like method that would let us break these down into their own classes.
As a start we could have:
DisplayController - responsible for turning display on/off when the machine sleeps
StopOnWeightController - responsible for stopping extraction when we reach a certain weight
SleepController - responsible for initiating sleep after a certain time
APController - responsible for turning our WIFI AP on or off based on our current screen / state
RebootController - responsible for rebooting the device (currently unused but maybe useful in some situations)
Currently "control" of everything is done in a series of if/then blocks in
loop()
: https://github.com/nicpottier/gnat/blob/main/src/main.cpp#L434It would be a lot nicer to have an interface with a tick like method that would let us break these down into their own classes.
As a start we could have:
DisplayController
- responsible for turning display on/off when the machine sleepsStopOnWeightController
- responsible for stopping extraction when we reach a certain weightSleepController
- responsible for initiating sleep after a certain timeAPController
- responsible for turning our WIFI AP on or off based on our current screen / stateRebootController
- responsible for rebooting the device (currently unused but maybe useful in some situations)