1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00

Add flash partitioning system

This commit is contained in:
Dominic Clifton 2019-05-11 01:21:13 +09:00 committed by jflyper
parent ba047e0559
commit 92999681e3
9 changed files with 215 additions and 56 deletions

View file

@ -126,9 +126,11 @@ static void cmsx_Blackbox_GetDeviceStatus(void)
if (storageDeviceIsWorking) {
tfp_sprintf(cmsx_BlackboxStatus, "READY");
const flashGeometry_t *geometry = flashfsGetGeometry();
const flashPartition_t *flashPartition = flashFindPartitionByUsage(FLASH_PARTITION_FLASHFS);
const flashGeometry_t *flashGeometry = flashGetGeometry();
storageUsed = flashfsGetOffset() / 1024;
storageFree = (geometry->totalSize / 1024) - storageUsed;
storageFree = ((FLASH_PARTITION_SECTOR_COUNT(flashPartition) * flashGeometry->sectorSize) / 1024) - storageUsed;
} else {
tfp_sprintf(cmsx_BlackboxStatus, "FAULT");
}