PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Functions | |
bool | file_exist (const char *filename) |
check if a file exists More... | |
bool | get_log_time (struct tm *tt, int utc_offset_sec=0, bool boot_time=false) |
Get the time for log file name. More... | |
int | check_free_space (const char *log_root_dir, int32_t max_log_dirs_to_keep, orb_advert_t &mavlink_log_pub, int &sess_dir_index) |
Check if there is enough free space left on the SD Card. More... | |
int | remove_directory (const char *dir) |
Recursively remove a directory. More... | |
int px4::logger::util::check_free_space | ( | const char * | log_root_dir, |
int32_t | max_log_dirs_to_keep, | ||
orb_advert_t & | mavlink_log_pub, | ||
int & | sess_dir_index | ||
) |
Check if there is enough free space left on the SD Card.
It will remove old log files if there is not enough space, and if that fails return 1, and send a user message
log_root_dir | log root directory: it's expected to contain directories in the form of sessi or d-d-d (year, month, day) |
max_log_dirs_to_keep | maximum log directories to keep (set to 0 for unlimited) |
mavlink_log_pub | |
sess_dir_index | output argument: will be set to the next free directory sessi index. |
Definition at line 114 of file util.cpp.
References LOG_DIR_LEN, mavlink_log_critical, px4_statfs_buf_f_bavail_t, and remove_directory().
Referenced by px4::logger::Logger::run().
bool px4::logger::util::file_exist | ( | const char * | filename | ) |
check if a file exists
Definition at line 68 of file util.cpp.
Referenced by px4::logger::Logger::get_log_file_name().
bool px4::logger::util::get_log_time | ( | struct tm * | tt, |
int | utc_offset_sec = 0 , |
||
bool | boot_time = false |
||
) |
Get the time for log file name.
tt | returned time |
utc_offset_sec | UTC time offset [s] |
boot_time | use time when booted instead of current time |
Definition at line 74 of file util.cpp.
References vehicle_gps_position_s::fix_type, GPS_EPOCH_SECS, hrt_absolute_time(), ORB_ID, and vehicle_gps_position_s::time_utc_usec.
Referenced by px4::logger::Logger::get_log_file_name().
int px4::logger::util::remove_directory | ( | const char * | dir | ) |
Recursively remove a directory.
Definition at line 238 of file util.cpp.
Referenced by check_free_space().