Commit Graph

59 Commits

Author SHA1 Message Date
Peter Barker 493f958eb2 DataFlash: remove unused ReadBlock method 2018-07-02 09:00:51 +10:00
Andrew Tridgell 777b4c8cfe DataFlash: avoid stat of current log file
this avoids getting invalid data base for stat() for the current log
file.

It also only gives up writing to a log file if writes fail for 2
seconds. This avoids a temporary write failure causing the log to be
closed (that can happen on ChibiOS with directory listing while writing)
2018-06-14 14:55:41 +10:00
Francisco Ferreira 221ba177c5 DataFlash: remove Qualcomm board support 2018-05-17 09:57:20 +10:00
Peter Barker 8027883734 DataFlash: remove vestiges of CLI functions 2018-04-10 10:27:08 +09:00
Andrew Tridgell 43a6ed4099 DataFlash: support ChibiOS FATFS implementation 2018-01-15 11:46:02 +11:00
Peter Barker 3af5be76aa DataFlash: protect write fd with semaphore
If the sensor threads are using WriteBlock they may pass the _write_fd
== -1 check but then have that set to -1 by the main thread
2017-09-20 11:33:07 +01:00
Peter Barker 9783c0c3ba DataFlash: log dataflash-file statistics periodically 2017-08-28 22:05:44 +01:00
Peter Barker 975d2fd0d1 DataFlash: add debug for io thread failure 2017-07-28 17:06:49 +01:00
Peter Barker 0769432e63 DataFlash: move log-write-started logic to be backend-specific 2017-07-19 16:37:28 +01:00
Peter Barker 1f0a14ab33 DataFlash: add PrepForArming method 2017-07-19 16:37:28 +01:00
Peter Barker b572c13ca9 DataFlash: move starting of new logs into DataFlash 2017-07-19 16:37:16 +01:00
Peter Barker 4234f4ef7a DataFlash: move _initialised into DataFlash_Backend 2017-07-19 16:37:16 +01:00
Peter Barker 001d3a7118 DataFlash: correct consts on CardInserted 2017-06-16 17:07:48 +01:00
Peter Barker 0be2e7962f DataFlash: create a WritesOK method for WritePrioritisedBlock 2017-06-11 20:34:12 +01:00
Peter Barker 9324d8e251 Dataflash: emit io thread warnings much less frequently 2017-04-19 12:33:18 +09:00
Peter Barker d8c475ad04 DataFlash: use override keyword on many methods 2017-03-31 15:02:14 +01:00
Peter Barker 057819ccef DataFlash: zero-pad the number in the log filename
This helps with collating when reviewing log files

Closes #2212
2017-02-15 07:23:49 +11:00
Peter Barker bc45ab5409 DataFlash: add a heartbeat for the io thread in DataFlash_File 2016-11-29 15:14:09 -08:00
Peter Barker e11c276b35 DataFlash_File: stop trying to stuff a uint64_t into a uint32_t 2016-11-29 15:14:09 -08:00
Peter Barker 2c8a0a9123 DataFlash: rotate files when vehicle is disarmed 2016-11-28 09:42:09 -08:00
Murilo Belluzzo a91da2e803 DataFlash: Change ::bufferspace_available return type
from 'uint16_t' to 'uint32_t' to avoid overflow (possible in at least
two implementations: Block and File).
2016-10-27 14:24:11 +11:00
Murilo Belluzzo c112e1c889 DataFlash: Make use of ByteBuffer class
This patch replaces the 'old style' ringbuffer by the ByteBuffer class.
An effort was made to keep the exchange as close as possible from a
drop-in replacement to minimize the risk of introducing bugs.

Although the exchange opens opportunities for improvement and
simplification of this class.
2016-10-27 14:24:10 +11:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Peter Barker a10cde35f5 DataFlash: stop logging before filling SD card on PX4
Filling the SD card causes NuttX to have conniptions, including
data loss and failure to boot
2016-09-26 14:02:58 -07:00
Peter Barker 8d253dec8e DataFlash: support for mavlink SENSOR message 2016-08-11 17:48:44 -03:00
Lucas De Marchi ec36e06c63 DataFlash: replace header guard with pragma once 2016-03-16 18:40:44 +11:00
Andrew Tridgell b967140572 DataFlash: enable minimal file mode
This adds a "minimal" dataflash mode with a board specific macro. The
QURT port uses this to avoid problematic system calls that are buggy
in the QURT RTOS

With some pending updates to QURT we may be able to remove some (or
all) of this
2015-12-27 16:21:26 +11:00
Andrew Tridgell 02d7867d79 DataFlash: added locking for multi-thread logging support 2015-12-20 17:55:39 +11:00
Peter Barker 7900359fac DataFlash: LOG_FILE_BUFSIZE sets buffer size for DataFlash_File 2015-12-08 10:59:57 +11:00
Peter Barker faabe0b83d DataFlash: support multiple simultaneous backends 2015-12-03 13:21:51 +11:00
Peter Barker fc05ad81eb DataFlash_File: cache oldest log to avoid directory scans when downloading 2015-11-12 12:23:46 +11:00
Peter Barker e481497574 DataFlash: delete oldest file rather than the lowest-numbered file
Also reference log numbers by their list index to accomodate log number
wrapping in DataFlash_File
2015-10-21 10:50:32 +11:00
Andrew Tridgell b0aa7cb990 DataFlash: use new perf API 2015-10-20 18:16:16 +11:00
Peter Barker 8f1471c137 DataFlash: leave room in buffer for non-startup messages 2015-09-18 09:13:45 +10:00
Peter Barker 60010e794e DataFlash: ensure 10% free space when initialising logging 2015-09-09 12:22:35 +10:00
Peter Barker 8f8493225c DataFlash: DFMessageWriter; ability to trickle messages out to DF 2015-09-03 09:54:55 +10:00
Peter Barker 844f050cf3 DataFlash: correct zero-byte-file handling in CLI
-rw-rw-r-- 1 pbarker pbarker   2105344 Jul  1 16:10 1.BIN
-rw-rw-r-- 1 pbarker pbarker         0 Jul  1 19:35 2.BIN
-rw-rw-r-- 1 pbarker pbarker   2494464 Jul  1 16:58 3.BIN
-rw-rw-r-- 1 pbarker pbarker 128503808 Jul  1 20:22 4.BIN
-rw-rw-r-- 1 pbarker pbarker         3 Jul  1 19:46 LASTLOG.TXT

Before fix:

2 logs
Log 3 in logs/3.BIN of size 2494464 2015/7/1 6:58
Log 4 in logs/4.BIN of size 128503808 2015/7/1 10:22

After Fix:

4 logs
Log 1 in logs/1.BIN of size 2105344 2015/7/1 6:10
Log 2 in logs/2.BIN of size 0 2015/7/1 9:35
Log 3 in logs/3.BIN of size 2494464 2015/7/1 6:58
Log 4 in logs/4.BIN of size 128503808 2015/7/1 10:22

If the last file was zero bytes, no files would be shown.
2015-07-02 08:53:18 +10:00
Peter Barker c5c39a77a3 DataFlash: method to flush ringbuffer to fd 2015-06-30 16:19:22 +10:00
Peter Barker 723c37bcf7 DataFlash: backend/frontend split 2015-06-26 16:02:50 +10:00
Andrew Tridgell 73445fdae9 DataFlash: added error checking and fixed a warning 2015-05-30 22:16:22 +10:00
Andrew Tridgell b5d930be61 DataFlash: support member functions for rover 2015-05-21 07:48:47 +10:00
Andrew Tridgell 2dfe3cb844 DataFlash: added a perf counter for microSD overruns
this allows us to tell if a microSD can handle a high logging rate
2015-04-21 20:45:30 +10:00
Andrew Tridgell c93ae67541 DataFlash: don't try and open logfile on failure more than once
this prevents a corrupted microSD card from causing a continuous
attempt to open a log file while in flight, which can cause large
scheduler delays

Pair-Programmed-With: Grant Morphett <grant@gmorph.com>
2014-12-21 14:50:42 +11:00
Andrew Tridgell 9d846d5f2a DataFlash: allow use of a smaller writebuf for PX4v1
this fixes logging on PX4v1
2014-09-09 17:32:44 +10:00
Emile Castelnuovo ab9a320187 DataFlash: added #ifdefs for VRBRAIN board 2014-04-08 16:19:19 +10:00
Andrew Tridgell 921f923c5f DataFlash: reset write log on new log 2014-01-14 14:28:56 +11:00
Andrew Tridgell b4b66210ff DataFlash: improve reliability of microSD for logs 2014-01-14 12:46:26 +11:00
Andrew Tridgell cb23298384 DataFlash: try to keep dataflash writes aligned
also rename lastlog.txt to LASTLOG.TXT as NuttX seems to get less
corruption with VFAT filenames that don't need uppercase mappings
2014-01-14 12:46:26 +11:00
Andrew Tridgell 4519aa8867 DataFlash: only fsync every 10 seconds
prevents too much work in SITL
2014-01-04 08:15:38 +11:00
Andrew Tridgell e1a86440bb DataFlash: stop write logging while reading
prevents nuttx getting confused
2013-12-28 14:25:54 +11:00