mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-19 09:54:15 +01:00
OP-997: add fields to SystemStatsUavo to monitor storage status
This commit is contained in:
parent
1cb69e6a0e
commit
e9b3ee52f3
@ -53,6 +53,7 @@
|
||||
#include <watchdogstatus.h>
|
||||
#include <taskinfo.h>
|
||||
#include <hwsettings.h>
|
||||
#include <pios_flashfs.h>
|
||||
|
||||
// Flight Libraries
|
||||
#include <sanitycheck.h>
|
||||
@ -94,7 +95,7 @@ static xQueueHandle objectPersistenceQueue;
|
||||
static bool stackOverflow;
|
||||
static bool mallocFailed;
|
||||
static HwSettingsData bootHwSettings;
|
||||
|
||||
static struct PIOS_FLASHFS_Stats fsStats;
|
||||
// Private functions
|
||||
static void objectUpdatedCb(UAVObjEvent *ev);
|
||||
static void hwSettingsUpdatedCb(UAVObjEvent *ev);
|
||||
@ -108,6 +109,10 @@ static void systemTask(void *parameters);
|
||||
static void updateI2Cstats();
|
||||
static void updateWDGstats();
|
||||
#endif
|
||||
|
||||
extern uintptr_t pios_uavo_settings_fs_id;
|
||||
extern uintptr_t pios_user_fs_id;
|
||||
|
||||
/**
|
||||
* Create the module task.
|
||||
* \returns 0 on success or -1 if initialization failed
|
||||
@ -462,7 +467,18 @@ static void updateStats()
|
||||
if (idleCounterClear) {
|
||||
idleCounter = 0;
|
||||
}
|
||||
|
||||
#if !defined(ARCH_POSIX) && !defined(ARCH_WIN32)
|
||||
if(pios_uavo_settings_fs_id){
|
||||
PIOS_FLASHFS_GetStats(pios_uavo_settings_fs_id, &fsStats);
|
||||
stats.SysSlotsFree = fsStats.num_free_slots;
|
||||
stats.SysSlotsActive = fsStats.num_active_slots;
|
||||
}
|
||||
if(pios_user_fs_id){
|
||||
PIOS_FLASHFS_GetStats(pios_user_fs_id, &fsStats);
|
||||
stats.UsrSlotsFree = fsStats.num_free_slots;
|
||||
stats.UsrSlotsActive = fsStats.num_active_slots;
|
||||
}
|
||||
#endif
|
||||
portTickType now = xTaskGetTickCount();
|
||||
if (now > lastTickCount) {
|
||||
uint32_t dT = (xTaskGetTickCount() - lastTickCount) * portTICK_RATE_MS; // in ms
|
||||
|
@ -1158,7 +1158,23 @@ out_end_trans:
|
||||
out_exit:
|
||||
return rc;
|
||||
}
|
||||
/**
|
||||
* @brief Returs stats for the filesystems
|
||||
* @param[in] fs_id The filesystem to use for this action
|
||||
* @return 0 if success or error code
|
||||
* @retval -1 if fs_id is not a valid filesystem instance
|
||||
*/
|
||||
int32_t PIOS_FLASHFS_GetStats(uintptr_t fs_id, struct PIOS_FLASHFS_Stats *stats){
|
||||
PIOS_Assert(stats);
|
||||
struct logfs_state *logfs = (struct logfs_state *)fs_id;
|
||||
|
||||
if (!PIOS_FLASHFS_Logfs_validate(logfs)) {
|
||||
return -1;
|
||||
}
|
||||
stats->num_active_slots = logfs->num_active_slots;
|
||||
stats->num_free_slots = logfs->num_free_slots;
|
||||
return 0;
|
||||
}
|
||||
#endif /* PIOS_INCLUDE_FLASH */
|
||||
|
||||
/**
|
||||
|
@ -29,9 +29,14 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct PIOS_FLASHFS_Stats{
|
||||
uint16_t num_free_slots; /* slots in free state */
|
||||
uint16_t num_active_slots; /* slots in active state */
|
||||
};
|
||||
|
||||
int32_t PIOS_FLASHFS_Format(uintptr_t fs_id);
|
||||
int32_t PIOS_FLASHFS_ObjSave(uintptr_t fs_id, uint32_t obj_id, uint16_t obj_inst_id, uint8_t *obj_data, uint16_t obj_size);
|
||||
int32_t PIOS_FLASHFS_ObjLoad(uintptr_t fs_id, uint32_t obj_id, uint16_t obj_inst_id, uint8_t *obj_data, uint16_t obj_size);
|
||||
int32_t PIOS_FLASHFS_ObjDelete(uintptr_t fs_id, uint32_t obj_id, uint16_t obj_inst_id);
|
||||
|
||||
int32_t PIOS_FLASHFS_GetStats(uintptr_t fs_id, struct PIOS_FLASHFS_Stats *stats);
|
||||
#endif /* PIOS_FLASHFS_H */
|
||||
|
@ -77,7 +77,7 @@ uint32_t pios_com_hkosd_id;
|
||||
uint32_t pios_usb_rctx_id;
|
||||
|
||||
uintptr_t pios_uavo_settings_fs_id;
|
||||
|
||||
uintptr_t pios_user_fs_id = 0;
|
||||
/**
|
||||
* Configuration for MPU6000 chip
|
||||
*/
|
||||
|
@ -105,6 +105,7 @@ uint32_t pios_com_telem_usb_id;
|
||||
uint32_t pios_com_telem_rf_id;
|
||||
|
||||
uintptr_t pios_uavo_settings_fs_id;
|
||||
uintptr_t pios_user_fs_id = 0;
|
||||
|
||||
/**
|
||||
* TIM3 is triggered by the HSYNC signal into its ETR line and will divide the
|
||||
|
@ -9,9 +9,13 @@
|
||||
<field name="EventSystemWarningID" units="uavoid" type="uint32" elements="1"/>
|
||||
<field name="ObjectManagerCallbackID" units="uavoid" type="uint32" elements="1"/>
|
||||
<field name="ObjectManagerQueueID" units="uavoid" type="uint32" elements="1"/>
|
||||
<field name="SysSlotsFree" units="slots" type="uint16" elements="1"/>
|
||||
<field name="SysSlotsActive" units="slots" type="uint16" elements="1"/>
|
||||
<field name="UsrSlotsFree" units="slots" type="uint16" elements="1"/>
|
||||
<field name="UsrSlotsActive" units="slots" type="uint16" elements="1"/>
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
||||
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
|
||||
<logging updatemode="periodic" period="1000"/>
|
||||
</object>
|
||||
</xml>
|
||||
</xml>
|
Loading…
x
Reference in New Issue
Block a user