Rev 85 | Rev 87 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 85 | Rev 86 | ||
---|---|---|---|
Line 59... | Line 59... | ||
59 | #include "main.h" |
59 | #include "main.h" |
60 | #include "timer.h" |
60 | #include "timer.h" |
61 | #include "uart1.h" |
61 | #include "uart1.h" |
62 | #include "kml.h" |
62 | #include "kml.h" |
63 | #include "gpx.h" |
63 | #include "gpx.h" |
- | 64 | #include "ssc.h" |
|
Line 64... | Line 65... | ||
64 | 65 | ||
65 | typedef enum |
66 | typedef enum |
66 | { |
67 | { |
67 | LOGFILE_IDLE, |
68 | LOGFILE_IDLE, |
Line 79... | Line 80... | ||
79 | { |
80 | { |
80 | u32 KML_Interval; // the kml-log interval (0 = off) |
81 | u32 KML_Interval; // the kml-log interval (0 = off) |
81 | u32 GPX_Interval; // the gpx-log interval (0 = off) |
82 | u32 GPX_Interval; // the gpx-log interval (0 = off) |
82 | } LogCfg_t; |
83 | } LogCfg_t; |
Line 83... | Line 84... | ||
83 | 84 | ||
Line 84... | Line 85... | ||
84 | LogCfg_t LogCfg = {500 , 0}; |
85 | LogCfg_t LogCfg = {0 , 1000}; |
85 | 86 | ||
86 | 87 | ||
Line 382... | Line 383... | ||
382 | void Logging_Update(void) |
383 | void Logging_Update(void) |
383 | { |
384 | { |
384 | static u32 logtimer = 0; |
385 | static u32 logtimer = 0; |
385 | static logfilestate_t logstate = LOGFILE_IDLE; |
386 | static logfilestate_t logstate = LOGFILE_IDLE; |
Line -... | Line 387... | ||
- | 387 | ||
386 | 388 | ||
387 | if(CheckDelay(logtimer)) |
389 | if(SD_SWITCH && CheckDelay(logtimer)) // a card is in slot |
388 | { |
390 | { |
389 | logtimer = SetDelay(10); // faster makes no sense |
391 | logtimer = SetDelay(10); // faster makes no sense |
390 | // call the sub logger handlers if no error has occured |
392 | // call the logger handlers if no error has occured |
391 | if(logstate != LOGFILE_ERROR) logstate = Logging_KML(LogCfg.KML_Interval); |
393 | if(logstate != LOGFILE_ERROR) logstate = Logging_KML(LogCfg.KML_Interval); |
Line 392... | Line 394... | ||
392 | if(logstate != LOGFILE_ERROR) logstate = Logging_GPX(LogCfg.GPX_Interval); |
394 | if(logstate != LOGFILE_ERROR) logstate = Logging_GPX(LogCfg.GPX_Interval); |
393 | 395 | ||
Line 397... | Line 399... | ||
397 | Logging_Init(); // initialize the logs |
399 | Logging_Init(); // initialize the logs |
398 | // try to initialize the Fat 16 filesystem |
400 | // try to initialize the Fat 16 filesystem |
399 | if(0 == Fat16_Init()) |
401 | if(0 == Fat16_Init()) |
400 | { // Fat 16 successfully initialized |
402 | { // Fat 16 successfully initialized |
401 | logstate = LOGFILE_IDLE; |
403 | logstate = LOGFILE_IDLE; |
402 | logtimer = SetDelay(10); // try again in open logfile in 10 mili sec |
404 | logtimer = SetDelay(10); // try again in open logfile in 10 mili sec |
403 | } |
405 | } |
404 | else |
406 | else |
405 | { // retry in 5 seconds |
407 | { // retry in 5 seconds |
406 | logtimer = SetDelay(5000); // try again in 5 sec |
408 | logtimer = SetDelay(5000); // try again in 5 sec |
407 | } |
409 | } |
408 | } |
410 | } //EOF logfile error |
409 | } |
411 | }// EOF CheckDelay |
410 | } |
412 | } |