Rev 568 | Rev 631 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 568 | Rev 583 | ||
---|---|---|---|
Line 1... | Line 1... | ||
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,31 @@ |
5 | @@ -80,6 +80,40 @@ |
6 | int8_t ExpandBaro = 0; |
6 | int8_t ExpandBaro = 0; |
7 | uint8_t PressureSensorOffset; |
7 | uint8_t PressureSensorOffset; |
Line 8... | Line 8... | ||
8 | 8 | ||
9 | +#define AD_GYRO_YAW 0 |
9 | +#define AD_GYRO_YAW 0 |
Line 16... | Line 16... | ||
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 | +int* VibTestDataP; |
22 | +int* VibTestDataP; |
22 | +uint8_t VibTestChannel; |
23 | +uint8_t VibTestChannel; |
23 | + |
24 | + |
24 | + |
25 | + |
25 | +void StartVibTest(uint8_t channel) |
26 | +void StartVibTest(uint8_t channel) |
26 | +{ |
27 | +{ |
27 | + VibTestChannel = channel; |
28 | + VibTestChannel = channel; |
28 | + VibTestDataP = VibTestData; |
29 | + VibTestDataP = VibTestData; |
29 | + VibTestCount = VIBTEST_NB_SAMPLES; |
30 | + VibTestCount = VIBTEST_NB_SAMPLES; |
30 | + ADMUX = AD_ACC_ROLL; |
31 | + ADMUX = AD_ACC_ROLL; |
- | 32 | + VibTestDone = 0; |
|
- | 33 | + |
|
31 | + ADC_Enable(); |
34 | + ADC_Enable(); |
- | 35 | + |
|
- | 36 | + while(!VibTestDone); |
|
- | 37 | + |
|
- | 38 | + if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2 |
|
- | 39 | + else PORTC &= ~(1<<PORTC7);// Speaker at PC7 |
|
- | 40 | + |
|
32 | +} |
41 | +} |
33 | + |
42 | + |
34 | /*****************************************************/ |
43 | /*****************************************************/ |
35 | /* Initialize Analog Digital Converter */ |
44 | /* Initialize Analog Digital Converter */ |
36 | /*****************************************************/ |
45 | /*****************************************************/ |
37 | @@ -202,15 +227,8 @@ |
46 | @@ -202,15 +236,8 @@ |
38 | */ |
47 | */ |
Line 39... | Line 48... | ||
39 | 48 | ||
40 | 49 | ||
Line 49... | Line 58... | ||
49 | 58 | ||
50 | + |
59 | + |
51 | ISR(ADC_vect) |
60 | ISR(ADC_vect) |
52 | { |
61 | { |
53 | static uint8_t ad_channel = AD_GYRO_NICK, state = 0; |
62 | static uint8_t ad_channel = AD_GYRO_NICK, state = 0; |
54 | @@ -218,6 +236,15 @@ |
63 | @@ -218,6 +245,24 @@ |
55 | static int32_t filtergyronick, filtergyroroll; |
64 | static int32_t filtergyronick, filtergyroroll; |
Line 56... | Line 65... | ||
56 | static int16_t tmpAirPressure = 0; |
65 | static int16_t tmpAirPressure = 0; |
57 | 66 | ||
58 | + if (VibTestCount) |
67 | + if (VibTestCount) |
59 | + { |
68 | + { |
60 | + *(VibTestDataP++) = ADC; |
- | |
61 | + ADMUX = VibTestChannel; |
69 | + *(VibTestDataP++) = ADC; |
- | 70 | + ADMUX = VibTestChannel; |
|
- | 71 | + ADC_Enable(); |
|
- | 72 | + |
|
- | 73 | + // set speaker port to high |
|
- | 74 | + if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2 |
|
- | 75 | + else PORTC |= (1<<PORTC7); // Speaker at PC7 |
|
- | 76 | + |
|
- | 77 | + |
|
62 | + VibTestCount--; |
78 | + VibTestCount--; |
63 | + ADC_Enable(); |
79 | + |
64 | + return; |
80 | + return; |
- | 81 | + } |
|
- | 82 | + |
|
65 | + } |
83 | + VibTestDone = 1; |
66 | + |
84 | + |
67 | // state machine |
85 | // state machine |
68 | switch(state++) |
86 | switch(state++) |
69 | { |
87 | { |
Line 168... | Line 186... | ||
168 | if(I2CTimeout < 6) |
186 | if(I2CTimeout < 6) |
169 | Index: timer0.c |
187 | Index: timer0.c |
170 | =================================================================== |
188 | =================================================================== |
171 | --- timer0.c (revision 1255) |
189 | --- timer0.c (revision 1255) |
172 | +++ timer0.c (working copy) |
190 | +++ timer0.c (working copy) |
173 | @@ -173,14 +173,14 @@ |
191 | @@ -173,18 +173,18 @@ |
174 | } |
192 | } |
Line 175... | Line 193... | ||
175 | 193 | ||
176 | // if beeper is on |
194 | // if beeper is on |
- | 195 | - if(Beeper_On) |
|
- | 196 | - { |
|
- | 197 | - // set speaker port to high |
|
- | 198 | - if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2 |
|
- | 199 | - else PORTC |= (1<<PORTC7); // Speaker at PC7 |
|
- | 200 | - } |
|
- | 201 | - else // beeper is off |
|
- | 202 | - { |
|
- | 203 | - // set speaker port to low |
|
- | 204 | - if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2 |
|
- | 205 | - else PORTC &= ~(1<<PORTC7);// Speaker at PC7 |
|
177 | - if(Beeper_On) |
206 | - } |
178 | +// if(Beeper_On) |
207 | +// if(Beeper_On) |
179 | +// { |
208 | +// { |
180 | +// // set speaker port to high |
209 | +// // set speaker port to high |
181 | +// if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2 |
210 | +// if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2 |
182 | +// else PORTC |= (1<<PORTC7); // Speaker at PC7 |
211 | +// else PORTC |= (1<<PORTC7); // Speaker at PC7 |
183 | +// } |
212 | +// } |
184 | +// else // beeper is off |
213 | +// else // beeper is off |
185 | { |
214 | +// { |
186 | - // set speaker port to high |
215 | +// // set speaker port to low |
187 | - if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2 |
216 | +// if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2 |
188 | - else PORTC |= (1<<PORTC7); // Speaker at PC7 |
217 | +// else PORTC &= ~(1<<PORTC7);// Speaker at PC7 |
189 | - } |
- | |
190 | - else // beeper is off |
218 | +// } |
191 | - { |
219 | |
192 | // set speaker port to low |
- | |
193 | if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2 |
220 | #ifndef USE_NAVICTRL |
194 | else PORTC &= ~(1<<PORTC7);// Speaker at PC7 |
221 | // update compass value if this option is enabled in the settings |
195 | Index: uart0.c |
222 | Index: uart0.c |
196 | =================================================================== |
223 | =================================================================== |
197 | --- uart0.c (revision 1255) |
224 | --- uart0.c (revision 1255) |
198 | +++ uart0.c (working copy) |
225 | +++ uart0.c (working copy) |
Line 223... | Line 250... | ||
223 | + case 'f': // VibrationTest |
250 | + case 'f': // VibrationTest |
224 | + { |
251 | + { |
225 | + requestedVibData = pRxData[1]; |
252 | + requestedVibData = pRxData[1]; |
226 | + if (requestedVibData == 0) |
253 | + if (requestedVibData == 0) |
227 | + { |
254 | + { |
228 | + int i; |
- | |
229 | + while(!txd_complete); // wait for previous frame to be sent |
255 | +// while(!txd_complete); // wait for previous frame to be sent |
- | 256 | + |
|
230 | + //printf("VibTest Start...\r"); |
257 | +// printf("VibTest Start...\r"); |
231 | + StartVibTest(pRxData[0] /*channel*/); |
258 | + StartVibTest(pRxData[0] /*channel*/); |
232 | + while (VibTestCount); |
- | |
233 | + //printf("VibTest Done!\r"); |
259 | +// printf("VibTest Done!\r"); |
234 | +// for (i=0;i<VIBTEST_NB_SAMPLES;i++) |
- | |
235 | +// VibTestData[i]=i; |
- | |
236 | + //printf("%d %d %d\r", VibTestData[0], VibTestData[1], VibTestData[2]); |
- | |
237 | + } |
- | |
238 | + //SendOutData('F', FC_ADDRESS, 1, &VibTestData[index*25], 50); |
- | |
239 | + |
260 | + |
- | 261 | +// { |
|
- | 262 | +// int i; |
|
- | 263 | +// for (i=0;i<VIBTEST_NB_SAMPLES;i++) |
|
- | 264 | +// VibTestData[i]=i; |
|
- | 265 | +// } |
|
- | 266 | + } |
|
240 | + } |
267 | + } |
241 | + break; |
268 | + break; |
242 | + |
269 | + |
243 | case 'n':// "Get Mixer Table |
270 | case 'n':// "Get Mixer Table |
244 | while(!txd_complete); // wait for previous frame to be sent |
271 | while(!txd_complete); // wait for previous frame to be sent |