From 4e024f54670541220110c029df3a6e094335a300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=ADguel=20=C3=81ngel=20Mulero=20Mart=C3=ADnez?= Date: Sun, 15 Apr 2018 02:29:49 +0200 Subject: [PATCH] Fix MSP Flash FS supported (#5670) --- src/main/interface/msp.c | 8 +++++++- src/main/io/flashfs.c | 5 +++++ src/main/io/flashfs.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/interface/msp.c b/src/main/interface/msp.c index 61aacb3680..2f376ba636 100644 --- a/src/main/interface/msp.c +++ b/src/main/interface/msp.c @@ -149,6 +149,11 @@ typedef enum { MSP_SDCARD_FLAG_SUPPORTTED = 1 } mspSDCardFlags_e; +typedef enum { + MSP_FLASHFS_FLAG_READY = 1, + MSP_FLASHFS_FLAG_SUPPORTED = 2 +} mspFlashFsFlags_e; + #define RATEPROFILE_MASK (1 << 7) #endif //USE_OSD_SLAVE @@ -281,7 +286,8 @@ static void serializeDataflashSummaryReply(sbuf_t *dst) { #ifdef USE_FLASHFS const flashGeometry_t *geometry = flashfsGetGeometry(); - uint8_t flags = (flashfsIsReady() ? 1 : 0) | 2 /* FlashFS is supported */; + uint8_t flags = (flashfsIsReady() ? MSP_FLASHFS_FLAG_READY : 0); + flags |= (flashfsIsSupported() ? MSP_FLASHFS_FLAG_SUPPORTED : 0); sbufWriteU8(dst, flags); sbufWriteU32(dst, geometry->sectors); diff --git a/src/main/io/flashfs.c b/src/main/io/flashfs.c index 3d0b882bef..6f6eb45410 100644 --- a/src/main/io/flashfs.c +++ b/src/main/io/flashfs.c @@ -111,6 +111,11 @@ bool flashfsIsReady(void) return m25p16_isReady(); } +bool flashfsIsSupported(void) +{ + return flashfsGetSize() > 0; +} + uint32_t flashfsGetSize(void) { return m25p16_getGeometry()->totalSize; diff --git a/src/main/io/flashfs.h b/src/main/io/flashfs.h index 216c8c22e0..db3d0f3e01 100644 --- a/src/main/io/flashfs.h +++ b/src/main/io/flashfs.h @@ -46,6 +46,7 @@ bool flashfsFlushAsync(void); void flashfsFlushSync(void); void flashfsInit(void); +bool flashfsIsSupported(void); bool flashfsIsReady(void); bool flashfsIsEOF(void);