From 1bce79d038b29b8364a3cc944d657fb721947a73 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Mar 2024 13:17:47 +1100 Subject: [PATCH] AP_Scripting: add file system crc32 binding --- libraries/AP_Scripting/docs/docs.lua | 12 ++++++++++++ .../AP_Scripting/generator/description/bindings.desc | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/libraries/AP_Scripting/docs/docs.lua b/libraries/AP_Scripting/docs/docs.lua index afc7381be8..679f3e047b 100644 --- a/libraries/AP_Scripting/docs/docs.lua +++ b/libraries/AP_Scripting/docs/docs.lua @@ -3396,6 +3396,18 @@ fs = {} ---@return stat_t_ud|nil function fs:stat(param1) end +-- Format the SD card. This is a async operation, use get_format_status to get the status of the format +---@return boolean +function fs:format() end + +-- Get the current status of a format. 0=NOT_STARTED, 1=PENDING, 2=IN_PROGRESS, 3=SUCCESS, 4=FAILURE +---@return number +function fs:get_format_status() end + +-- Get crc32 checksum of a file with given name +---@return uint32_t_ud|nil +function fs:crc32(file_name) end + -- desc ---@class networking networking = {} diff --git a/libraries/AP_Scripting/generator/description/bindings.desc b/libraries/AP_Scripting/generator/description/bindings.desc index 281da8552b..cd2956dc41 100644 --- a/libraries/AP_Scripting/generator/description/bindings.desc +++ b/libraries/AP_Scripting/generator/description/bindings.desc @@ -891,6 +891,11 @@ userdata AP_Filesystem::stat_t method is_directory boolean singleton AP_Filesystem rename fs singleton AP_Filesystem method stat boolean string AP_Filesystem::stat_t'Null +singleton AP_Filesystem method format boolean +singleton AP_Filesystem method format depends AP_FILESYSTEM_FORMAT_ENABLED +singleton AP_Filesystem method get_format_status uint8_t'skip_check +singleton AP_Filesystem method get_format_status depends AP_FILESYSTEM_FORMAT_ENABLED +singleton AP_Filesystem method crc32 boolean string uint32_t'Null include AP_RTC/AP_RTC.h depends AP_RTC_ENABLED include AP_RTC/AP_RTC_config.h