Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 419 → Rev 420

/FollowMe/temp/FollowMe/gpx.c
276,28 → 276,31
 
if(doc == NULL) return(0);
 
// if((GPSData.Position.Status != INVALID) && (GPS_HomePosition.Status != INVALID))
if(GPSData.Position.Status != INVALID)
{
if(doc->state == GPX_DOC_TRACKSEGMENT_OPENED)
{
if(doc->file != NULL)
{
int32_t i32_1, i32_2;
int16_t i16_1;
int16_t i16_1, i16_2, i16_3;
uint8_t u8_1, u8_2;
// write <trkpt> tag
if(GPSData.Position.Latitude < 0) u8_1 = '-';
else u8_1 = '+';
i32_1 = abs(GPSData.Position.Latitude)/10000000L;
i32_2 = abs(GPSData.Position.Latitude)%10000000L;
sprintf(string, "<trkpt lat=\"%c%ld.%07ld\" ",u8_1, i32_1, i32_2);
i16_1 = abs((int16_t)(GPSData.Position.Latitude/10000000L));
i16_2 = abs((int16_t)((GPSData.Position.Latitude%10000000L)/10000L));
i16_3 = abs((int16_t)(((GPSData.Position.Latitude%10000000L)%10000L)/10L));
sprintf(string, "<trkpt lat=\"%c%d.%.3d%.3d\" ",u8_1, i16_1, i16_2, i16_3);
fputs_(string, doc->file);
 
if(GPSData.Position.Longitude < 0) u8_1 = '-';
else u8_1 = '+';
i32_1 = abs(GPSData.Position.Longitude)/10000000L;
i32_2 = abs(GPSData.Position.Longitude)%10000000L;
sprintf(string, "lon=\"%c%ld.%07ld\">\r\n",u8_1, i32_1, i32_2);
i16_1 = abs((int16_t)(GPSData.Position.Longitude/10000000L));
i16_2 = abs((int16_t)((GPSData.Position.Longitude%10000000L)/10000L));
i16_3 = abs((int16_t)(((GPSData.Position.Longitude%10000000L)%10000L)/10L));
sprintf(string, "<lon=\"%c%d.%.3d%.3d\" ",u8_1, i16_1, i16_2, i16_3);
fputs_(string, doc->file);
 
// write <time> tag only at a resolution of one second
sprintf(string, "<time>%04d-%02d-%02dT%02d:%02d:%02dZ</time>\r\n",SystemTime.Year, SystemTime.Month, SystemTime.Day, SystemTime.Hour, SystemTime.Min, SystemTime.Sec);
fputs_(string, doc->file);
308,11 → 311,11
sprintf(string, "<extensions>\r\n");
fputs_(string, doc->file);
// Course in deg
i16_1 = GPSData.Heading/100000L;
i16_1 = (int16_t)(GPSData.Heading/100000L);
sprintf(string, "<Course>%03d</Course>\r\n", i16_1);
fputs_(string, doc->file);
// Ground Speed in cm/s
sprintf(string, "<GroundSpeed>%d</GroundSpeed>\r\n", GPSData.Speed_Ground);
sprintf(string, "<GroundSpeed>%d</GroundSpeed>\r\n", (uint16_t)GPSData.Speed_Ground);
fputs_(string, doc->file);
// Ubat
u8_1 = UBat / 10;
319,7 → 322,7
u8_2 = UBat % 10;
sprintf(string, "<Voltage>%d.%01d</Voltage>\r\n", u8_1, u8_2);
fputs_(string, doc->file);
 
// eof extensions
sprintf(string, "</extensions>\r\n");
fputs_(string, doc->file);
/FollowMe/temp/FollowMe/kml.c
302,7 → 302,7
 
if(doc == NULL) return(0);
 
//if((GPSData.Position.Status != INVALID) && (GPS_HomePosition.Status != INVALID))
if(GPSData.Position.Status != INVALID)
{
if(doc->state == KML_DOC_LINESTRING_OPENED)
{
/FollowMe/temp/FollowMe/logging.c
59,7 → 59,7
#include "timer0.h"
#include "uart1.h"
#include "kml.h"
//#include "gpx.h"
#include "gpx.h"
#include "ssc.h"
#include "settings.h"
#include "printf_P.h"
78,7 → 78,7
 
// logger handler prototypes
logfilestate_t Logging_KML(uint16_t LogDelay);
//logfilestate_t Logging_GPX(uint16_t LogDelay);
logfilestate_t Logging_GPX(uint16_t LogDelay);
 
typedef struct
{
115,7 → 115,6
}
 
//----------------------------------------------------------------------------------------------------
/*
int8_t* GenerateGPXLogFileName(void)
{
static uint16_t filenum = 0; // file name counter
139,7 → 138,6
}
else return NULL;
}
*/
 
 
//----------------------------------------------------------------------------------------------------
267,13 → 265,12
}
 
//----------------------------------------------------------------------------------------------------
/*
// logs gps and state info to a gpx file
logfilestate_t Logging_GPX(uint16_t LogDelay)
{
static logfilestate_t logfilestate = LOGFILE_IDLE; // the current logfilestate
static int8_t* logfilename = NULL; // the pointer to the logfilename
static uint16_t logtimer = 0, flushtimer = 0; // the log update timer
static int8_t* logfilename = NULL; // the pointer to the logfilename
static uint16_t logtimer = 0, flushtimer = 0; // the log update timer
static GPX_Document_t logfile; // the logfilehandle
 
// initialize if LogDelay os zero
298,7 → 295,7
{
logtimer = SetDelay(LogDelay); // standard interval
 
//if(FC.MKFlags & MKFLAG_MOTOR_RUN)
if(SysState == STATE_SEND_FOLLOWME)
{
switch(logfilestate)
{
367,13 → 364,29
logfilestate = LOGFILE_IDLE;
break;
}
} // EOF model is flying
} // EOF follow me on
else // follow me off
{ // close log file if opened
if(logfilestate == LOGFILE_OPENED)
{
if(GPX_DocumentClose(&logfile))
{
printf("\r\nClosing gpx-file\r\n");
logfilestate = LOGFILE_CLOSED;
}
else // could not be closed
{
printf("\r\nError closing gpx-file\r\n");
logfilestate = LOGFILE_ERROR;
}
}
} //EOF follow me off
} // EOF Check LogTimer
 
return logfilestate;
}
*/
 
 
//----------------------------------------------------------------------------------------------------
// initialize logging
void Logging_Init(void)
381,9 → 394,9
LogCfg.KML_Interval = 500; //default
Settings_GetParamValue(PID_KML_LOGGING, (uint16_t*)&LogCfg.KML_Interval); // overwrite by settings value
Logging_KML(0); // initialize
//LogCfg.GPX_Interval = 1000; //default
//Settings_GetParamValue(PID_GPX_LOGGING, (uint16_t*)&LogCfg.GPX_Interval); // overwrite by settings value
//Logging_GPX(0); // initialize
LogCfg.GPX_Interval = 1000; //default
Settings_GetParamValue(PID_GPX_LOGGING, (uint16_t*)&LogCfg.GPX_Interval); // overwrite by settings value
Logging_GPX(0); // initialize
}
 
//----------------------------------------------------------------------------------------------------
401,7 → 414,7
logtimer = SetDelay(10); // faster makes no sense
// call the logger handlers if no error has occured
if(logstate != LOGFILE_ERROR) logstate = Logging_KML(LogCfg.KML_Interval);
//if(logstate != LOGFILE_ERROR) logstate = Logging_GPX(LogCfg.GPX_Interval);
if(logstate != LOGFILE_ERROR) logstate = Logging_GPX(LogCfg.GPX_Interval);
 
// a logging error has occured
if(logstate == LOGFILE_ERROR)
/FollowMe/temp/FollowMe/makefile
76,7 → 76,7
 
##########################################################################################################
# List C source files here. (C dependencies are automatically generated.)
SRC = main.c uart0.c uart1.c printf_P.c timer0.c menu.c led.c ubx.c analog.c button.c crc16.c ssc.c sdc.c fat16.c gps.c settings.c logging.c kml.c
SRC = main.c uart0.c uart1.c printf_P.c timer0.c menu.c led.c ubx.c analog.c button.c crc16.c ssc.c sdc.c fat16.c gps.c settings.c logging.c kml.c gpx.c
 
##########################################################################################################