Statistics
| Revision:

root / trunk / code / projects / diagnostic_station / stationCode / UI / main.c @ 1118

History | View | Annotate | Download (2.83 KB)

1
void main_menu(void);
2
void test_menu(void);
3
void BOM_menu(void);
4
void rangefinder_menu(void);
5
void motor_menu(void);
6

    
7

    
8
int main(void){
9
        usb_init();
10
        
11
        //wait for activation char?
12
        
13
        main_menu();
14
}
15

    
16
void main_menu(void){
17
        usb_puts("Colony Diagnostic Station - Main Menu\n");
18
        usb_puts("F - Run Full Test\n");
19
        usb_puts("I - Run Individual Tests\n");
20
        char choice = usb_getc();
21
        switch(choice){
22
                case 'F':
23
                case 'f':
24
                        //run full test
25
                        break;
26
                case 'I':
27
                case 'i':
28
                        test_menu();
29
                        break;
30
                default:
31
                        usb_puts("Received invalid input ");
32
                        usb_putc(choice);
33
                        usb_putc('\n');
34
                        main_menu();
35
        }
36
        //flush?
37
        main_menu();
38
}
39

    
40
void test_menu(void){
41
        usb_puts("Colony Diagnostic Station - Individual Tests\n");
42
        usb_puts("B - Bearing and Orientation Module\n");
43
        usb_puts("I - Infrared Rangefinders\n");
44
        usb_puts("M - Motors\n");
45
        char choice = usb_getc();
46
        switch(choice){
47
                case 'B':
48
                case 'b':
49
                        BOM_menu();
50
                        break;
51
                case 'I':
52
                case 'i':
53
                        rangefinder_menu();
54
                        break;
55
                case 'M':
56
                case 'm':
57
                        motor_menu();
58
                default:
59
                        usb_puts("Received invalid input ");
60
                        usb_putc(choice);
61
                        usb_putc('\n');
62
                        test_menu();        
63
        }
64
}
65

    
66
void BOM_menu(void){
67
        usb_puts("Colony Diagnostic Station - BOM Tests\n");
68
        usb_puts("F - Run Full Test\n");
69
        usb_puts("D - Detectors\n");
70
        usb_puts("E - Emitters\n");
71
        char choice = usb_getc();
72
        switch(choice){
73
                case 'F':
74
                case 'f':
75
                        //run full test
76
                        break;
77
                case 'D':
78
                case 'd':
79
                        //test detectors
80
                        break;
81
                case 'E':
82
                case 'e':
83
                        //test emitters
84
                        break;
85
                default:
86
                        usb_puts("Received invalid input ");
87
                        usb_putc(choice);
88
                        usb_putc('\n');
89
                        BOM_menu();
90
        }
91
}
92

    
93
void rangefinder_menu(void){
94
        usb_puts("Colony Diagnostic Station - Rangefinder Tests\n");
95
        usb_puts("F - Run Full Test\n");
96
        usb_puts("M - Maximum and Minimum Range\n");
97
        usb_puts("L - Linearity\n");
98
        char choice = usb_getc();
99
        switch(choice){
100
                case 'F':
101
                case 'f':
102
                        //run full test
103
                        break;
104
                case 'm':
105
                case 'M':
106
                        //test max/min range
107
                        break;
108
                case 'L':
109
                case 'l':
110
                        //test linearity
111
                        break;
112
                default:
113
                        usb_puts("Received invalid input ");
114
                        usb_putc(choice);
115
                        usb_putc('\n');
116
                        rangefinder_menu();
117
        }
118
}
119

    
120
void motor_menu(void){
121
        usb_puts("Colony Diagnostic Station - Motor Tests\n");
122
        usb_puts("F - Run Full Test\n");
123
        usb_puts("M - Maximum and Minimum Speed\n");
124
        usb_puts("L - Linearity\n");
125
        usb_puts("E - Encoders\n");
126
        char choice = usb_getc();
127
        switch(choice){
128
                case 'F':
129
                case 'f':
130
                        //run full test
131
                        break;
132
                case 'm':
133
                case 'M':
134
                        //test max/min speed
135
                        break;
136
                case 'L':
137
                case 'l':
138
                        //test linearity
139
                        break;
140
                case 'E':
141
                case 'e':
142
                        //test encoders
143
                        break;
144
                default:
145
                        usb_puts("Received invalid input ");
146
                        usb_putc(choice);
147
                        usb_putc('\n');
148
                        rangefinder_menu();
149
        }
150
}