nicpottier / gnat

Decent DE1 mini heads up display. GNAT is Not A Tablet
MIT License
6 stars 3 forks source link

Abstract controllers into an interface, configure upon setup #8

Open nicpottier opened 2 years ago

nicpottier commented 2 years ago

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#L434

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)