2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
19 // CMS things for blackbox and flashfs.
29 #include "blackbox/blackbox.h"
32 #include "cms/cms_types.h"
33 #include "cms/cms_menu_blackbox.h"
35 #include "common/utils.h"
37 #include "config/feature.h"
39 #include "drivers/flash.h"
40 #include "drivers/time.h"
42 #include "fc/config.h"
43 #include "fc/settings.h"
45 #include "io/flashfs.h"
48 static long cmsx_EraseFlash(displayPort_t
*pDisplay
, const void *ptr
)
52 displayClearScreen(pDisplay
);
53 displayWrite(pDisplay
, 5, 3, "ERASING FLASH...");
54 displayResync(pDisplay
); // Was max7456RefreshAll(); Why at this timing?
56 flashfsEraseCompletely();
57 while (!flashIsReady()) {
61 displayClearScreen(pDisplay
);
62 displayResync(pDisplay
); // Was max7456RefreshAll(); wedges during heavy SPI?
68 static bool cmsx_Blackbox_Enabled(bool *enabled
)
72 featureSet(FEATURE_BLACKBOX
);
74 featureClear(FEATURE_BLACKBOX
);
77 return featureConfigured(FEATURE_BLACKBOX
);
80 static const OSD_Entry cmsx_menuBlackboxEntries
[] =
82 OSD_LABEL_ENTRY("-- BLACKBOX --"),
83 OSD_BOOL_FUNC_ENTRY("ENABLED", cmsx_Blackbox_Enabled
),
84 OSD_SETTING_ENTRY("RATE DENOM", SETTING_BLACKBOX_RATE_DENOM
),
87 OSD_FUNC_CALL_ENTRY("ERASE FLASH", cmsx_EraseFlash
),
90 OSD_BACK_AND_END_ENTRY
,
93 const CMS_Menu cmsx_menuBlackbox
= {
95 .GUARD_text
= "MENUBB",
96 .GUARD_type
= OME_MENU
,
100 .onGlobalExit
= NULL
,
101 .entries
= cmsx_menuBlackboxEntries