123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include <Arduino.h>
-
- #include "config.h"
- #include "config_pins.h"
- #include "common.h"
- #include "lcd.h"
- #include "steppers.h"
- #include "statemachine.h"
-
- enum states {
- sm_init,
- sm_ask_homing,
- sm_do_homing,
- sm_menu
- };
-
- static states state = sm_init;
-
- static void switch_state(states s) {
- state = s;
-
- if (state == sm_ask_homing) {
- lcd.clear();
- lcd.print(F(" Homing Required!"));
- lcd.setCursor(0, 2);
- lcd.print(F(" Click to home XYZE"));
- } else if (state == sm_do_homing) {
-
- } else if (state == sm_menu) {
-
- }
- }
-
- void statemachine_run(int click, int encoder, int kill) {
- if (state == sm_init) {
- if (click) {
- switch_state(sm_ask_homing);
- }
- } else if (state == sm_ask_homing) {
- if (click) {
- switch_state(sm_do_homing);
- }
- } else if (state == sm_do_homing) {
-
- } else if (state == sm_menu) {
-
- }
- }
-
- void statemachine_motors_done(void) {
- if (state == sm_do_homing) {
- if (steppers_homed()) {
- async_beep(100, 2000);
- switch_state(sm_menu);
- }
- }
- }
|