Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 582 → Rev 583

/VibrationTest/trunk/FlightCtrl/74d_Killagreg_VibrationTest.patch
2,7 → 2,7
===================================================================
--- analog.c (revision 1255)
+++ analog.c (working copy)
@@ -80,6 +80,31 @@
@@ -80,6 +80,40 @@
int8_t ExpandBaro = 0;
uint8_t PressureSensorOffset;
18,6 → 18,7
+
+int VibTestData[VIBTEST_NB_SAMPLES];
+volatile unsigned int VibTestCount;
+volatile unsigned int VibTestDone;
+int* VibTestDataP;
+uint8_t VibTestChannel;
+
28,13 → 29,21
+ VibTestDataP = VibTestData;
+ VibTestCount = VIBTEST_NB_SAMPLES;
+ ADMUX = AD_ACC_ROLL;
+ VibTestDone = 0;
+
+ ADC_Enable();
+
+ while(!VibTestDone);
+
+ if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2
+ else PORTC &= ~(1<<PORTC7);// Speaker at PC7
+
+}
+
/*****************************************************/
/* Initialize Analog Digital Converter */
/*****************************************************/
@@ -202,15 +227,8 @@
@@ -202,15 +236,8 @@
*/
51,7 → 60,7
ISR(ADC_vect)
{
static uint8_t ad_channel = AD_GYRO_NICK, state = 0;
@@ -218,6 +236,15 @@
@@ -218,6 +245,24 @@
static int32_t filtergyronick, filtergyroroll;
static int16_t tmpAirPressure = 0;
59,11 → 68,20
+ {
+ *(VibTestDataP++) = ADC;
+ ADMUX = VibTestChannel;
+ ADC_Enable();
+
+ // set speaker port to high
+ if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2
+ else PORTC |= (1<<PORTC7); // Speaker at PC7
+
+
+ VibTestCount--;
+ ADC_Enable();
+
+ return;
+ }
+
+ VibTestDone = 1;
+
// state machine
switch(state++)
{
170,11 → 188,22
===================================================================
--- timer0.c (revision 1255)
+++ timer0.c (working copy)
@@ -173,14 +173,14 @@
@@ -173,18 +173,18 @@
}
// if beeper is on
- if(Beeper_On)
- {
- // set speaker port to high
- if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2
- else PORTC |= (1<<PORTC7); // Speaker at PC7
- }
- else // beeper is off
- {
- // set speaker port to low
- if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2
- else PORTC &= ~(1<<PORTC7);// Speaker at PC7
- }
+// if(Beeper_On)
+// {
+// // set speaker port to high
182,16 → 211,14
+// else PORTC |= (1<<PORTC7); // Speaker at PC7
+// }
+// else // beeper is off
{
- // set speaker port to high
- if(BoardRelease == 10) PORTD |= (1<<PORTD2); // Speaker at PD2
- else PORTC |= (1<<PORTC7); // Speaker at PC7
- }
- else // beeper is off
- {
// set speaker port to low
if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2
else PORTC &= ~(1<<PORTC7);// Speaker at PC7
+// {
+// // set speaker port to low
+// if(BoardRelease == 10) PORTD &= ~(1<<PORTD2);// Speaker at PD2
+// else PORTC &= ~(1<<PORTC7);// Speaker at PC7
+// }
#ifndef USE_NAVICTRL
// update compass value if this option is enabled in the settings
Index: uart0.c
===================================================================
--- uart0.c (revision 1255)
225,18 → 252,18
+ requestedVibData = pRxData[1];
+ if (requestedVibData == 0)
+ {
+ int i;
+ while(!txd_complete); // wait for previous frame to be sent
+ //printf("VibTest Start...\r");
+// while(!txd_complete); // wait for previous frame to be sent
+
+// printf("VibTest Start...\r");
+ StartVibTest(pRxData[0] /*channel*/);
+ while (VibTestCount);
+ //printf("VibTest Done!\r");
+// for (i=0;i<VIBTEST_NB_SAMPLES;i++)
+// VibTestData[i]=i;
+ //printf("%d %d %d\r", VibTestData[0], VibTestData[1], VibTestData[2]);
+// printf("VibTest Done!\r");
+
+// {
+// int i;
+// for (i=0;i<VIBTEST_NB_SAMPLES;i++)
+// VibTestData[i]=i;
+// }
+ }
+ //SendOutData('F', FC_ADDRESS, 1, &VibTestData[index*25], 50);
+
+ }
+ break;
+