Subversion Repositories NaviCtrl

Rev

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

Rev 510 Rev 530
Line 96... Line 96...
96
//________________________________________________________________________________________________________________________________________
96
//________________________________________________________________________________________________________________________________________
Line 97... Line 97...
97
 
97
 
98
 
98
 
99
u8 GPX_DocumentOpen(s8 *name, GPX_Document_t *doc)
99
u8 GPX_DocumentOpen(s8 *name, GPX_Document_t *doc)
100
{
100
{
-
 
101
        s8 string[100];
Line 101... Line 102...
101
        s8 string[60];
102
        u8 retvalue = 0;
102
        u8 retvalue = 0;
103
        u8 BLv = 1;
103
 
104
 
Line -... Line 105...
-
 
105
        if(doc == NULL) return(0);
-
 
106
        GPX_DocumentInit(doc);                                                                                                          // intialize the document with resetvalues
-
 
107
        doc->file = fopen_(name,'a');                                                                                           // open a new file with the specified filename on the memorycard.
104
        if(doc == NULL) return(0);
108
 
105
        GPX_DocumentInit(doc);                                                                                                          // intialize the document with resetvalues
109
        if(Motor_Version[0] & MOTOR_STATE_BL30) BLv = 3;
106
        doc->file = fopen_(name,'a');                                                                                           // open a new file with the specified filename on the memorycard.
110
        else if(Motor_Version[0] & MOTOR_STATE_NEW_PROTOCOL_MASK) BLv = 2;
107
 
111
 
108
        if(doc->file != NULL)                                                                                                           // could the file be opened?
112
        if(doc->file != NULL)                                                                                                           // could the file be opened?
109
        {
113
        {
-
 
114
                retvalue = 1;                                                                                                                   // the document could be created on the drive.
-
 
115
                doc->state = GPX_DOC_OPENED;                                                                                            // change document state to opened. At next a placemark has to be opened.
-
 
116
                fwrite_((void*)GPX_DOCUMENT_HEADER1, sizeof(GPX_DOCUMENT_HEADER1)-1,1,doc->file);// write the gpx-header to the document.
110
                retvalue = 1;                                                                                                                   // the document could be created on the drive.
117
                sprintf(string, "<desc>FC HW:%d.%d SW:%d.%02d%c + NC HW:%d.%d SW:%d.%02d%c BL:V%d", (FC_Version.Hardware & 0x7F)/10,(FC_Version.Hardware & 0x7F)%10, FC_Version.Major, FC_Version.Minor, 'a'+FC_Version.Patch, UART_VersionInfo.HWMajor/10, UART_VersionInfo.HWMajor%10, VERSION_MAJOR,  VERSION_MINOR, 'a'+ VERSION_PATCH,BLv);
111
                doc->state = GPX_DOC_OPENED;                                                                                            // change document state to opened. At next a placemark has to be opened.
118
                fputs_(string, doc->file);
112
                fwrite_((void*)GPX_DOCUMENT_HEADER1, sizeof(GPX_DOCUMENT_HEADER1)-1,1,doc->file);// write the gpx-header to the document.
119
                if(FC.RedundanceBlOperation) sprintf(string, " (Redundant)</desc>\r\n");
113
                sprintf(string, "<desc>FC HW:%d.%d SW:%d.%02d%c + NC HW:%d.%d SW:%d.%02d%c</desc>\r\n", (FC_Version.Hardware & 0x7F)/10,(FC_Version.Hardware & 0x7F)%10, FC_Version.Major, FC_Version.Minor, 'a'+FC_Version.Patch, Version_HW/10, Version_HW%10, VERSION_MAJOR,  VERSION_MINOR, 'a'+ VERSION_PATCH);
120
                else sprintf(string, "</desc>\r\n");
114
                fputs_(string, doc->file);
121
                fputs_(string, doc->file);
115
                fwrite_((void*)GPX_DOCUMENT_HEADER2, sizeof(GPX_DOCUMENT_HEADER2)-1,1,doc->file);// write the gpx-header to the document.
122
                fwrite_((void*)GPX_DOCUMENT_HEADER2, sizeof(GPX_DOCUMENT_HEADER2)-1,1,doc->file);// write the gpx-header to the document.
116
        }
123
        }
-
 
124
        Logging_FCStatusFlags1 = 0;
117
        Logging_FCStatusFlags1 = 0;
125
        Logging_FCStatusFlags2 = 0;
118
        Logging_FCStatusFlags2 = 0;
126
    Logged_GPX_Counter = 0;
Line 119... Line 127...
119
    Logged_GPX_Counter = 0;
127
        LogFC_WP_EventChannel = 0;
120
        LogFC_WP_EventChannel = 0;
128
        Logging_BL_MinOfMaxPWM = BL_MinOfMaxPWM;
Line 284... Line 292...
284
 
292
 
285
u8 GPX_TrackSegementAddPoint(GPX_Document_t *doc,unsigned char part)
293
u8 GPX_TrackSegementAddPoint(GPX_Document_t *doc,unsigned char part)
Line 286... Line 294...
286
{
294
{
287
 
295
 
288
        u8 retvalue = 0;
296
        u8 retvalue = 0;
Line 289... Line 297...
289
        s8 string[100];
297
        s8 string[120];
Line 290... Line 298...
290
        s8 name[] = "----\0";
298
        s8 name[] = "----\0";
Line 404... Line 412...
404
                                sprintf(string, "<RollAngle>%03d</RollAngle>\r\n", NaviData.AngleRoll);
412
                                sprintf(string, "<RollAngle>%03d</RollAngle>\r\n", NaviData.AngleRoll);
405
                                fputs_(string, doc->file);
413
                                fputs_(string, doc->file);
406
                           break;
414
                           break;
407
                           case 5:
415
                           case 5:
408
                                // BL Information
416
                                // BL Information
-
 
417
                switch(AmountOfMotors)
-
 
418
                                 {
-
 
419
                                  case 4:
-
 
420
                                                sprintf(string, "<MotorCurrent>%d,%d,%d,%d</MotorCurrent>\r\n",BL3_Current(0),BL3_Current(1),BL3_Current(2),BL3_Current(3));
-
 
421
                                                fputs_(string, doc->file);
-
 
422
                                                sprintf(string, "<BL_Temperature>%d,%d,%d,%d</BL_Temperature>\r\n",Motor[0].Temperature,Motor[1].Temperature,Motor[2].Temperature,Motor[3].Temperature);
-
 
423
                                                fputs_(string, doc->file);
-
 
424
                                                sprintf(string, "<MotorNOK>%d,%d,%d,%d</MotorNOK>\r\n",Motor[0].NotReadyCnt,Motor[1].NotReadyCnt,Motor[2].NotReadyCnt,Motor[3].NotReadyCnt);
-
 
425
                                                fputs_(string, doc->file);
-
 
426
                                                break;
-
 
427
                                  case 6:
-
 
428
                                                sprintf(string, "<MotorCurrent>%d,%d,%d,%d,%d,%d</MotorCurrent>\r\n",BL3_Current(0),BL3_Current(1),BL3_Current(2),BL3_Current(3),BL3_Current(4),BL3_Current(5));
-
 
429
                                                fputs_(string, doc->file);
-
 
430
                                                sprintf(string, "<BL_Temperature>%d,%d,%d,%d,%d,%d</BL_Temperature>\r\n",Motor[0].Temperature,Motor[1].Temperature,Motor[2].Temperature,Motor[3].Temperature,Motor[4].Temperature,Motor[5].Temperature);
-
 
431
                                                fputs_(string, doc->file);
-
 
432
                                                sprintf(string, "<MotorNOK>%d,%d,%d,%d,%d,%d</MotorNOK>\r\n",Motor[0].NotReadyCnt,Motor[1].NotReadyCnt,Motor[2].NotReadyCnt,Motor[3].NotReadyCnt,Motor[4].NotReadyCnt,Motor[5].NotReadyCnt);
-
 
433
                                                fputs_(string, doc->file);
-
 
434
                                                break;
-
 
435
                                  case 8:
-
 
436
                                                sprintf(string, "<MotorCurrent>%d,%d,%d,%d,%d,%d,%d,%d</MotorCurrent>\r\n",BL3_Current(0),BL3_Current(1),BL3_Current(2),BL3_Current(3),BL3_Current(4),BL3_Current(5),BL3_Current(6),BL3_Current(7));
-
 
437
                                                fputs_(string, doc->file);
409
//                              sprintf(string, "<MotorCurrent>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</MotorCurrent>\r\n",Motor[0].Current,Motor[1].Current,Motor[2].Current,Motor[3].Current,Motor[4].Current,Motor[5].Current,Motor[6].Current,Motor[7].Current,Motor[8].Current,Motor[9].Current,Motor[10].Current,Motor[11].Current);
438
                                                sprintf(string, "<BL_Temperature>%d,%d,%d,%d,%d,%d,%d,%d</BL_Temperature>\r\n",Motor[0].Temperature,Motor[1].Temperature,Motor[2].Temperature,Motor[3].Temperature,Motor[4].Temperature,Motor[5].Temperature,Motor[6].Temperature,Motor[7].Temperature);
-
 
439
                                                fputs_(string, doc->file);
-
 
440
                                                sprintf(string, "<MotorNOK>%d,%d,%d,%d,%d,%d,%d,%d</MotorNOK>\r\n",Motor[0].NotReadyCnt,Motor[1].NotReadyCnt,Motor[2].NotReadyCnt,Motor[3].NotReadyCnt,Motor[4].NotReadyCnt,Motor[5].NotReadyCnt,Motor[6].NotReadyCnt,Motor[7].NotReadyCnt);
-
 
441
                                                fputs_(string, doc->file);
-
 
442
                                                break;
-
 
443
                                  default:
410
                                sprintf(string, "<MotorCurrent>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</MotorCurrent>\r\n",BL3_Current(0),BL3_Current(1),BL3_Current(2),BL3_Current(3),BL3_Current(4),BL3_Current(5),BL3_Current(6),BL3_Current(7),BL3_Current(8),BL3_Current(9),BL3_Current(10),BL3_Current(11));
444
                                                sprintf(string, "<MotorCurrent>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</MotorCurrent>\r\n",BL3_Current(0),BL3_Current(1),BL3_Current(2),BL3_Current(3),BL3_Current(4),BL3_Current(5),BL3_Current(6),BL3_Current(7),BL3_Current(8),BL3_Current(9),BL3_Current(10),BL3_Current(11));
-
 
445
                                                fputs_(string, doc->file);
411
                                fputs_(string, doc->file);
446
                                                sprintf(string, "<BL_Temperature>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</BL_Temperature>\r\n",Motor[0].Temperature,Motor[1].Temperature,Motor[2].Temperature,Motor[3].Temperature,Motor[4].Temperature,Motor[5].Temperature,Motor[6].Temperature,Motor[7].Temperature,Motor[8].Temperature,Motor[9].Temperature,Motor[10].Temperature,Motor[11].Temperature);
412
                                sprintf(string, "<BL_Temperature>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</BL_Temperature>\r\n",Motor[0].Temperature,Motor[1].Temperature,Motor[2].Temperature,Motor[3].Temperature,Motor[4].Temperature,Motor[5].Temperature,Motor[6].Temperature,Motor[7].Temperature,Motor[8].Temperature,Motor[9].Temperature,Motor[10].Temperature,Motor[11].Temperature);
447
                                                fputs_(string, doc->file);
413
                                fputs_(string, doc->file);
448
                                                sprintf(string, "<MotorNOK>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</MotorNOK>\r\n",Motor[0].NotReadyCnt,Motor[1].NotReadyCnt,Motor[2].NotReadyCnt,Motor[3].NotReadyCnt,Motor[4].NotReadyCnt,Motor[5].NotReadyCnt,Motor[6].NotReadyCnt,Motor[7].NotReadyCnt,Motor[8].NotReadyCnt,Motor[9].NotReadyCnt,Motor[10].NotReadyCnt,Motor[11].NotReadyCnt);
-
 
449
                                                fputs_(string, doc->file);
-
 
450
                                                break;
-
 
451
                                  }
414
                           break;
452
                           break;
415
                           case 6:
453
                           case 6:
416
/*                              sprintf(string, "<BL_State>0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x</BL_State>\r\n",Motor.State[0],Motor.State[1],Motor.State[2],Motor.State[3],Motor.State[4],Motor.State[5],Motor.State[6],Motor.State[7],Motor.State[8],Motor.State[9],Motor.State[10],Motor.State[11]);
454
/*                              sprintf(string, "<BL_State>0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x</BL_State>\r\n",Motor.State[0],Motor.State[1],Motor.State[2],Motor.State[3],Motor.State[4],Motor.State[5],Motor.State[6],Motor.State[7],Motor.State[8],Motor.State[9],Motor.State[10],Motor.State[11]);
417
                                fputs_(string, doc->file);
455
                                fputs_(string, doc->file);
418
                                sprintf(string, "<BL_MaxPWM>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</BL_MaxPWM>\r\n",Motor.MaxPWM[0],Motor.MaxPWM[1],Motor.MaxPWM[2],Motor.MaxPWM[3],Motor.MaxPWM[4],Motor.MaxPWM[5],Motor.MaxPWM[6],Motor.MaxPWM[7],Motor.MaxPWM[8],Motor.MaxPWM[9],Motor.MaxPWM[10],Motor.MaxPWM[11]);
456
                                sprintf(string, "<BL_MaxPWM>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</BL_MaxPWM>\r\n",Motor.MaxPWM[0],Motor.MaxPWM[1],Motor.MaxPWM[2],Motor.MaxPWM[3],Motor.MaxPWM[4],Motor.MaxPWM[5],Motor.MaxPWM[6],Motor.MaxPWM[7],Motor.MaxPWM[8],Motor.MaxPWM[9],Motor.MaxPWM[10],Motor.MaxPWM[11]);
419
                                fputs_(string, doc->file);
457
                                fputs_(string, doc->file);
420
*/                              sprintf(string, "<AvaiableMotorPower>%03d</AvaiableMotorPower>\r\n",BL_MinOfMaxPWM);
458
*/                              sprintf(string, "<AvaiableMotorPower>%03d</AvaiableMotorPower>\r\n",Logging_BL_MinOfMaxPWM);
-
 
459
                                Logging_BL_MinOfMaxPWM = BL_MinOfMaxPWM;
421
                                fputs_(string, doc->file);
460
                                fputs_(string, doc->file);
422
                                sprintf(string, "<FC_I2C_ErrorCounter>%03d</FC_I2C_ErrorCounter>\r\n",(s16)FC_I2C_ErrorConter);
461
                                sprintf(string, "<FC_I2C_ErrorCounter>%03d</FC_I2C_ErrorCounter>\r\n",(s16)FC_I2C_ErrorConter);
423
                                fputs_(string, doc->file);
462
                                fputs_(string, doc->file);
424
                                sprintf(string, "<FC_SPI_ErrorCounter>%03d</FC_SPI_ErrorCounter>\r\n",(s16)DebugOut.Analog[12]);
463
                                sprintf(string, "<FC_SPI_ErrorCounter>%03d</FC_SPI_ErrorCounter>\r\n",(s16)DebugOut.Analog[12]);
425
                                fputs_(string, doc->file);
464
                                fputs_(string, doc->file);