Subversion Repositories FlightCtrl

Rev

Rev 655 | Rev 717 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 655 Rev 693
Line 28... Line 28...
28
unsigned char MeineSlaveAdresse;
28
unsigned char MeineSlaveAdresse;
29
unsigned char ConfirmFrame;
29
unsigned char ConfirmFrame;
30
struct str_DebugOut    DebugOut;
30
struct str_DebugOut    DebugOut;
31
struct str_ExternControl  ExternControl;
31
struct str_ExternControl  ExternControl;
32
struct str_VersionInfo VersionInfo;
32
struct str_VersionInfo VersionInfo;
-
 
33
struct str_WinkelOut WinkelOut;
-
 
34
 
33
int Debug_Timer;
35
int Debug_Timer,Kompass_Timer;
Line 34... Line 36...
34
 
36
 
35
const unsigned char ANALOG_TEXT[32][16] =
37
const unsigned char ANALOG_TEXT[32][16] =
36
{
38
{
37
   //1234567890123456 
39
   //1234567890123456 
Line 44... Line 46...
44
    "AccZ            ",
46
    "AccZ            ",
45
    "Gas             ",
47
    "Gas             ",
46
    "KompassValue    ",
48
    "KompassValue    ",
47
    "Spannung        ",
49
    "Spannung        ",
48
    "Empfang         ", //10
50
    "Empfang         ", //10
49
    "Analog11        ",
51
    "Ersatzkompass   ",
50
    "Motor_Vorne     ",
52
    "Motor_Vorne     ",
51
    "Motor_Hinten    ",
53
    "Motor_Hinten    ",
52
    "Motor_Links     ",
54
    "Motor_Links     ",
53
    "Motor_Rechts    ", //15
55
    "Motor_Rechts    ", //15
54
    "Acc_Z           ",
56
    "Acc_Z           ",
Line 220... Line 222...
220
// --------------------------------------------------------------------------
222
// --------------------------------------------------------------------------
221
void BearbeiteRxDaten(void)
223
void BearbeiteRxDaten(void)
222
{
224
{
223
 if(!NeuerDatensatzEmpfangen) return;
225
 if(!NeuerDatensatzEmpfangen) return;
Line 224... Line 226...
224
 
226
 
225
// unsigned int tmp_int_arr1[1];
227
 unsigned int tmp_int_arr1[1];
226
// unsigned int tmp_int_arr2[2];
228
// unsigned int tmp_int_arr2[2];
227
// unsigned int tmp_int_arr3[3];
229
// unsigned int tmp_int_arr3[3];
228
 unsigned char tmp_char_arr2[2];
230
 unsigned char tmp_char_arr2[2];
229
// unsigned char tmp_char_arr3[3];
231
// unsigned char tmp_char_arr3[3];
230
// unsigned char tmp_char_arr4[4];
232
// unsigned char tmp_char_arr4[4];
231
 //if(!MotorenEin) 
-
 
232
 PcZugriff = 255;
233
 //if(!MotorenEin) 
233
  switch(RxdBuffer[2])
234
  switch(RxdBuffer[2])
-
 
235
  {
-
 
236
   case 'K':// Kompasswert
-
 
237
            Decode64((unsigned char *) &tmp_int_arr1[0],sizeof(tmp_int_arr1),3,AnzahlEmpfangsBytes);
-
 
238
            KompassValue = tmp_int_arr1[0];
-
 
239
            KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
234
  {
240
                        break;
235
   case 'a':// Texte der Analogwerte
241
   case 'a':// Texte der Analogwerte
236
            Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes);
242
            Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes);
-
 
243
            DebugTextAnforderung = tmp_char_arr2[0];
237
            DebugTextAnforderung = tmp_char_arr2[0];
244
            PcZugriff = 255;
238
                        break;
245
                        break;
239
   case 'b':
246
   case 'b':
240
                        Decode64((unsigned char *) &ExternControl,sizeof(ExternControl),3,AnzahlEmpfangsBytes);
247
                        Decode64((unsigned char *) &ExternControl,sizeof(ExternControl),3,AnzahlEmpfangsBytes);
241
                        RemoteTasten |= ExternControl.RemoteTasten;
248
                        RemoteTasten |= ExternControl.RemoteTasten;
Line 244... Line 251...
244
   case 'c':
251
   case 'c':
245
                        Decode64((unsigned char *) &ExternControl,sizeof(ExternControl),3,AnzahlEmpfangsBytes);
252
                        Decode64((unsigned char *) &ExternControl,sizeof(ExternControl),3,AnzahlEmpfangsBytes);
246
                        RemoteTasten |= ExternControl.RemoteTasten;
253
                        RemoteTasten |= ExternControl.RemoteTasten;
247
            ConfirmFrame = ExternControl.Frame;
254
            ConfirmFrame = ExternControl.Frame;
248
            DebugDataAnforderung = 1;
255
            DebugDataAnforderung = 1;
-
 
256
            PcZugriff = 255;
249
            break;
257
            break;
250
   case 'h':// x-1 Displayzeilen
258
   case 'h':// x-1 Displayzeilen
251
            Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes);
259
            Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes);
252
            RemoteTasten |= tmp_char_arr2[0];
260
            RemoteTasten |= tmp_char_arr2[0];
253
                        if(tmp_char_arr2[1] == 255) NurKanalAnforderung = 1; else NurKanalAnforderung = 0; // keine Displaydaten
261
                        if(tmp_char_arr2[1] == 255) NurKanalAnforderung = 1; else NurKanalAnforderung = 0; // keine Displaydaten
254
                        DebugDisplayAnforderung = 1;
262
                        DebugDisplayAnforderung = 1;
255
                        break;
263
                        break;
256
   case 't':// Motortest
264
   case 't':// Motortest
257
            Decode64((unsigned char *) &MotorTest[0],sizeof(MotorTest),3,AnzahlEmpfangsBytes);
265
            Decode64((unsigned char *) &MotorTest[0],sizeof(MotorTest),3,AnzahlEmpfangsBytes);
-
 
266
            PcZugriff = 255;
258
                        break;
267
                        break;
259
   case 'k':// Keys von DubWise
268
   case 'k':// Keys von DubWise
260
            Decode64((unsigned char *) &DubWiseKeys[0],sizeof(DubWiseKeys),3,AnzahlEmpfangsBytes);
269
            Decode64((unsigned char *) &DubWiseKeys[0],sizeof(DubWiseKeys),3,AnzahlEmpfangsBytes);
261
                        ConfirmFrame = DubWiseKeys[3];
270
                        ConfirmFrame = DubWiseKeys[3];
-
 
271
            PcZugriff = 255;
262
                        break;
272
                        break;
263
   case 'v': // Version-Anforderung     und Ausbaustufe
273
   case 'v': // Version-Anforderung     und Ausbaustufe
264
            GetVersionAnforderung = 1;
274
            GetVersionAnforderung = 1;
265
            break;                                                               
275
            break;                                                               
266
   case 'g':// "Get"-Anforderung für Debug-Daten 
276
   case 'g':// "Get"-Anforderung für Debug-Daten 
Line 343... Line 353...
343
        //UBRR = 33;
353
        //UBRR = 33;
344
        //öffnet einen Kanal für printf (STDOUT)
354
        //öffnet einen Kanal für printf (STDOUT)
345
        //fdevopen (uart_putchar, 0);
355
        //fdevopen (uart_putchar, 0);
346
        //sbi(PORTD,4);
356
        //sbi(PORTD,4);
347
  Debug_Timer = SetDelay(200);  
357
  Debug_Timer = SetDelay(200);  
-
 
358
  Kompass_Timer = SetDelay(220);  
348
}
359
}
Line 349... Line 360...
349
 
360
 
350
//---------------------------------------------------------------------------------------------
361
//---------------------------------------------------------------------------------------------
351
void DatenUebertragung(void)  
362
void DatenUebertragung(void)  
Line 356... Line 367...
356
   {
367
   {
357
      SendOutData('G',MeineSlaveAdresse,(unsigned char *) &ExternControl,sizeof(ExternControl));
368
      SendOutData('G',MeineSlaveAdresse,(unsigned char *) &ExternControl,sizeof(ExternControl));
358
          DebugGetAnforderung = 0;
369
          DebugGetAnforderung = 0;
359
   }
370
   }
Line -... Line 371...
-
 
371
 
-
 
372
    if((CheckDelay(Kompass_Timer)) && UebertragungAbgeschlossen)        
-
 
373
         {
-
 
374
                  WinkelOut.Winkel[0] =  IntegralNick / 1024;  // etwa in Grad
-
 
375
                  WinkelOut.Winkel[1] =  IntegralRoll / 1024;  // etwa in Grad
-
 
376
          SendOutData('w',MeineSlaveAdresse,(unsigned char *) &WinkelOut,sizeof(WinkelOut));
-
 
377
          Kompass_Timer = SetDelay(99);  
-
 
378
         }
360
 
379
 
361
    if((CheckDelay(Debug_Timer) || DebugDataAnforderung) && UebertragungAbgeschlossen)  
380
    if((CheckDelay(Debug_Timer) || DebugDataAnforderung) && UebertragungAbgeschlossen)  
362
         {
381
         {
363
          SendOutData('D',MeineSlaveAdresse,(unsigned char *) &DebugOut,sizeof(DebugOut));
382
          SendOutData('D',MeineSlaveAdresse,(unsigned char *) &DebugOut,sizeof(DebugOut));
364
          DebugDataAnforderung = 0;
383
          DebugDataAnforderung = 0;