Closed nperozzi closed 2 months ago
^ I rebased the changes to fix the merge conflict, and make the diff easier to review
I had to move the led_counter() functions from the state machine layer to the application layer because the LEDs refresh every time any state machine refreshes (5 times per second). This made me think that I should remove all the debugging printf comments to the application layer. @emanuelen5, what do you think?
I still need to pass all the tests.
I still need to pass all the tests.
I can see that the tests fail to compile. It looks like this is due to the library resolver pulling in AVR libraries when compiling the library lib/platform-independent
.
To be honest, I've cheated a bit - the state machine isn't truly platform independent since it's using the UART functions (which use the serial port on the AVR) and the debug LEDs (which use the GPIO on the AVR). But I've worked around this in the following way previously :) :
That will stop the library resolver from pulling in the AVR-files when compiling the platform-independent library.
This is my second shot to the Application library. I don´t think it is looking great but I think I need some feedback to see what is wrong and how to approach it.
How is it structured?
init_application
: initializes all state machines and sets the first one as active.step_application
:current_timer
in allRUNNING
state machines everySECOND_TICK
. If after the increment, the state isRINGING
, then it makes the state machine "active"DOUBLE_PRESS
event to change the active timer to the next timer. This is done here cause one can change to the next timer in any state. (maybe I should have done the same with theLONG_PRESS
since it always resets the timer, no matter what state).step_state
function for the active state machine. This is done for all events except forSECOND_TICK
(since SECOND_TICK is handled before) unless the active state machine is in RUNNING state (sinceSECOND_TICK
event, triggers theprintf
to see thecurrent_time
).I hope this is somewhat understandable. I am looking forward to hearing your comments. 😄