Commit Graph

25 Commits

Author SHA1 Message Date
Andrew Tridgell 63e45a3910 AP_Logger: added LOG_DISARMED=3
when LOG_DISARMED is set to 3 then we log while disarmed but if we
reboot without ever arming the log is discarded. This allows for using
LOG_DISARMED without filling the microSD.
2023-04-14 07:48:24 +10:00
Andrew Tridgell 93b55e367e AP_Logger: fixed log listing with gap, and EKF error on log list
this fixes two issues:

The first issue that if we are missing a log file in the middle of the
list then it was not possible to download recent logs, as we get the
incorrect value for total number of logs. This happened for me with
107 logs, with log62 missing from the microSD. It would only show 45
available logs, so the most recent logs could not be downloaded.

The second issue is that get_num_logs() was very slow if there were a
lot of log files in a directory. This would cause EKF errors and ESC
resets. Using a opendir/readdir loop is much faster (approx 10x faster
in my testing with 107 logs on a MatekH743).
2022-04-19 11:45:26 +10:00
Peter Barker e95aedd748 AP_Logger: tidy construction of backends 2021-11-09 10:18:10 +11:00
Peter Barker 151fe6facf AP_Logger: rearrange PrepForArming stuff 2021-06-15 16:42:02 +10:00
Andrew Tridgell 806fdd9389 AP_Logger: moved log file open to logger thread
this prevents a watchdog if the filesystem takes a long time to
respond to a file open
2021-06-15 16:42:02 +10:00
Andrew Tridgell c886fd7025 AP_Logger: make log file erase async
this prevents clagging up the main loop on a big erase. With an erase
of large enough files we could trigger a disarmed watchdog.
2021-04-06 10:40:40 +10:00
Peter Barker 7d42f473fc AP_Logger: allow each backend to be compiled out 2021-01-08 12:48:55 +11:00
Peter Barker e8d24a1f68 AP_Logger: initialise logger instance variables in header 2021-01-07 10:42:13 +11:00
Peter Barker 80e8688888 AP_Logger: remove perf counters 2021-01-07 09:20:00 +11:00
Peter Barker ef0b860a48 AP_Logger: remove Prep and NeedPrep functions
These were only being called directly after Init(), so just tacked them
onto the end of those functions.

The checks in NeedPrep turned out to be mostly redundant.
2021-01-06 18:25:21 +11:00
Andy Piper 779c2a9e5f AP_Logger: move logger IO to a separate thread 2021-01-02 22:30:08 +11:00
Andrew Tridgell 66596dcf25 AP_Logger: allow for retry of log open with LOG_DISARMED=1
if booting without a microSD and with LOG_DISARMED=1 then this allows
for a retry of opening the log every 5s
2020-10-27 20:35:56 +11:00
Andy Piper ccb583d092 AP_Logger: make block logger conform to mavlink expectations of numbering
add support for log time to block logger
refactor rotation into backed. Don't start logs when erasing
correct log start logic
separate read and write points so that requesting log information does not corrupt the current log
when starting a new log stop logging first
clear the write buffer when starting a new log
insert utc time when requesting info for the current log
stop logging and request formats again when starting a new log
cope with erase happening while we are logging
keep pushing out startup messages even when format messages are done
don't log to the gcs in the io thread
don't start new logs in the io thread
don't validate logs while erasing
flush logs when stopping logging
account for page header when calculating logs sizes
don't return data when asked for more data than in the log
optimize locking and use separate semaphore to mediate ring buffer access
stop logging when the chip is full and send a notification
calculate logs sizes correctly even when they wrap
read log data correctly even when it wraps
add stats support to block logger
reset dropped when starting a new log
fail logging when the chip is full
refactor critical bufferspace checks
increase messagewriter budget to 250us and to 300us for FMT
2020-09-05 10:20:39 +10:00
Peter Barker 66f8359c6b AP_Logger: factor out an ensure_log_directory_exists method 2020-06-16 12:03:21 +10:00
Iampete1 fee5b998bf AP_Logger: add min MB free param 2020-06-09 09:23:25 +10:00
murata f6595a41ae AP_Logger: Change the type of a method 2020-01-22 12:45:27 +11:00
Andrew Tridgell 3ebc69320c AP_Logger: fixed LOG_FILE_DSRMROT with delayed log stop
now that we persist logging for 15s after disarm we need to also delay
the log rotation if LOG_FILE_DSRMROT=1. Otherwise we will put the log
data into the next log, which defeats the purpose of the 15s
persistance
2019-10-03 07:17:16 +10:00
Andrew Tridgell df4cb00970 AP_Logger: added LOG_FILE_TIMEOUT parameter
this allows for cards to be removed and re-inserted while continuing
logging
2019-08-27 15:40:43 +10:00
Andrew Tridgell 667b4e045a AP_Logger: convert to use AP_Filesystem 2019-08-27 15:40:43 +10:00
Andrew Tridgell 66dc36ef88 AP_Logger: ifdef out _need_rtc_update 2019-08-26 15:41:44 +10:00
Andrew Tridgell 8e58cb993d AP_Logger: fix timestamp on log files opened before GPS lock 2019-08-26 15:41:44 +10:00
Andrew Tridgell e3c9f10e91 AP_Logger: revived block based logging 2019-01-21 21:57:21 +11:00
Peter Barker 6fc76a32af GLOBAL: use AP::logger() and strip redundant Log_ from methods 2019-01-18 18:08:20 +11:00
Peter Barker b47733142f GLOBAL: rename DataFlash_Class to AP_Logger 2019-01-18 18:08:20 +11:00
Peter Barker 6a59dd04a7 DataFlash: rename to AP_Logger 2019-01-18 18:08:20 +11:00