Subversion Repositories Projects

Rev

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

Rev 426 Rev 436
Line 57... Line 57...
57
#include <stdio.h>
57
#include <stdio.h>
58
#include "main.h"
58
#include "main.h"
59
#include "timer0.h"
59
#include "timer0.h"
60
#include "uart1.h"
60
#include "uart1.h"
61
#include "kml.h"
61
#include "kml.h"
62
//#include "gpx.h"
62
#include "gpx.h"
63
#include "ssc.h"
63
#include "ssc.h"
64
#include "settings.h"
64
#include "settings.h"
65
#include "printf_P.h"
65
#include "printf_P.h"
Line 113... Line 113...
113
        }
113
        }
114
        else return NULL;
114
        else return NULL;
115
}
115
}
Line 116... Line 116...
116
 
116
 
117
//----------------------------------------------------------------------------------------------------
117
//----------------------------------------------------------------------------------------------------
118
/*int8_t* GenerateGPXLogFileName(void)
118
int8_t* GenerateGPXLogFileName(void)
119
{
119
{
120
        static uint16_t filenum = 0;    // file name counter
120
        static uint16_t filenum = 0;    // file name counter
121
        static int8_t filename[35];
121
        static int8_t filename[35];
Line 135... Line 135...
135
                sprintf(filename, "LOG/%04i%02i%02i/GPX/GPS%05i.GPX", SystemTime.Year, SystemTime.Month, SystemTime.Day, filenum);
135
                sprintf(filename, "LOG/%04i%02i%02i/GPX/GPS%05i.GPX", SystemTime.Year, SystemTime.Month, SystemTime.Day, filenum);
136
                filenum++;
136
                filenum++;
137
                return filename;
137
                return filename;
138
        }
138
        }
139
        else return NULL;
139
        else return NULL;
140
}*/
140
}
Line 141... Line 141...
141
 
141
 
142
 
142
 
143
//----------------------------------------------------------------------------------------------------
143
//----------------------------------------------------------------------------------------------------
Line 147... Line 147...
147
        static  logfilestate_t logfilestate = LOGFILE_IDLE; // the current logfilestate
147
        static  logfilestate_t logfilestate = LOGFILE_IDLE; // the current logfilestate
148
        static  int8_t* logfilename = NULL;                                             // the pointer to the logfilename
148
        static  int8_t* logfilename = NULL;                                             // the pointer to the logfilename
149
        static  uint16_t logtimer = 0, flushtimer = 0;          // the log update timer
149
        static  uint16_t logtimer = 0, flushtimer = 0;          // the log update timer
150
        static  KML_Document_t logfile;                                         // the logfilehandle
150
        static  KML_Document_t logfile;                                         // the logfilehandle
Line 151... Line 151...
151
 
151
 
152
        // initialize if LogDelay os zero
152
        // initialize if LogDelay is zero
153
        if(!LogDelay)
153
        if(!LogDelay)
154
        {
154
        {
155
                switch(logfilestate)
155
                switch(logfilestate)
156
                {
156
                {
Line 263... Line 263...
263
 
263
 
264
        return logfilestate;
264
        return logfilestate;
Line 265... Line 265...
265
}
265
}
266
 
-
 
267
//----------------------------------------------------------------------------------------------------
266
 
268
/*
267
//----------------------------------------------------------------------------------------------------
269
// logs gps and state info to a gpx file
268
// logs gps and state info to a gpx file
270
logfilestate_t Logging_GPX(uint16_t LogDelay)
269
logfilestate_t Logging_GPX(uint16_t LogDelay)
271
{
270
{
Line 384... Line 383...
384
                } //EOF follow me off
383
                } //EOF follow me off
385
        } // EOF Check LogTimer
384
        } // EOF Check LogTimer
Line 386... Line 385...
386
 
385
 
387
        return logfilestate;
386
        return logfilestate;
388
}
-
 
Line 389... Line 387...
389
*/
387
}
390
 
388
 
391
//----------------------------------------------------------------------------------------------------
389
//----------------------------------------------------------------------------------------------------
392
// initialize logging
390
// initialize logging
393
void Logging_Init(void)
391
void Logging_Init(void)
394
{
392
{
395
        LogCfg.KML_Interval = 500; //default
393
        LogCfg.KML_Interval = 500; //default
396
        Settings_GetParamValue(PID_KML_LOGGING, (uint16_t*)&LogCfg.KML_Interval); // overwrite by settings value
394
        Settings_GetParamValue(PID_KML_LOGGING, &(LogCfg.KML_Interval)); // overwrite by settings value
397
        Logging_KML(0); // initialize
395
        printf("\r\nKML Interval = %d", LogCfg.KML_Interval);
398
        //LogCfg.GPX_Interval = 1000; //default
396
        LogCfg.GPX_Interval = 1000; //default
399
        //Settings_GetParamValue(PID_GPX_LOGGING, (uint16_t*)&LogCfg.GPX_Interval); // overwrite by settings value
397
        Settings_GetParamValue(PID_GPX_LOGGING, &(LogCfg.GPX_Interval)); // overwrite by settings value
Line 400... Line 398...
400
        //Logging_GPX(0);       // initialize
398
        Logging_GPX(0); // initialize
401
}
399
}
402
 
400
 
Line 413... Line 411...
413
                if(CheckDelay(logtimer))
411
                if(CheckDelay(logtimer))
414
                {
412
                {
415
                        logtimer = SetDelay(10);  // faster makes no sense
413
                        logtimer = SetDelay(10);  // faster makes no sense
416
                        // call the logger handlers if no error has occured
414
                        // call the logger handlers if no error has occured
417
                        if(logstate != LOGFILE_ERROR) logstate = Logging_KML(LogCfg.KML_Interval);
415
                        if(logstate != LOGFILE_ERROR) logstate = Logging_KML(LogCfg.KML_Interval);
418
                        //if(logstate != LOGFILE_ERROR) logstate = Logging_GPX(LogCfg.GPX_Interval);
416
                        if(logstate != LOGFILE_ERROR) logstate = Logging_GPX(LogCfg.GPX_Interval);
Line 419... Line 417...
419
 
417
 
420
                        // a logging error has occured
418
                        // a logging error has occured
421
                        if(logstate == LOGFILE_ERROR)
419
                        if(logstate == LOGFILE_ERROR)
422
                        {
420
                        {