.. include:: Firmware: Dedicated Thread For "Operator Button" Event ====================================================== .. image:: fsm-operator-button-thread.svg :scale: 80% Plan ---- * Move "operator button" IRQ handling to ``main()`` - much like we :doc:`moved "sensor burning <../os-sensor-burning-thread/index>` * ``FSM`` relieved from "operator button" IRQ artifacts completely * *Public* method ``FSM::operator_button_pressed()`` * Dedicated semaphore and thread in ``main()`` * FSM completely passive: no IRQ, no timer, no nothing * Anybody can call ``timer_tick()``, ``sensor_burning()``, ``operator_button_pressed()`` * |longrightarrow| **YAY UNIT TESTING!!!** ``main()``: "Operator Button" Thread ------------------------------------ .. literalinclude:: code/main.cpp :caption: :download:`code/main.cpp` :language: c++ FSM: As Small As Possible ------------------------- .. literalinclude:: code/fsm.h :caption: :download:`code/fsm.h` :language: c++ .. literalinclude:: code/fsm.cpp :caption: :download:`code/fsm.cpp` :language: c++