Subversion Repositories FlightCtrl

Rev

Rev 528 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 528 Rev 529
Line 17... Line 17...
17
unsigned volatile char NeueKoordinateEmpfangen = 0;
17
unsigned volatile char NeueKoordinateEmpfangen = 0;
18
unsigned volatile char UebertragungAbgeschlossen = 1;
18
unsigned volatile char UebertragungAbgeschlossen = 1;
19
unsigned volatile char CntCrcError = 0;
19
unsigned volatile char CntCrcError = 0;
20
unsigned volatile char AnzahlEmpfangsBytes = 0;
20
unsigned volatile char AnzahlEmpfangsBytes = 0;
21
unsigned volatile char PC_DebugTimeout = 0;
21
unsigned volatile char PC_DebugTimeout = 0;
-
 
22
unsigned char RemotePollDisplayLine = 0;
-
 
23
unsigned char NurKanalAnforderung = 0;
-
 
24
unsigned char DebugTextAnforderung = 255;
22
unsigned char PcZugriff = 100;
25
unsigned char PcZugriff = 100;
23
unsigned char MotorTest[4] = {0,0,0,0};
26
unsigned char MotorTest[4] = {0,0,0,0};
-
 
27
unsigned char DubWiseKeys[3] = {0,0,0};
24
unsigned char MeineSlaveAdresse;
28
unsigned char MeineSlaveAdresse;
25
struct str_DebugOut    DebugOut;
29
struct str_DebugOut    DebugOut;
26
struct str_Debug       DebugIn;
30
struct str_Debug       DebugIn;
27
struct str_VersionInfo VersionInfo;
31
struct str_VersionInfo VersionInfo;
28
int Debug_Timer;
32
int Debug_Timer;
29
//Salvo 26.10.2007
33
//Salvo 26.10.2007
30
int dataset_cnt=0; //Zahelt die uebertragenen Debugdaten
34
int dataset_cnt=0; //Zahelt die uebertragenen Debugdaten
31
//Salvo End
35
//Salvo End
-
 
36
 
-
 
37
const unsigned char ANALOG_TEXT[32][16] =
-
 
38
{
-
 
39
   //1234567890123456 
-
 
40
    "IntegralNick    ", //0
-
 
41
    "IntegralRoll    ",
-
 
42
    "AccNick         ",
-
 
43
    "AccRoll         ",
-
 
44
    "GyroGier        ",
-
 
45
    "HoehenWert      ", //5
-
 
46
    "AccZ            ",
-
 
47
    "Gas             ",
-
 
48
    "KompassValue    ",
-
 
49
    "Ersatzkompass   ",
-
 
50
    "Empfang         ", //10
-
 
51
    "Analog11        ",
-
 
52
    "Motor_Vorne     ",
-
 
53
    "Motor_Hinten    ",
-
 
54
    "Motor_Links     ",
-
 
55
    "Motor_Rechts    ", //15
-
 
56
    "Index           ",
-
 
57
    "UBat            ",
-
 
58
    "Messwert_Nick   ",
-
 
59
    "Messwert_Roll   ",
-
 
60
    "Messwert_Gier   ", //20
-
 
61
    "Stick_Nick      ",
-
 
62
    "Stick_Roll          ",
-
 
63
    "Stick_Gier      ",
-
 
64
    "RollOffset      ",
-
 
65
    "IntRoll*Faktor  ", //25
-
 
66
    "utm_east        ",
-
 
67
    "utm_north       ",
-
 
68
    "utm_alt         ",
-
 
69
    "gps_state       ",
-
 
70
    "I-LageRoll      ", //30
-
 
71
    "StickRoll       "
-
 
72
};
-
 
73
 
-
 
74
 
-
 
75
 
32
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
76
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
33
//++ Sende-Part der Datenübertragung
77
//++ Sende-Part der Datenübertragung
34
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
78
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
35
SIGNAL(INT_VEC_TX)
79
SIGNAL(INT_VEC_TX)
36
{
80
{
Line 181... Line 225...
181
// --------------------------------------------------------------------------
225
// --------------------------------------------------------------------------
182
void BearbeiteRxDaten(void)
226
void BearbeiteRxDaten(void)
183
{
227
{
184
 if(!NeuerDatensatzEmpfangen) return;
228
 if(!NeuerDatensatzEmpfangen) return;
Line 185... Line 229...
185
 
229
 
186
 unsigned int tmp_int_arr1[1];
230
// unsigned int tmp_int_arr1[1];
187
 unsigned int tmp_int_arr2[2];
231
// unsigned int tmp_int_arr2[2];
188
 unsigned int tmp_int_arr3[3];
232
// unsigned int tmp_int_arr3[3];
189
 unsigned char tmp_char_arr2[2];
233
 unsigned char tmp_char_arr2[2];
190
 unsigned char tmp_char_arr3[3];
234
// unsigned char tmp_char_arr3[3];
191
 unsigned char tmp_char_arr4[4];
235
// unsigned char tmp_char_arr4[4];
192
 //if(!MotorenEin) 
236
 //if(!MotorenEin) 
193
 PcZugriff = 255;
237
 PcZugriff = 255;
194
  switch(RxdBuffer[2])
238
  switch(RxdBuffer[2])
-
 
239
  {
-
 
240
   case 'a':// Texte der Analogwerte
-
 
241
            Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes);
-
 
242
            DebugTextAnforderung = tmp_char_arr2[0];
195
  {
243
                        break;
196
   case 'c':// Debugdaten incl. Externe IOs usw 
244
   case 'c':// Debugdaten incl. Externe IOs usw 
197
                        Decode64((unsigned char *) &DebugIn,sizeof(DebugIn),3,AnzahlEmpfangsBytes);
245
                        Decode64((unsigned char *) &DebugIn,sizeof(DebugIn),3,AnzahlEmpfangsBytes);
198
/*              for(unsigned char i=0; i<4;i++)
246
/*              for(unsigned char i=0; i<4;i++)
199
                         {
247
                         {
200
              EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2],     DebugIn.Analog[i]);
248
              EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2],     DebugIn.Analog[i]);
201
                          EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2 + 1], DebugIn.Analog[i] >> 8);       
249
                          EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2 + 1], DebugIn.Analog[i] >> 8);       
202
                         }*/
250
                         }*/
203
                        //RemoteTasten |= DebugIn.RemoteTasten;
251
                        RemoteTasten |= DebugIn.RemoteTasten;
204
            DebugDataAnforderung = 1;
252
            DebugDataAnforderung = 1;
205
            break;
-
 
206
 
253
            break;
207
   case 'h':// x-1 Displayzeilen
254
   case 'h':// x-1 Displayzeilen
208
            Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes);
255
            Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes);
-
 
256
            RemoteTasten |= tmp_char_arr2[0];
209
            RemoteTasten |= tmp_char_arr2[0];
257
                        if(tmp_char_arr2[1] == 255) NurKanalAnforderung = 1; else NurKanalAnforderung = 0; // keine Displaydaten
210
                        DebugDisplayAnforderung = 1;
258
                        DebugDisplayAnforderung = 1;
211
                        break;
259
                        break;
212
   case 't':// Motortest
260
   case 't':// Motortest
213
            Decode64((unsigned char *) &MotorTest[0],sizeof(MotorTest),3,AnzahlEmpfangsBytes);
261
            Decode64((unsigned char *) &MotorTest[0],sizeof(MotorTest),3,AnzahlEmpfangsBytes);
-
 
262
                        break;
-
 
263
   case 'k':// Keys von DubWise
-
 
264
            Decode64((unsigned char *) &DubWiseKeys[0],sizeof(DubWiseKeys),3,AnzahlEmpfangsBytes);
214
                        break;
265
                        break;
215
   case 'v': // Version-Anforderung     und Ausbaustufe
266
   case 'v': // Version-Anforderung     und Ausbaustufe
216
            GetVersionAnforderung = 1;
267
            GetVersionAnforderung = 1;
217
            break;                                                               
268
            break;                                                               
218
   case 'g':// "Get"-Anforderung für Debug-Daten 
269
   case 'g':// "Get"-Anforderung für Debug-Daten 
Line 239... Line 290...
239
   case 'o':
290
   case 'o':
240
   case 'p': // Parametersatz speichern
291
   case 'p': // Parametersatz speichern
241
            Decode64((unsigned char *) &EE_Parameter.Kanalbelegung[0],STRUCT_PARAM_LAENGE,3,AnzahlEmpfangsBytes);
292
            Decode64((unsigned char *) &EE_Parameter.Kanalbelegung[0],STRUCT_PARAM_LAENGE,3,AnzahlEmpfangsBytes);
242
                        WriteParameterSet(RxdBuffer[2] - 'l' + 1, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
293
                        WriteParameterSet(RxdBuffer[2] - 'l' + 1, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE);
243
            eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], RxdBuffer[2] - 'l' + 1);  // aktiven Datensatz merken
294
            eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], RxdBuffer[2] - 'l' + 1);  // aktiven Datensatz merken
-
 
295
            Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L;
-
 
296
            Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L;
244
            Piep(GetActiveParamSetNumber());
297
            Piep(GetActiveParamSetNumber());
245
         break;
298
         break;
Line 246... Line 299...
246
               
299
               
Line 316... Line 369...
316
                  //Salvo 26.10.2007  Counter fuer Erkennung von fehlenden Daten per Bluetoothuebertragung
369
                  //Salvo 26.10.2007  Counter fuer Erkennung von fehlenden Daten per Bluetoothuebertragung
317
                  dataset_cnt++;
370
                  dataset_cnt++;
318
                  // Salvo End
371
                  // Salvo End
319
          Debug_Timer = SetDelay(MIN_DEBUG_INTERVALL);  
372
          Debug_Timer = SetDelay(MIN_DEBUG_INTERVALL);  
320
         }
373
         }
-
 
374
    if(DebugTextAnforderung != 255) // Texte für die Analogdaten
-
 
375
     {
-
 
376
      SendOutData('A',DebugTextAnforderung + '0',(unsigned char *) ANALOG_TEXT[DebugTextAnforderung],16);
-
 
377
      DebugTextAnforderung = 255;
-
 
378
         }
Line 321... Line 379...
321
 
379
 
322
     if(DebugDisplayAnforderung && UebertragungAbgeschlossen)
380
     if(DebugDisplayAnforderung && UebertragungAbgeschlossen)
323
         {
381
         {
324
      Menu();
382
      Menu();
325
          DebugDisplayAnforderung = 0;
383
          DebugDisplayAnforderung = 0;
326
      if(++dis_zeile == 4)
384
      if(++RemotePollDisplayLine == 4 || NurKanalAnforderung)
327
      {
385
      {
328
       SendOutData('4',0,&PPM_in,sizeof(PPM_in));   // DisplayZeile übertragen
386
       SendOutData('4',0,(unsigned char *)&PPM_in,sizeof(PPM_in));   // DisplayZeile übertragen
329
       dis_zeile = -1;
387
       RemotePollDisplayLine = -1;
330
      }
388
      }
331
      else  SendOutData('0' + dis_zeile,0,&DisplayBuff[20 * dis_zeile],20);   // DisplayZeile übertragen
389
      else  SendOutData('0' + RemotePollDisplayLine,0,(unsigned char *)&DisplayBuff[20 * RemotePollDisplayLine],20);   // DisplayZeile übertragen
332
         }
390
         }
333
    if(GetVersionAnforderung && UebertragungAbgeschlossen)
391
    if(GetVersionAnforderung && UebertragungAbgeschlossen)
334
     {
392
     {
335
      SendOutData('V',MeineSlaveAdresse,(unsigned char *) &VersionInfo,sizeof(VersionInfo));
393
      SendOutData('V',MeineSlaveAdresse,(unsigned char *) &VersionInfo,sizeof(VersionInfo));