Rev 101 | Rev 115 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 101 | Rev 110 | ||
---|---|---|---|
Line 195... | Line 195... | ||
195 | // try to create the log file |
195 | // try to create the log file |
196 | if(KML_DocumentOpen(logfilename, &logfile)) |
196 | if(KML_DocumentOpen(logfilename, &logfile)) |
197 | { |
197 | { |
198 | flushtimer = SetDelay(LOG_FLUSH_INTERVAL); |
198 | flushtimer = SetDelay(LOG_FLUSH_INTERVAL); |
199 | logfilestate = LOGFILE_OPENED; // goto next step |
199 | logfilestate = LOGFILE_OPENED; // goto next step |
200 | SerialPutString("\r\nOpening kml-file:"); |
200 | UART1_PutString("\r\nOpening kml-file:"); |
201 | SerialPutString(logfilename); |
201 | UART1_PutString(logfilename); |
202 | SerialPutString("\r\n"); |
202 | UART1_PutString("\r\n"); |
203 | } |
203 | } |
204 | else // could not be openend |
204 | else // could not be openend |
205 | { |
205 | { |
206 | logfilestate = LOGFILE_ERROR; |
206 | logfilestate = LOGFILE_ERROR; |
207 | SerialPutString("\r\nError opening kml-file: "); |
207 | UART1_PutString("\r\nError opening kml-file: "); |
208 | SerialPutString(logfilename); |
208 | UART1_PutString(logfilename); |
209 | SerialPutString("\r\n"); |
209 | UART1_PutString("\r\n"); |
210 | logtimer = SetDelay(10); // try again in open logfile in 10 mili sec |
210 | logtimer = SetDelay(10); // try again in open logfile in 10 mili sec |
211 | } |
211 | } |
212 | } |
212 | } |
213 | else |
213 | else |
214 | { |
214 | { |
215 | logfilestate = LOGFILE_ERROR; |
215 | logfilestate = LOGFILE_ERROR; |
216 | SerialPutString("\r\nError getting free kml-file name\r\n"); |
216 | UART1_PutString("\r\nError getting free kml-file name\r\n"); |
217 | } |
217 | } |
218 | // else retry in next loop |
218 | // else retry in next loop |
219 | break; |
219 | break; |
220 | case LOGFILE_OPENED: |
220 | case LOGFILE_OPENED: |
221 | // append new gps log data |
221 | // append new gps log data |
222 | if((GPSData.Status != INVALID) && (GPSData.Flags & FLAG_GPSFIXOK) && (GPSData.SatFix == SATFIX_3D)) |
222 | if((GPSData.Status != INVALID) && (GPSData.Flags & FLAG_GPSFIXOK) && (GPSData.SatFix == SATFIX_3D)) |
223 | { |
223 | { |
224 | if(!KML_LoggGPSCoordinates(&logfile)) |
224 | if(!KML_LoggGPSCoordinates(&logfile)) |
225 | { // error logging data |
225 | { // error logging data |
226 | SerialPutString("\r\nError logging to kml-file\r\n"); |
226 | UART1_PutString("\r\nError logging to kml-file\r\n"); |
227 | KML_DocumentClose(&logfile); |
227 | KML_DocumentClose(&logfile); |
228 | logfilestate = LOGFILE_ERROR; |
228 | logfilestate = LOGFILE_ERROR; |
229 | } |
229 | } |
230 | else // sucessfully logged |
230 | else // sucessfully logged |
231 | { |
231 | { |
Line 251... | Line 251... | ||
251 | { // close log file if opened |
251 | { // close log file if opened |
252 | if(logfilestate == LOGFILE_OPENED) |
252 | if(logfilestate == LOGFILE_OPENED) |
253 | { |
253 | { |
254 | if(KML_DocumentClose(&logfile)) |
254 | if(KML_DocumentClose(&logfile)) |
255 | { |
255 | { |
256 | SerialPutString("\r\nClosing kml-file\r\n"); |
256 | UART1_PutString("\r\nClosing kml-file\r\n"); |
257 | logfilestate = LOGFILE_CLOSED; |
257 | logfilestate = LOGFILE_CLOSED; |
258 | } |
258 | } |
259 | else // could not be closed |
259 | else // could not be closed |
260 | { |
260 | { |
261 | SerialPutString("\r\nError closing kml-file\r\n"); |
261 | UART1_PutString("\r\nError closing kml-file\r\n"); |
262 | logfilestate = LOGFILE_ERROR; |
262 | logfilestate = LOGFILE_ERROR; |
263 | } |
263 | } |
264 | } |
264 | } |
265 | } //EOF motors are not running |
265 | } //EOF motors are not running |
266 | } // EOF Check LogTimer |
266 | } // EOF Check LogTimer |
Line 322... | Line 322... | ||
322 | // try to create the log file |
322 | // try to create the log file |
323 | if(GPX_DocumentOpen(logfilename, &logfile)) |
323 | if(GPX_DocumentOpen(logfilename, &logfile)) |
324 | { |
324 | { |
325 | flushtimer = SetDelay(LOG_FLUSH_INTERVAL); |
325 | flushtimer = SetDelay(LOG_FLUSH_INTERVAL); |
326 | logfilestate = LOGFILE_OPENED; // goto next step |
326 | logfilestate = LOGFILE_OPENED; // goto next step |
327 | SerialPutString("\r\nOpening gpx-file:"); |
327 | UART1_PutString("\r\nOpening gpx-file:"); |
328 | SerialPutString(logfilename); |
328 | UART1_PutString(logfilename); |
329 | SerialPutString("\r\n"); |
329 | UART1_PutString("\r\n"); |
330 | } |
330 | } |
331 | else // could not be openend |
331 | else // could not be openend |
332 | { |
332 | { |
333 | logfilestate = LOGFILE_ERROR; |
333 | logfilestate = LOGFILE_ERROR; |
334 | SerialPutString("\r\nError opening gpx-file: "); |
334 | UART1_PutString("\r\nError opening gpx-file: "); |
335 | SerialPutString(logfilename); |
335 | UART1_PutString(logfilename); |
336 | SerialPutString("\r\n"); |
336 | UART1_PutString("\r\n"); |
337 | logtimer = SetDelay(10); // try again in open logfile in 10 mili sec |
337 | logtimer = SetDelay(10); // try again in open logfile in 10 mili sec |
338 | } |
338 | } |
339 | } |
339 | } |
340 | else |
340 | else |
341 | { |
341 | { |
342 | logfilestate = LOGFILE_ERROR; |
342 | logfilestate = LOGFILE_ERROR; |
343 | SerialPutString("\r\nError getting free gpx-file name\r\n"); |
343 | UART1_PutString("\r\nError getting free gpx-file name\r\n"); |
344 | } |
344 | } |
345 | // else retry in next loop |
345 | // else retry in next loop |
346 | break; |
346 | break; |
347 | case LOGFILE_OPENED: |
347 | case LOGFILE_OPENED: |
348 | // append new gps log data |
348 | // append new gps log data |
349 | if((GPSData.Status != INVALID) && (GPSData.Flags & FLAG_GPSFIXOK) && (GPSData.SatFix == SATFIX_3D)) |
349 | if((GPSData.Status != INVALID) && (GPSData.Flags & FLAG_GPSFIXOK) && (GPSData.SatFix == SATFIX_3D)) |
350 | { |
350 | { |
351 | if(!GPX_LoggGPSCoordinates(&logfile)) |
351 | if(!GPX_LoggGPSCoordinates(&logfile)) |
352 | { // error logging data |
352 | { // error logging data |
353 | SerialPutString("\r\nError logging to gpx-file\r\n"); |
353 | UART1_PutString("\r\nError logging to gpx-file\r\n"); |
354 | GPX_DocumentClose(&logfile); |
354 | GPX_DocumentClose(&logfile); |
355 | logfilestate = LOGFILE_ERROR; |
355 | logfilestate = LOGFILE_ERROR; |
356 | } |
356 | } |
357 | else // successful log |
357 | else // successful log |
358 | { |
358 | { |
Line 377... | Line 377... | ||
377 | { // close log file if opened |
377 | { // close log file if opened |
378 | if(logfilestate == LOGFILE_OPENED) |
378 | if(logfilestate == LOGFILE_OPENED) |
379 | { |
379 | { |
380 | if(GPX_DocumentClose(&logfile)) |
380 | if(GPX_DocumentClose(&logfile)) |
381 | { |
381 | { |
382 | SerialPutString("\r\nClosing gpx-file\r\n"); |
382 | UART1_PutString("\r\nClosing gpx-file\r\n"); |
383 | logfilestate = LOGFILE_CLOSED; |
383 | logfilestate = LOGFILE_CLOSED; |
384 | } |
384 | } |
385 | else // could not be closed |
385 | else // could not be closed |
386 | { |
386 | { |
387 | SerialPutString("\r\nError closing gpx-file\r\n"); |
387 | UART1_PutString("\r\nError closing gpx-file\r\n"); |
388 | logfilestate = LOGFILE_ERROR; |
388 | logfilestate = LOGFILE_ERROR; |
389 | } |
389 | } |
390 | } |
390 | } |
391 | } //EOF model is not flying |
391 | } //EOF model is not flying |
392 | } // EOF Check LogTimer |
392 | } // EOF Check LogTimer |