From 34688156142634c8b786557a7575c754d65c7f46 Mon Sep 17 00:00:00 2001 From: vg Date: Fri, 1 Jul 2022 22:54:25 +0200 Subject: write reflections about powerswitch management for 2 computers --- two_hosts_auto_powerswitch/readme.rst | 41 +++++++++++++++++++++ two_hosts_auto_powerswitch/readme_flowchart.asciio | Bin 0 -> 26794 bytes 2 files changed, 41 insertions(+) create mode 100644 two_hosts_auto_powerswitch/readme_flowchart.asciio diff --git a/two_hosts_auto_powerswitch/readme.rst b/two_hosts_auto_powerswitch/readme.rst index 7eac7fe..2a4617d 100644 --- a/two_hosts_auto_powerswitch/readme.rst +++ b/two_hosts_auto_powerswitch/readme.rst @@ -122,3 +122,44 @@ in another location, one does not need the associated devices to be on). In my case, the wake-on-lan was an exception to the normal usage of my computer, so I made the skip choice to be in the workflow. + +State machines +============== + +- debouncing buttons state tables:: + + #0 button released [pin change interrupt] -> debounce start [timeout] + -> timeout [button pressed] -> #1 + event button_down + -> timeout [button released] -> #0 + + #1 button pressed [timeout] -> first up [timeout] -> debounce [timeout] + -> timeout [button pressed] -> #1 + -> timeout [button released] -> #0 + event button_up + +Ex of a transition table: +State Event Next state Transition function +stopped play_event playing do_play +playing stop_event stopped do_stop +playing pause_event paused do_pause +paused play_event playing do_resume +paused stop_event stopped do_stop + +ex of fsm implem for another language: +https://github.com/hyperandroid/Automata + +ex of fsm implem in c: +https://github.com/gitrealname/ofsm + +formal description in yaml ? + +fsm0: + initialstate: state0 + state0: + enter: action_enter + exit: action_exit + events: + - event: ok + nextstate: state1 + - event: ... + state1: + ... diff --git a/two_hosts_auto_powerswitch/readme_flowchart.asciio b/two_hosts_auto_powerswitch/readme_flowchart.asciio new file mode 100644 index 0000000..91aa2cc Binary files /dev/null and b/two_hosts_auto_powerswitch/readme_flowchart.asciio differ -- cgit v1.2.3