Rev 436 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 436 | Rev 437 | ||
---|---|---|---|
Line 69... | Line 69... | ||
69 | #define MIN_SD_INTERVAL_GPX 500 |
69 | #define MIN_SD_INTERVAL_GPX 500 |
70 | #define APPEND_LOG_TIME_MS 2510 // log some more time |
70 | #define APPEND_LOG_TIME_MS 2510 // log some more time |
Line 71... | Line 71... | ||
71 | 71 | ||
Line 72... | Line 72... | ||
72 | u8 SD_LoggingError = 0; |
72 | u8 SD_LoggingError = 0; |
Line 73... | Line 73... | ||
73 | 73 | ||
74 | #define LOG_FLUSH_INTERVAL 4000 // 4s //## |
74 | #define LOG_FLUSH_INTERVAL 4000 // 4s // -> and if an Error occures |
75 | 75 | ||
76 | typedef enum |
76 | typedef enum |
Line 294... | Line 294... | ||
294 | { |
294 | { |
295 | static logfilestate_t logfilestate = LOGFILE_IDLE; // the current logfilestate |
295 | static logfilestate_t logfilestate = LOGFILE_IDLE; // the current logfilestate |
296 | static s8* logfilename = NULL; // the pointer to the logfilename |
296 | static s8* logfilename = NULL; // the pointer to the logfilename |
297 | static u32 logtimer = 0, flushtimer = 0, appendtimer = 0; // the log update timer |
297 | static u32 logtimer = 0, flushtimer = 0, appendtimer = 0; // the log update timer |
298 | static GPX_Document_t logfile; // the logfilehandle |
298 | static GPX_Document_t logfile; // the logfilehandle |
299 | static u8 part = 0, logging_active = 0; |
299 | static u8 part = 0, logging_active = 0, old_errorcode = 0; |
300 | u32 measure_time; |
300 | u32 measure_time; |
Line 301... | Line 301... | ||
301 | 301 | ||
302 | // initialize if LogDelay is zero |
302 | // initialize if LogDelay is zero |
303 | if(!LogDelay) |
303 | if(!LogDelay) |
Line 368... | Line 368... | ||
368 | UART1_PutString(logfilename); |
368 | UART1_PutString(logfilename); |
369 | UART1_PutString("\r\n"); |
369 | UART1_PutString("\r\n"); |
370 | SD_LoggingError = 11; |
370 | SD_LoggingError = 11; |
371 | logtimer = SetDelay(10); // try again in open logfile in 10 mili sec |
371 | logtimer = SetDelay(10); // try again in open logfile in 10 mili sec |
372 | } |
372 | } |
- | 373 | old_errorcode = ErrorCode; |
|
373 | } |
374 | } |
374 | else |
375 | else |
375 | { |
376 | { |
376 | logfilestate = LOGFILE_ERROR; |
377 | logfilestate = LOGFILE_ERROR; |
377 | UART1_PutString("\r\nError getting free gpx-file name\r\n"); |
378 | UART1_PutString("\r\nError getting free gpx-file name\r\n"); |
Line 392... | Line 393... | ||
392 | SD_LoggingError = 13; |
393 | SD_LoggingError = 13; |
393 | logfilestate = LOGFILE_ERROR; |
394 | logfilestate = LOGFILE_ERROR; |
394 | } |
395 | } |
395 | else // successful log |
396 | else // successful log |
396 | { |
397 | { |
397 | if(CheckDelay(flushtimer)) |
398 | if(ErrorCode != old_errorcode || CheckDelay(flushtimer)) |
398 | { |
399 | { |
- | 400 | old_errorcode = ErrorCode; |
|
399 | flushtimer = SetDelay(LOG_FLUSH_INTERVAL); |
401 | flushtimer = SetDelay(LOG_FLUSH_INTERVAL); |
400 | fflush_(logfile.file); |
402 | fflush_(logfile.file); |
401 | } |
403 | } |
402 | } |
404 | } |
403 | } |
405 | } |