Subversion Repositories NaviCtrl

Rev

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

Rev 429 Rev 432
Line 65... Line 65...
65
#include "led.h"
65
#include "led.h"
66
#include "logging.h"
66
#include "logging.h"
Line 67... Line 67...
67
 
67
 
68
#define MIN_SD_INTERVAL_KML  200
68
#define MIN_SD_INTERVAL_KML  200
-
 
69
#define MIN_SD_INTERVAL_GPX  500
Line 69... Line 70...
69
#define MIN_SD_INTERVAL_GPX  500
70
#define APPEND_LOG_TIME_MS  5000 // log some more time
Line 70... Line 71...
70
 
71
 
Line 149... Line 150...
149
{
150
{
150
        static  logfilestate_t logfilestate = LOGFILE_IDLE; // the current logfilestate
151
        static  logfilestate_t logfilestate = LOGFILE_IDLE; // the current logfilestate
151
        static  s8* logfilename = NULL;                                         // the pointer to the logfilename
152
        static  s8* logfilename = NULL;                                         // the pointer to the logfilename
152
        static  u32 logtimer = 0, flushtimer = 0;               // the log update timer
153
        static  u32 logtimer = 0, flushtimer = 0;               // the log update timer
153
        static  KML_Document_t logfile;                                         // the logfilehandle
154
        static  KML_Document_t logfile;                                         // the logfilehandle
-
 
155
        static  u32 appendtimer = 0;            // the log update timer
-
 
156
        static  u8 logging_active = 0;
Line 154... Line 157...
154
 
157
 
155
        // initialize if LogDelay is zero
158
        // initialize if LogDelay is zero
156
        if(!LogDelay)
159
        if(!LogDelay)
157
        {
160
        {
Line 172... Line 175...
172
        // no init
175
        // no init
173
        if(CheckDelay(logtimer))
176
        if(CheckDelay(logtimer))
174
        {
177
        {
175
                logtimer = SetDelay(LogDelay);  // standard interval
178
                logtimer = SetDelay(LogDelay);  // standard interval
Line 176... Line 179...
176
 
179
 
-
 
180
                if(FC.StatusFlags & FC_STATUS_MOTOR_RUN)
-
 
181
                 {
-
 
182
                  logging_active = 1;
-
 
183
                  appendtimer = SetDelay(APPEND_LOG_TIME_MS);
-
 
184
                 }
-
 
185
                else
-
 
186
                 {
-
 
187
                  if(CheckDelay(appendtimer)) logging_active = 0;
-
 
188
                 }
-
 
189
 
177
                if(FC.StatusFlags & FC_STATUS_MOTOR_RUN)
190
                if(logging_active)
178
                {
191
                {
179
                        switch(logfilestate)
192
                        switch(logfilestate)
180
                        {
193
                        {
181
                                case LOGFILE_IDLE:
194
                                case LOGFILE_IDLE:
Line 279... Line 292...
279
// logs gps and state info to a gpx file
292
// logs gps and state info to a gpx file
280
logfilestate_t Logging_GPX(u32 LogDelay)
293
logfilestate_t Logging_GPX(u32 LogDelay)
281
{
294
{
282
        static  logfilestate_t logfilestate = LOGFILE_IDLE; // the current logfilestate
295
        static  logfilestate_t logfilestate = LOGFILE_IDLE; // the current logfilestate
283
        static  s8* logfilename = NULL;                                         // the pointer to the logfilename
296
        static  s8* logfilename = NULL;                                         // the pointer to the logfilename
284
        static  u32 logtimer = 0, flushtimer = 0;               // the log update timer
297
        static  u32 logtimer = 0, flushtimer = 0, appendtimer = 0;              // the log update timer
285
        static  GPX_Document_t logfile;                                         // the logfilehandle
298
        static  GPX_Document_t logfile;                                         // the logfilehandle
286
        static  u8 part = 0;
299
        static  u8 part = 0, logging_active = 0;
287
        u32 measure_time;
300
        u32 measure_time;
Line 288... Line 301...
288
 
301
 
289
        // initialize if LogDelay is zero
302
        // initialize if LogDelay is zero
290
        if(!LogDelay)
303
        if(!LogDelay)
Line 306... Line 319...
306
        // no init
319
        // no init
307
        if(CheckDelay(logtimer) || part)
320
        if(CheckDelay(logtimer) || part)
308
        {
321
        {
309
                if(!part) logtimer = SetDelay(LogDelay);        // standard interval
322
                if(!part) logtimer = SetDelay(LogDelay);        // standard interval
Line 310... Line 323...
310
 
323
 
-
 
324
                if(FC.StatusFlags & FC_STATUS_MOTOR_RUN)
-
 
325
                 {
-
 
326
                  logging_active = 1;
-
 
327
                  appendtimer = SetDelay(APPEND_LOG_TIME_MS);
-
 
328
                 }
-
 
329
                else
-
 
330
                 {
-
 
331
                  if(CheckDelay(appendtimer)) logging_active = 0;
-
 
332
                 }
-
 
333
 
311
                if(FC.StatusFlags & FC_STATUS_MOTOR_RUN || part)
334
                if(logging_active || part)
312
                {
335
                {
313
                        switch(logfilestate)
336
                        switch(logfilestate)
314
                        {
337
                        {
315
                                case LOGFILE_IDLE:
338
                                case LOGFILE_IDLE: