Yeah, it would have to be put into its own file. A file that just contains the functionality for pressing the button (not anything relating to the rotation). The button can be described as a state machine, and I think that would make it a lot easier to avoid the sneaky edge conditions :)
But either way, I think we should do this in a follow-up PR. This is definitely good enough for now!
I started a sketch on the state diagram, but it became a mess. I'll have to get back to it. Leaving it here for now:
Yeah, it would have to be put into its own file. A file that just contains the functionality for pressing the button (not anything relating to the rotation). The button can be described as a state machine, and I think that would make it a lot easier to avoid the sneaky edge conditions :)
But either way, I think we should do this in a follow-up PR. This is definitely good enough for now!
I started a sketch on the state diagram, but it became a mess. I'll have to get back to it. Leaving it here for now:
_Originally posted by @emanuelen5 in https://github.com/emanuelen5/kitchen-timer/pull/41#discussion_r1678366517_