Project

General

Profile

Revision e53aa5c5

IDe53aa5c5396e96788d424ae2362fe7a10e987ddd
Parent 12ea39cc
Child 07718da3

Added by Thomas Mullins over 11 years ago

Made some changes to the tool state machine

View differences:

toolbox/main.c
60 60
      break;
61 61

  
62 62
    case TS_REQ_DIS:
63
      // TODO blink yellow for 10 seconds or something
64
      set_coil(MB_COIL_EN, 0);
65
      tool_disable();
66
      toolstate = TS_OFF;
63
      if (!get_coil(MB_COIL_EN)) {
64
        tool_disable();
65
        toolstate = TS_OFF;
66
      } else if (!get_coil(MB_COIL_REQ_DIS)) {
67
        toolstate = TS_ON;
68
      } else {
69
        // TODO blink yellow for 10 seconds or something
70
        set_coil(MB_COIL_EN, 0);
71
        set_coil(MB_COIL_REQ_DIS, 0);
72
        tool_disable();
73
        toolstate = TS_OFF;
74
      }
67 75
      break;
68 76

  
69 77
    case TS_MISSING_ID:
70
      if (rfid_check_serno(current_user)) {
78
      if (!get_coil(MB_COIL_EN)) {
79
        tool_disable();
80
        toolstate = TS_OFF;
81
      } else if (get_coil(MB_COIL_REQ_DIS)) {
82
        toolstate = TS_REQ_DIS;
83
      } else if (rfid_check_serno(current_user)) {
71 84
        toolstate = TS_ON;
72 85
      } else {
73 86
        // TODO blink yellow for 10 seconds or something
......
81 94
      if (!get_coil(MB_COIL_EN)) {
82 95
        tool_disable();
83 96
        toolstate = TS_OFF;
84
      }
85
      if (get_coil(MB_COIL_REQ_DIS)) {
97
      } else if(get_coil(MB_COIL_REQ_DIS)) {
86 98
        toolstate = TS_REQ_DIS;
87
      }
88
      if (!rfid_check_serno(current_user)) {
99
      } else if (!rfid_check_serno(current_user)) {
89 100
        toolstate = TS_MISSING_ID;
90 101
      }
91 102
      break;

Also available in: Unified diff