Subversion Repositories Projects

Rev

Rev 583 | Rev 659 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 583 Rev 631
1
Index: analog.c
1
Index: analog.c
2
===================================================================
2
===================================================================
3
--- analog.c    (revision 1255)
3
--- analog.c    (revision 1255)
4
+++ analog.c    (working copy)
4
+++ analog.c    (working copy)
5
@@ -80,6 +80,40 @@
5
@@ -80,6 +80,40 @@
6
 int8_t ExpandBaro = 0;
6
 int8_t ExpandBaro = 0;
7
 uint8_t PressureSensorOffset;
7
 uint8_t PressureSensorOffset;
8
 
8
 
9
+#define AD_GYRO_YAW            0
9
+#define AD_GYRO_YAW            0
10
+#define AD_GYRO_ROLL   1
10
+#define AD_GYRO_ROLL   1
11
+#define AD_GYRO_NICK   2
11
+#define AD_GYRO_NICK   2
12
+#define AD_AIRPRESS            3
12
+#define AD_AIRPRESS            3
13
+#define AD_UBAT                        4
13
+#define AD_UBAT                        4
14
+#define AD_ACC_TOP             5
14
+#define AD_ACC_TOP             5
15
+#define AD_ACC_ROLL            6
15
+#define AD_ACC_ROLL            6
16
+#define AD_ACC_NICK            7
16
+#define AD_ACC_NICK            7
17
+
17
+
18
+
18
+
19
+int VibTestData[VIBTEST_NB_SAMPLES];
19
+int VibTestData[VIBTEST_NB_SAMPLES];
20
+volatile unsigned int VibTestCount;
20
+volatile unsigned int VibTestCount;
21
+volatile unsigned int VibTestDone;
21
+volatile unsigned int VibTestDone;
22
+int* VibTestDataP;
22
+int* VibTestDataP;
23
+uint8_t VibTestChannel;
23
+uint8_t VibTestChannel;
24
+
24
+
25
+
25
+
26
+void StartVibTest(uint8_t channel)
26
+void StartVibTest(uint8_t channel)
27
+{
27
+{
28
+       VibTestChannel = channel;
28
+       VibTestChannel = channel;
29
+       VibTestDataP = VibTestData;
29
+       VibTestDataP = VibTestData;
30
+       VibTestCount = VIBTEST_NB_SAMPLES;
30
+       VibTestCount = VIBTEST_NB_SAMPLES;
31
+       ADMUX = AD_ACC_ROLL;
31
+       ADMUX = AD_ACC_ROLL;
32
+       VibTestDone = 0;
32
+       VibTestDone = 0;
33
+
33
+
34
+       ADC_Enable();
34
+       ADC_Enable();
35
+
35
+
36
+       while(!VibTestDone);
36
+       while(!VibTestDone);
37
+
37
+
38
+       if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2
38
+       if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2
39
+       else                   PORTC &= ~(1<<PORTC7);// Speaker at PC7
39
+       else                   PORTC &= ~(1<<PORTC7);// Speaker at PC7
40
+
40
+
41
+}
41
+}
42
+
42
+
43
 /*****************************************************/
43
 /*****************************************************/
44
 /*     Initialize Analog Digital Converter           */
44
 /*     Initialize Analog Digital Converter           */
45
 /*****************************************************/
45
 /*****************************************************/
46
@@ -202,15 +236,8 @@
46
@@ -202,15 +236,8 @@
47
 */
47
 */
48
 
48
 
49
 
49
 
50
-#define AD_GYRO_YAW            0
50
-#define AD_GYRO_YAW            0
51
-#define AD_GYRO_ROLL   1
51
-#define AD_GYRO_ROLL   1
52
-#define AD_GYRO_NICK   2
52
-#define AD_GYRO_NICK   2
53
-#define AD_AIRPRESS            3
53
-#define AD_AIRPRESS            3
54
-#define AD_UBAT                        4
54
-#define AD_UBAT                        4
55
-#define AD_ACC_TOP             5
55
-#define AD_ACC_TOP             5
56
-#define AD_ACC_ROLL            6
56
-#define AD_ACC_ROLL            6
57
-#define AD_ACC_NICK            7
57
-#define AD_ACC_NICK            7
58
 
58
 
59
+
59
+
60
 ISR(ADC_vect)
60
 ISR(ADC_vect)
61
 {
61
 {
62
     static uint8_t ad_channel = AD_GYRO_NICK, state = 0;
62
     static uint8_t ad_channel = AD_GYRO_NICK, state = 0;
63
@@ -218,6 +245,24 @@
63
@@ -218,6 +245,24 @@
64
     static int32_t filtergyronick, filtergyroroll;
64
     static int32_t filtergyronick, filtergyroroll;
65
     static int16_t tmpAirPressure = 0;
65
     static int16_t tmpAirPressure = 0;
66
 
66
 
67
+    if (VibTestCount)
67
+    if (VibTestCount)
68
+       {
68
+       {
69
+               *(VibTestDataP++) = ADC;
69
+               *(VibTestDataP++) = ADC;
70
+               ADMUX = VibTestChannel;
70
+               ADMUX = VibTestChannel;
71
+               ADC_Enable();
71
+               ADC_Enable();
72
+
72
+
73
+               // set speaker port to high
73
+               // set speaker port to high
74
+               if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2
74
+               if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2
75
+               else                   PORTC |= (1<<PORTC7); // Speaker at PC7
75
+               else                   PORTC |= (1<<PORTC7); // Speaker at PC7
76
+
76
+
77
+
77
+
78
+               VibTestCount--;
78
+               VibTestCount--;
79
+
79
+
80
+               return;
80
+               return;
81
+       }
81
+       }
82
+
82
+
83
+    VibTestDone = 1;
83
+    VibTestDone = 1;
84
+
84
+
85
     // state machine
85
     // state machine
86
        switch(state++)
86
        switch(state++)
87
        {
87
        {
88
Index: analog.h
88
Index: analog.h
89
===================================================================
89
===================================================================
90
--- analog.h    (revision 1255)
90
--- analog.h    (revision 1255)
91
+++ analog.h    (working copy)
91
+++ analog.h    (working copy)
92
@@ -25,7 +25,12 @@
92
@@ -25,7 +25,12 @@
93
 void SearchDacGyroOffset(void);
93
 void SearchDacGyroOffset(void);
94
 void ADC_Init(void);
94
 void ADC_Init(void);
95
 
95
 
96
+#define VIBTEST_NB_SAMPLES 1000
96
+#define VIBTEST_NB_SAMPLES 1000
97
+extern int VibTestData[VIBTEST_NB_SAMPLES];
97
+extern int VibTestData[VIBTEST_NB_SAMPLES];
98
+extern volatile unsigned int VibTestCount;
98
+extern volatile unsigned int VibTestCount;
99
+void StartVibTest(uint8_t channel);
99
+void StartVibTest(uint8_t channel);
100
 
100
 
101
+
101
+
102
 // clear ADC enable & ADC Start Conversion & ADC Interrupt Enable bit
102
 // clear ADC enable & ADC Start Conversion & ADC Interrupt Enable bit
103
 #define ADC_Disable() (ADCSRA &= ~((1<<ADEN)|(1<<ADSC)|(1<<ADIE)))
103
 #define ADC_Disable() (ADCSRA &= ~((1<<ADEN)|(1<<ADSC)|(1<<ADIE)))
104
 // set ADC enable & ADC Start Conversion & ADC Interrupt Enable bit
104
 // set ADC enable & ADC Start Conversion & ADC Interrupt Enable bit
105
Index: makefile
105
Index: makefile
106
===================================================================
106
===================================================================
107
--- makefile    (revision 1255)
107
--- makefile    (revision 1255)
108
+++ makefile    (working copy)
108
+++ makefile    (working copy)
109
@@ -50,63 +50,8 @@
109
@@ -50,63 +50,8 @@
110
 # Output format. (can be srec, ihex, binary)
110
 # Output format. (can be srec, ihex, binary)
111
 FORMAT = ihex
111
 FORMAT = ihex
112
 
112
 
113
-# Target file name (without extension).
113
-# Target file name (without extension).
114
+TARGET = Flight-Ctrl_MEGA644p_VibrationTest
114
+TARGET = Flight-Ctrl_MEGA644p_VibrationTest
115
 
115
 
116
-ifeq ($(VERSION_PATCH), 0)
116
-ifeq ($(VERSION_PATCH), 0)
117
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV)
117
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)a_SVN$(REV)
118
-endif
118
-endif
119
-ifeq ($(VERSION_PATCH), 1)
119
-ifeq ($(VERSION_PATCH), 1)
120
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV)
120
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)b_SVN$(REV)
121
-endif
121
-endif
122
-ifeq ($(VERSION_PATCH), 2)
122
-ifeq ($(VERSION_PATCH), 2)
123
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)c_SVN$(REV)
123
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)c_SVN$(REV)
124
-endif
124
-endif
125
-ifeq ($(VERSION_PATCH), 3)
125
-ifeq ($(VERSION_PATCH), 3)
126
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)d_SVN$(REV)
126
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)d_SVN$(REV)
127
-endif
127
-endif
128
-ifeq ($(VERSION_PATCH), 4)
128
-ifeq ($(VERSION_PATCH), 4)
129
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)e_SVN$(REV)
129
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)e_SVN$(REV)
130
-endif
130
-endif
131
-ifeq ($(VERSION_PATCH), 5)
131
-ifeq ($(VERSION_PATCH), 5)
132
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)f_SVN$(REV)
132
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)f_SVN$(REV)
133
-endif
133
-endif
134
-ifeq ($(VERSION_PATCH), 6)
134
-ifeq ($(VERSION_PATCH), 6)
135
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)g_SVN$(REV)
135
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)g_SVN$(REV)
136
-endif
136
-endif
137
-ifeq ($(VERSION_PATCH), 7)
137
-ifeq ($(VERSION_PATCH), 7)
138
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)h_SVN$(REV)
138
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)h_SVN$(REV)
139
-endif
139
-endif
140
-ifeq ($(VERSION_PATCH), 8)
140
-ifeq ($(VERSION_PATCH), 8)
141
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)i_SVN$(REV)
141
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)i_SVN$(REV)
142
-endif
142
-endif
143
-ifeq ($(VERSION_PATCH), 9)
143
-ifeq ($(VERSION_PATCH), 9)
144
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)j_SVN$(REV)
144
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)j_SVN$(REV)
145
-endif
145
-endif
146
-ifeq ($(VERSION_PATCH), 10)
146
-ifeq ($(VERSION_PATCH), 10)
147
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)k_SVN$(REV)
147
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)k_SVN$(REV)
148
-endif
148
-endif
149
-ifeq ($(VERSION_PATCH), 11)
149
-ifeq ($(VERSION_PATCH), 11)
150
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)l_SVN$(REV)
150
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)l_SVN$(REV)
151
-endif
151
-endif
152
-ifeq ($(VERSION_PATCH), 12)
152
-ifeq ($(VERSION_PATCH), 12)
153
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)m_SVN$(REV)
153
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)m_SVN$(REV)
154
-endif
154
-endif
155
-ifeq ($(VERSION_PATCH), 13)
155
-ifeq ($(VERSION_PATCH), 13)
156
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)n_SVN$(REV)
156
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)n_SVN$(REV)
157
-endif
157
-endif
158
-ifeq ($(VERSION_PATCH), 14)
158
-ifeq ($(VERSION_PATCH), 14)
159
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)o_SVN$(REV)
159
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)o_SVN$(REV)
160
-endif
160
-endif
161
-ifeq ($(VERSION_PATCH), 15)
161
-ifeq ($(VERSION_PATCH), 15)
162
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)p_SVN$(REV)
162
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)p_SVN$(REV)
163
-endif
163
-endif
164
-ifeq ($(VERSION_PATCH), 16)
164
-ifeq ($(VERSION_PATCH), 16)
165
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)q_SVN$(REV)
165
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)q_SVN$(REV)
166
-endif
166
-endif
167
-ifeq ($(VERSION_PATCH), 17)
167
-ifeq ($(VERSION_PATCH), 17)
168
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)r_SVN$(REV)
168
-TARGET = Flight-Ctrl_$(HEX_NAME)_V$(VERSION_MAJOR)_$(VERSION_MINOR)r_SVN$(REV)
169
-endif
169
-endif
170
-
170
-
171
 # Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization.
171
 # Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization.
172
 # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
172
 # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
173
 OPT = 2
173
 OPT = 2
174
Index: menu.c
174
Index: menu.c
175
===================================================================
175
===================================================================
176
--- menu.c      (revision 1255)
176
--- menu.c      (revision 1255)
177
+++ menu.c      (working copy)
177
+++ menu.c      (working copy)
178
@@ -139,7 +139,7 @@
178
@@ -139,7 +139,7 @@
179
        switch(MenuItem)
179
        switch(MenuItem)
180
        {
180
        {
181
        case 0:// Version Info Menu Item
181
        case 0:// Version Info Menu Item
182
-               LCD_printfxy(0,0,"+ MikroKopter +");
182
-               LCD_printfxy(0,0,"+ MikroKopter +");
183
+               LCD_printfxy(0,0,"MK ==VIBR TEST==");
183
+               LCD_printfxy(0,0,"MK ==VIBR TEST==");
184
                LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",BoardRelease/10,BoardRelease%10,VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH+'a');
184
                LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",BoardRelease/10,BoardRelease%10,VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH+'a');
185
                LCD_printfxy(0,2,"Setting: %d %s", GetActiveParamSet(), Mixer.Name);
185
                LCD_printfxy(0,2,"Setting: %d %s", GetActiveParamSet(), Mixer.Name);
186
                if(I2CTimeout < 6)
186
                if(I2CTimeout < 6)
187
Index: timer0.c
187
Index: timer0.c
188
===================================================================
188
===================================================================
189
--- timer0.c    (revision 1255)
189
--- timer0.c    (revision 1255)
190
+++ timer0.c    (working copy)
190
+++ timer0.c    (working copy)
191
@@ -173,18 +173,18 @@
191
@@ -173,18 +173,18 @@
192
        }
192
        }
193
 
193
 
194
        // if beeper is on
194
        // if beeper is on
195
-       if(Beeper_On)
195
-       if(Beeper_On)
196
-       {
196
-       {
197
-               // set speaker port to high
197
-               // set speaker port to high
198
-               if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2
198
-               if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2
199
-               else                   PORTC |= (1<<PORTC7); // Speaker at PC7
199
-               else                   PORTC |= (1<<PORTC7); // Speaker at PC7
200
-       }
200
-       }
201
-       else // beeper is off
201
-       else // beeper is off
202
-       {
202
-       {
203
-               // set speaker port to low
203
-               // set speaker port to low
204
-               if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2
204
-               if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2
205
-               else                   PORTC &= ~(1<<PORTC7);// Speaker at PC7
205
-               else                   PORTC &= ~(1<<PORTC7);// Speaker at PC7
206
-       }
206
-       }
207
+//     if(Beeper_On)
207
+//     if(Beeper_On)
208
+//     {
208
+//     {
209
+//             // set speaker port to high
209
+//             // set speaker port to high
210
+//             if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2
210
+//             if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2
211
+//             else                   PORTC |= (1<<PORTC7); // Speaker at PC7
211
+//             else                   PORTC |= (1<<PORTC7); // Speaker at PC7
212
+//     }
212
+//     }
213
+//     else // beeper is off
213
+//     else // beeper is off
214
+//     {
214
+//     {
215
+//             // set speaker port to low
215
+//             // set speaker port to low
216
+//             if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2
216
+//             if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2
217
+//             else                   PORTC &= ~(1<<PORTC7);// Speaker at PC7
217
+//             else                   PORTC &= ~(1<<PORTC7);// Speaker at PC7
218
+//     }
218
+//     }
219
 
219
 
220
        #ifndef USE_NAVICTRL
220
        #ifndef USE_NAVICTRL
221
        // update compass value if this option is enabled in the settings
221
        // update compass value if this option is enabled in the settings
222
Index: uart0.c
222
Index: uart0.c
223
===================================================================
223
===================================================================
224
--- uart0.c     (revision 1255)
224
--- uart0.c     (revision 1255)
225
+++ uart0.c     (working copy)
225
+++ uart0.c     (working copy)
226
@@ -68,8 +68,11 @@
226
@@ -68,8 +68,11 @@
227
 #ifdef USE_MK3MAG
227
 #ifdef USE_MK3MAG
228
 #include "mk3mag.h"
228
 #include "mk3mag.h"
229
 #endif
229
 #endif
230
+#include "printf_P.h"
230
+#include "printf_P.h"
231
 
231
 
232
+#include "analog.h"
232
+#include "analog.h"
233
 
233
 
234
+
234
+
235
 #define FC_ADDRESS 1
235
 #define FC_ADDRESS 1
236
 #define NC_ADDRESS 2
236
 #define NC_ADDRESS 2
237
 #define MK3MAG_ADDRESS 3
237
 #define MK3MAG_ADDRESS 3
238
@@ -117,6 +120,7 @@
238
@@ -117,6 +120,7 @@
239
 uint16_t Data3D_Timer;
239
 uint16_t Data3D_Timer;
240
 uint16_t DebugData_Interval = 500; // in 1ms
240
 uint16_t DebugData_Interval = 500; // in 1ms
241
 uint16_t Data3D_Interval = 0; // in 1ms
241
 uint16_t Data3D_Interval = 0; // in 1ms
242
+int16_t requestedVibData;
242
+int16_t requestedVibData;
243
 
243
 
244
 #ifdef USE_MK3MAG
244
 #ifdef USE_MK3MAG
245
 int16_t Compass_Timer;
245
 int16_t Compass_Timer;
246
@@ -501,6 +505,26 @@
246
@@ -501,6 +505,28 @@
247
                                PcAccess = 255;
247
                                PcAccess = 255;
248
                                break;
248
                                break;
249
 
249
 
250
+                       case 'f':       // VibrationTest
250
+                       case 'f':       // VibrationTest
251
+                               {
251
+                               {
252
+                                       requestedVibData = pRxData[1];
252
+                                       requestedVibData = pRxData[1];
253
+                                       if (requestedVibData == 0)
253
+                                       if (requestedVibData == 0)
254
+                                       {
254
+                                       {
255
+//                                             while(!txd_complete); // wait for previous frame to be sent
255
+//                                             while(!txd_complete); // wait for previous frame to be sent
256
+
256
+
257
+//                                             printf("VibTest Start...\r");
257
+//                                             printf("VibTest Start...\r");
258
+                                               StartVibTest(pRxData[0] /*channel*/);
258
+                                               StartVibTest(pRxData[0] /*channel*/);
259
+//                                             printf("VibTest Done!\r");
259
+//                                             printf("VibTest Done!\r");
260
+
260
+
261
+//                                             {
261
+//                                             {
262
+//                                                     int i;
262
+//                                                     int i;
263
+//                                                     for (i=0;i<VIBTEST_NB_SAMPLES;i++)
263
+//                                                     for (i=0;i<VIBTEST_NB_SAMPLES;i++)
264
+//                                                             VibTestData[i]=i;
264
+//                                                             VibTestData[i]=i;
265
+//                                             }
265
+//                                             }
266
+                                       }
266
+                                       }
-
 
267
+                                       if (MotorTest_Active)
-
 
268
+                                               MotorTest_Active = 255; // Extend motor test Timeout
267
+                               }
269
+                               }
268
+                               break;
270
+                               break;
269
+
271
+
270
                        case 'n':// "Get Mixer Table
272
                        case 'n':// "Get Mixer Table
271
                                while(!txd_complete); // wait for previous frame to be sent
273
                                while(!txd_complete); // wait for previous frame to be sent
272
                                SendOutData('N', FC_ADDRESS, 1, (uint8_t *) &Mixer, sizeof(Mixer));
274
                                SendOutData('N', FC_ADDRESS, 1, (uint8_t *) &Mixer, sizeof(Mixer));
273
@@ -637,6 +661,7 @@
275
@@ -637,6 +663,7 @@
274
        loop_until_bit_is_set(UCSR0A, UDRE0);
276
        loop_until_bit_is_set(UCSR0A, UDRE0);
275
        // send character
277
        // send character
276
        UDR0 = c;
278
        UDR0 = c;
277
+       loop_until_bit_is_set(UCSR0A, UDRE0);
279
+       loop_until_bit_is_set(UCSR0A, UDRE0);
278
        return (0);
280
        return (0);
279
 }
281
 }
280
 
282
 
281
@@ -646,6 +671,11 @@
283
@@ -646,6 +673,11 @@
282
 {
284
 {
283
        if(!txd_complete) return;
285
        if(!txd_complete) return;
284
 
286
 
285
+       if (requestedVibData>=0 && txd_complete)
287
+       if (requestedVibData>=0 && txd_complete)
286
+       {
288
+       {
287
+               SendOutData('F', FC_ADDRESS, 1, &VibTestData[requestedVibData*50], 100);
289
+               SendOutData('F', FC_ADDRESS, 1, &VibTestData[requestedVibData*50], 100);
288
+               requestedVibData = -1;
290
+               requestedVibData = -1;
289
+       }
291
+       }
290
        if(Request_VerInfo && txd_complete)
292
        if(Request_VerInfo && txd_complete)
291
        {
293
        {
292
                SendOutData('V', FC_ADDRESS, 1, (uint8_t *) &UART_VersionInfo, sizeof(UART_VersionInfo));
294
                SendOutData('V', FC_ADDRESS, 1, (uint8_t *) &UART_VersionInfo, sizeof(UART_VersionInfo));
293
 
295