-
Notifications
You must be signed in to change notification settings - Fork 1
/
Opening.cpp
53 lines (42 loc) · 846 Bytes
/
Opening.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// Opening.cpp
// StateMachine
//
// Created by Andrew III Lyne on 3/19/14.
// Copyright (c) 2014 Andrew III Lyne. All rights reserved.
//
#include "Opening.h"
void Opening::onEntry(){
NOP();
}
void Opening::onReEntry(){
NOP();
}
void Opening::onExit(){
NOP();
}
int Opening::transition(int event_id){
switch( event_id ){
case EVENT_PUSHBUTTON:
return 6;
break;
case EVENT_IR:
std::printf( "No transition for IR beam interrupt event in Opening state.\n");
return -1;
break;
case EVENT_DOOROPEN:
return 3;
break;
case EVENT_DOORCLOSED:
std::printf( "No transition for DoorClosed event in Opening state.\n");
return -1;
break;
case EVENT_MOTOROVERCURRENT:
return 5;
break;
default:
std::printf( "ERROR: no event definition for idle code:%d\n", event_id);
return -1;
}
return -1;
}