Subversion Repositories NaviCtrl

Rev

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

Rev 414 Rev 419
Line 334... Line 334...
334
                                // todo: add  <extensions> tag with additional data to be logged
334
                                // todo: add  <extensions> tag with additional data to be logged
335
                                sprintf(string, "<extensions>\r\n");
335
                                sprintf(string, "<extensions>\r\n");
336
                                fputs_(string, doc->file);
336
                                fputs_(string, doc->file);
337
                           break;
337
                           break;
338
                           case 2:
338
                           case 2:
339
                                // Altimeter according to air pressure
339
                                // Flight duration
340
                                sprintf(string, "<Altimeter>%d,'%c'</Altimeter>\r\n", NaviData.Altimeter,FromFC_VarioCharacter);
340
                                sprintf(string, "<FlightTime>%d</FlightTime>\r\n", NaviData.FlyingTime);
341
                                fputs_(string, doc->file);
341
                                fputs_(string, doc->file);
342
                                // Variometer according to air pressure
342
                            // Status of the complete MikroKopter
343
                                sprintf(string, "<Variometer>%d</Variometer>\r\n", NaviData.Variometer);
343
                                sprintf(string, "<ErrorCode>%03d</ErrorCode>\r\n",ErrorCode);
344
                                fputs_(string, doc->file);
344
                                fputs_(string, doc->file);
345
                                // Course in deg
345
                                // Flags
346
                                i16_1 = GPSData.Heading/100000L;
-
 
347
                                sprintf(string, "<Course>%03d</Course>\r\n", i16_1);
346
                                sprintf(string, "<FCFlags2>0x%02x,0x%02x</FCFlags2>\r\n",Logging_FCStatusFlags1,Logging_FCStatusFlags2);
348
                                fputs_(string, doc->file);
347
                                fputs_(string, doc->file);
-
 
348
                                Logging_FCStatusFlags1 = 0;
-
 
349
                                Logging_FCStatusFlags2 = 0;
349
                                // Ground Speed in cm/s
350
                                // NC Mode (contains the status)
350
                                sprintf(string, "<GroundSpeed>%d</GroundSpeed>\r\n", NaviData.GroundSpeed);
351
                                sprintf(string, "<NCFlag>0x%02X</NCFlag>\r\n", NCFlags);
351
                                fputs_(string, doc->file);
352
                                fputs_(string, doc->file);
352
                                // Vertical Speed in cm/s
353
                                // Altimeter according to air pressure
353
                                sprintf(string, "<VerticalSpeed>%d</VerticalSpeed>\r\n", NaviData.TopSpeed);
354
                                sprintf(string, "<Altimeter>%d,'%c'</Altimeter>\r\n", NaviData.Altimeter,FromFC_VarioCharacter);
354
                                fputs_(string, doc->file);
355
                                fputs_(string, doc->file);
355
                                // Flight duration
356
                                // Variometer according to air pressure
356
                                sprintf(string, "<FlightTime>%d</FlightTime>\r\n", NaviData.FlyingTime);
357
                                sprintf(string, "<Variometer>%d</Variometer>\r\n", NaviData.Variometer);
357
                                fputs_(string, doc->file);
358
                                fputs_(string, doc->file);
358
                           break;
359
                           break;
359
                           case 3:
360
                           case 3:
360
                                // Ubat
361
                                // Ubat
361
                                u8_1 = NaviData.UBat / 10;
362
                                u8_1 = NaviData.UBat / 10;
Line 368... Line 369...
368
                                sprintf(string, "<Current>%d.%01d</Current>\r\n", u8_1, u8_2);
369
                                sprintf(string, "<Current>%d.%01d</Current>\r\n", u8_1, u8_2);
369
                                fputs_(string, doc->file);
370
                                fputs_(string, doc->file);
370
                                // Capacity
371
                                // Capacity
371
                                sprintf(string, "<Capacity>%d</Capacity>\r\n", NaviData.UsedCapacity);
372
                                sprintf(string, "<Capacity>%d</Capacity>\r\n", NaviData.UsedCapacity);
372
                                fputs_(string, doc->file);
373
                                fputs_(string, doc->file);
373
                                // RC Quality
-
 
374
                                sprintf(string, "<RCQuality>%d</RCQuality>\r\n", FC.RC_Quality);
-
 
375
                                fputs_(string, doc->file);
-
 
376
                                // RC Received Signal Strength Indication
-
 
377
                           break;
374
                           break;
378
                           case 4:
375
                           case 4:
379
                                if(FC.RC_RSSI)
376
/*                              if(FC.RC_RSSI)
380
                                {
377
                                {
381
                                 sprintf(string, "<RCRSSI>%d</RCRSSI>\r\n", FC.RC_RSSI);
378
                                 sprintf(string, "<RCRSSI>%d</RCRSSI>\r\n", FC.RC_RSSI);
382
                                 fputs_(string, doc->file);
379
                                 fputs_(string, doc->file);
383
                                }
380
                                }
384
                                // Compassind deg
381
*/                              // Compassind deg
385
                                i16_1 = FromFlightCtrl.GyroHeading / 10;
382
                                i16_1 = FromFlightCtrl.GyroHeading / 10;
386
                                sprintf(string, "<Compass>%03d,%03d</Compass>\r\n", i16_1,ToFlightCtrl.CompassHeading);
383
                                sprintf(string, "<Compass>%03d,%03d</Compass>\r\n", i16_1,ToFlightCtrl.CompassHeading);
387
                                fputs_(string, doc->file);
384
                                fputs_(string, doc->file);
-
 
385
                                // magnetic field 
-
 
386
                                sprintf(string, "<MagnetField>%03d</MagnetField>\r\n",(u16) (EarthMagneticFieldFiltered/5));
-
 
387
                                fputs_(string, doc->file);
-
 
388
                                // magnetic inclination & error 
-
 
389
                                sprintf(string, "<MagnetInclination>%02d,%02d</MagnetInclination>\r\n",(s16)EarthMagneticInclinationFiltered/10,(s16)(EarthMagneticInclinationFiltered/10 - EarthMagneticInclinationTheoretic));
-
 
390
                                fputs_(string, doc->file);
388
                                // Nick Angle ind deg
391
                                // Nick Angle ind deg
389
                                sprintf(string, "<NickAngle>%03d</NickAngle>\r\n", NaviData.AngleNick);
392
                                sprintf(string, "<NickAngle>%03d</NickAngle>\r\n", NaviData.AngleNick);
390
                                fputs_(string, doc->file);
393
                                fputs_(string, doc->file);
391
                                // Roll Angle in deg
394
                                // Roll Angle in deg
392
                                sprintf(string, "<RollAngle>%03d</RollAngle>\r\n", NaviData.AngleRoll);
395
                                sprintf(string, "<RollAngle>%03d</RollAngle>\r\n", NaviData.AngleRoll);
393
                                fputs_(string, doc->file);
396
                                fputs_(string, doc->file);
394
                           break;
397
                           break;
395
                           case 5:
398
                           case 5:
396
                                // magnetic field 
-
 
397
                                sprintf(string, "<MagnetField>%03d</MagnetField>\r\n",(u16) (EarthMagneticFieldFiltered/5));
-
 
398
                                fputs_(string, doc->file);
-
 
399
                                // magnetic inclination & error 
-
 
400
                                sprintf(string, "<MagnetInclination>%02d,%02d</MagnetInclination>\r\n",(s16)EarthMagneticInclinationFiltered/10,(s16)(EarthMagneticInclinationFiltered/10 - EarthMagneticInclinationTheoretic));
-
 
401
                                fputs_(string, doc->file);
-
 
402
                                // BL Information
399
                                // BL Information
403
                                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);
400
                                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);
404
                                fputs_(string, doc->file);
401
                                fputs_(string, doc->file);
405
                                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);
402
                                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);
406
                                fputs_(string, doc->file);
403
                                fputs_(string, doc->file);
Line 412... Line 409...
412
                                fputs_(string, doc->file);
409
                                fputs_(string, doc->file);
413
*/                              sprintf(string, "<AvaiableMotorPower>%03d</AvaiableMotorPower>\r\n",BL_MinOfMaxPWM);
410
*/                              sprintf(string, "<AvaiableMotorPower>%03d</AvaiableMotorPower>\r\n",BL_MinOfMaxPWM);
414
                                fputs_(string, doc->file);
411
                                fputs_(string, doc->file);
415
                                sprintf(string, "<FC_I2C_ErrorCounter>%03d</FC_I2C_ErrorCounter>\r\n",(s16)FC_I2C_ErrorConter);
412
                                sprintf(string, "<FC_I2C_ErrorCounter>%03d</FC_I2C_ErrorCounter>\r\n",(s16)FC_I2C_ErrorConter);
416
                                fputs_(string, doc->file);
413
                                fputs_(string, doc->file);
-
 
414
                                sprintf(string, "<FC_SPI_ErrorCounter>%03d</FC_SPI_ErrorCounter>\r\n",(s16)DebugOut.Analog[12]);
-
 
415
                                fputs_(string, doc->file);
417
                                // Analog inputs of the NC
416
                                // Analog inputs of the NC
418
                                sprintf(string, "<AnalogInputs>%d,%d,%d,%d</AnalogInputs>\r\n",AnalogData.Ch4,AnalogData.Ch5,AnalogData.Ch6,AnalogData.Ch7);
417
                                sprintf(string, "<AnalogInputs>%d,%d,%d,%d</AnalogInputs>\r\n",AnalogData.Ch4,AnalogData.Ch5,AnalogData.Ch6,AnalogData.Ch7);
419
                                fputs_(string, doc->file);
418
                                fputs_(string, doc->file);
420
                                // NC Mode (contains the status)
-
 
421
                                sprintf(string, "<NCFlag>0x%02X</NCFlag>\r\n", NCFlags);
-
 
422
                                fputs_(string, doc->file);
-
 
423
                                sprintf(string, "<Servo>%d,%d,%d</Servo>\r\n", ServoParams.NickControl,ServoParams.RollControl,POI_KameraNick/10);      // Raw Poti-Values of the Servo control and the POI_Nick in 1°
419
                                sprintf(string, "<Servo>%d,%d,%d</Servo>\r\n", ServoParams.NickControl,ServoParams.RollControl,POI_KameraNick/10);      // Raw Poti-Values of the Servo control and the POI_Nick in 1°
424
                                fputs_(string, doc->file);
420
                                fputs_(string, doc->file);
Line 425... Line 421...
425
 
421
 
426
                                if(GPS_pWaypoint != NULL) // if WP exist
422
                                if(GPS_pWaypoint != NULL) // if WP exist
Line 434... Line 430...
434
                                 }
430
                                 }
435
                                sprintf(string, "<WP>%s,%d,%d,%d</WP>\r\n",name,NaviData.WaypointIndex,NaviData.WaypointNumber,FC_WP_EventChannel);      // x of y Waypoints and the actual value of the Event Channel
431
                                sprintf(string, "<WP>%s,%d,%d,%d</WP>\r\n",name,NaviData.WaypointIndex,NaviData.WaypointNumber,FC_WP_EventChannel);      // x of y Waypoints and the actual value of the Event Channel
436
                                fputs_(string, doc->file);
432
                                fputs_(string, doc->file);
437
                           break;
433
                           break;
438
                           case 7:
434
                           case 7:
439
                                // Flags
-
 
440
                                sprintf(string, "<FCFlags2>0x%02x,0x%02x</FCFlags2>\r\n",Logging_FCStatusFlags1,Logging_FCStatusFlags2);
-
 
441
                                fputs_(string, doc->file);
-
 
442
                                Logging_FCStatusFlags1 = 0;
-
 
443
                                Logging_FCStatusFlags2 = 0;
-
 
444
                                // Status of the complete MikroKopter
-
 
445
                                sprintf(string, "<ErrorCode>%03d</ErrorCode>\r\n",ErrorCode);
-
 
446
                                fputs_(string, doc->file);
-
 
447
                                // Target Bearing in deg
435
                                // Target Bearing in deg
448
                                sprintf(string, "<TargetBearing>%03d</TargetBearing>\r\n", NaviData.TargetPositionDeviation.Bearing);
436
                                sprintf(string, "<TargetBearing>%03d</TargetBearing>\r\n", NaviData.TargetPositionDeviation.Bearing);
449
                                fputs_(string, doc->file);
437
                                fputs_(string, doc->file);
450
                                // Target Distance in dm
438
                                // Target Distance in dm
451
                                sprintf(string, "<TargetDistance>%d</TargetDistance>\r\n", NaviData.TargetPositionDeviation.Distance);
439
                                sprintf(string, "<TargetDistance>%d</TargetDistance>\r\n", NaviData.TargetPositionDeviation.Distance);
452
                                fputs_(string, doc->file);
440
                                fputs_(string, doc->file);
-
 
441
                                // Course in deg
-
 
442
                                i16_1 = GPSData.Heading/100000L;
-
 
443
                                sprintf(string, "<Course>%03d</Course>\r\n", i16_1);
-
 
444
                                fputs_(string, doc->file);
-
 
445
                                // Ground Speed in cm/s
-
 
446
                                sprintf(string, "<GroundSpeed>%d</GroundSpeed>\r\n", NaviData.GroundSpeed);
-
 
447
                                fputs_(string, doc->file);
-
 
448
                                // Vertical Speed in cm/s
-
 
449
                                sprintf(string, "<VerticalSpeed>%d</VerticalSpeed>\r\n", NaviData.TopSpeed);
-
 
450
                                fputs_(string, doc->file);
453
                           break;
451
                           break;
454
                           case 8:
452
                           case 8:
455
                                // RC Sticks as Nick/Roll/Yaw
453
                                // RC Sticks as Nick/Roll/Yaw
456
                                sprintf(string, "<RCSticks>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</RCSticks>\r\n", FC.StickNick,FC.StickRoll, FC.StickYaw, FC.StickGas,FC.Poti[0],FC.Poti[1],FC.Poti[2],FC.Poti[3],FC.Poti[4],FC.Poti[5],FC.Poti[6],FC.Poti[7]);
454
                                sprintf(string, "<RCSticks>%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d</RCSticks>\r\n", FC.StickNick,FC.StickRoll, FC.StickYaw, FC.StickGas,FC.Poti[0],FC.Poti[1],FC.Poti[2],FC.Poti[3],FC.Poti[4],FC.Poti[5],FC.Poti[6],FC.Poti[7]);
457
                                fputs_(string, doc->file);
455
                                fputs_(string, doc->file);
458
                                // GPS Sticks as Nick/Roll/Yaw
456
                                // GPS Sticks as Nick/Roll/Yaw
459
                                sprintf(string, "<GPSSticks>%d,%d,%d,'%c'</GPSSticks>\r\n", ToFlightCtrl.GPSStick.Nick, ToFlightCtrl.GPSStick.Roll, ToFlightCtrl.GPSStick.Yaw,NC_GPS_ModeCharacter);
457
                                sprintf(string, "<GPSSticks>%d,%d,%d,'%c'</GPSSticks>\r\n", ToFlightCtrl.GPSStick.Nick, ToFlightCtrl.GPSStick.Roll, 0 ,NC_GPS_ModeCharacter);
460
                                fputs_(string, doc->file);
458
                                fputs_(string, doc->file);
-
 
459
                                // RC Quality
-
 
460
                                sprintf(string, "<RCQuality>%d</RCQuality>\r\n", FC.RC_Quality);
-
 
461
                                fputs_(string, doc->file);
-
 
462
                                // RC Received Signal Strength Indication
461
                                // eof extensions
463
                                // eof extensions
462
                                sprintf(string, "</extensions>\r\n");
464
                                sprintf(string, "</extensions>\r\n");
463
                                fputs_(string, doc->file);
465
                                fputs_(string, doc->file);
464
                                sprintf(string, "</trkpt>\r\n");
466
                                sprintf(string, "</trkpt>\r\n");
465
                                fputs_(string, doc->file);
467
                                fputs_(string, doc->file);