Skip to content

Commit

Permalink
Merge pull request #2881 from iNavFlight/agh_make_free_ram_on_f3_grea…
Browse files Browse the repository at this point in the history
…t_again

Save 6952 bytes of RAM
  • Loading branch information
digitalentity authored Mar 7, 2018
2 parents ae05b1c + 26a04dc commit 4d44954
Show file tree
Hide file tree
Showing 21 changed files with 511 additions and 439 deletions.
200 changes: 125 additions & 75 deletions src/main/cms/cms.c

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions src/main/cms/cms_menu_blackbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,21 @@ static bool cmsx_Blackbox_Enabled(bool *enabled)
return featureConfigured(FEATURE_BLACKBOX);
}

static OSD_Entry cmsx_menuBlackboxEntries[] =
static const OSD_Entry cmsx_menuBlackboxEntries[] =
{
{ "-- BLACKBOX --", OME_Label, NULL, NULL, 0},
{ "ENABLED", OME_BoolFunc, NULL, cmsx_Blackbox_Enabled, 0 },
OSD_LABEL_ENTRY("-- BLACKBOX --"),
OSD_BOOL_FUNC_ENTRY("ENABLED", cmsx_Blackbox_Enabled),
OSD_SETTING_ENTRY("RATE DENOM", SETTING_BLACKBOX_RATE_DENOM),

#ifdef USE_FLASHFS
{ "ERASE FLASH",OME_Funcall, cmsx_EraseFlash, NULL, 0 },
OSD_FUNC_CALL_ENTRY("ERASE FLASH", cmsx_EraseFlash),
#endif // USE_FLASHFS

{ "BACK", OME_Back, NULL, NULL, 0 },
{ NULL, OME_END, NULL, NULL, 0 }
OSD_BACK_ENTRY,
OSD_END_ENTRY,
};

CMS_Menu cmsx_menuBlackbox = {
const CMS_Menu cmsx_menuBlackbox = {
#ifdef CMS_MENU_DEBUG
.GUARD_text = "MENUBB",
.GUARD_type = OME_MENU,
Expand Down
2 changes: 1 addition & 1 deletion src/main/cms/cms_menu_blackbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

#pragma once

extern CMS_Menu cmsx_menuBlackbox;
extern const CMS_Menu cmsx_menuBlackbox;
65 changes: 34 additions & 31 deletions src/main/cms/cms_menu_builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,18 @@ static long cmsx_InfoInit(void)
return 0;
}

static OSD_Entry menuInfoEntries[] = {
{ "--- INFO ---", OME_Label, NULL, NULL, 0 },
{ "FWID", OME_String, NULL, INAV_IDENTIFIER, 0 },
{ "FWVER", OME_String, NULL, FC_VERSION_STRING, 0 },
{ "GITREV", OME_String, NULL, infoGitRev, 0 },
{ "TARGET", OME_String, NULL, infoTargetName, 0 },
{ "BACK", OME_Back, NULL, NULL, 0 },
{ NULL, OME_END, NULL, NULL, 0 }
static const OSD_Entry menuInfoEntries[] = {
OSD_LABEL_ENTRY("--- INFO ---"),
OSD_STRING_ENTRY("FWID", INAV_IDENTIFIER),
OSD_STRING_ENTRY("FWVER", FC_VERSION_STRING),
OSD_STRING_ENTRY("GITREV", infoGitRev),
OSD_STRING_ENTRY("TARGET", infoTargetName),

OSD_BACK_ENTRY,
OSD_END_ENTRY,
};

static CMS_Menu menuInfo = {
static const CMS_Menu menuInfo = {
#ifdef CMS_MENU_DEBUG
.GUARD_text = "MENUINFO",
.GUARD_type = OME_MENU,
Expand All @@ -96,32 +97,33 @@ static CMS_Menu menuInfo = {

// Features

static OSD_Entry menuFeaturesEntries[] =
static const OSD_Entry menuFeaturesEntries[] =
{
{"--- FEATURES ---", OME_Label, NULL, NULL, 0},
{"BLACKBOX", OME_Submenu, cmsMenuChange, &cmsx_menuBlackbox, 0},
OSD_LABEL_ENTRY("--- FEATURES ---"),
OSD_SUBMENU_ENTRY("BLACKBOX", &cmsx_menuBlackbox),
#if defined(USE_NAV)
{"NAVIGATION", OME_Submenu, cmsMenuChange, &cmsx_menuNavigation, 0},
OSD_SUBMENU_ENTRY("NAVIGATION", &cmsx_menuNavigation),
#endif
#if defined(VTX) || defined(USE_RTC6705)
{"VTX", OME_Submenu, cmsMenuChange, &cmsx_menuVtx, 0},
OSD_SUBMENU_ENTRY("VTX", &cmsx_menuVtx),
#endif // VTX || USE_RTC6705
#if defined(VTX_CONTROL)
#if defined(VTX_SMARTAUDIO)
{"VTX SA", OME_Submenu, cmsMenuChange, &cmsx_menuVtxSmartAudio, 0},
OSD_SUBMENU_ENTRY("VTX SA", &cmsx_menuVtxSmartAudio),
#endif
#if defined(VTX_TRAMP)
{"VTX TR", OME_Submenu, cmsMenuChange, &cmsx_menuVtxTramp, 0},
OSD_SUBMENU_ENTRY("VTX TR", &cmsx_menuVtxTramp),
#endif
#endif // VTX_CONTROL
#ifdef USE_LED_STRIP
{"LED STRIP", OME_Submenu, cmsMenuChange, &cmsx_menuLedstrip, 0},
OSD_SUBMENU_ENTRY("LED STRIP", &cmsx_menuLedstrip),
#endif // LED_STRIP
{"BACK", OME_Back, NULL, NULL, 0},
{NULL, OME_END, NULL, NULL, 0}

OSD_BACK_ENTRY,
OSD_END_ENTRY,
};

static CMS_Menu menuFeatures = {
static const CMS_Menu menuFeatures = {
#ifdef CMS_MENU_DEBUG
.GUARD_text = "MENUFEATURES",
.GUARD_type = OME_MENU,
Expand All @@ -134,28 +136,29 @@ static CMS_Menu menuFeatures = {

// Main

static OSD_Entry menuMainEntries[] =
static const OSD_Entry menuMainEntries[] =
{
{"-- MAIN --", OME_Label, NULL, NULL, 0},
OSD_LABEL_ENTRY("-- MAIN --"),

{"PID TUNING", OME_Submenu, cmsMenuChange, &cmsx_menuImu, 0},
{"FEATURES", OME_Submenu, cmsMenuChange, &menuFeatures, 0},
OSD_SUBMENU_ENTRY("PID TUNING", &cmsx_menuImu),
OSD_SUBMENU_ENTRY("FEATURES", &menuFeatures),
#ifdef USE_OSD
{"SCR LAYOUT", OME_Submenu, cmsMenuChange, &cmsx_menuOsdLayout, 0},
{"ALARMS", OME_Submenu, cmsMenuChange, &cmsx_menuAlarms, 0},
OSD_SUBMENU_ENTRY("SCR LAYOUT", &cmsx_menuOsdLayout),
OSD_SUBMENU_ENTRY("ALARMS", &cmsx_menuAlarms),
#endif
{"FC&FW INFO", OME_Submenu, cmsMenuChange, &menuInfo, 0},
{"MISC", OME_Submenu, cmsMenuChange, &cmsx_menuMisc, 0},
OSD_SUBMENU_ENTRY("FC&FW INFO", &menuInfo),
OSD_SUBMENU_ENTRY("MISC", &cmsx_menuMisc),

{"SAVE&REBOOT", OME_OSD_Exit, cmsMenuExit, (void*)CMS_EXIT_SAVEREBOOT, 0},
{"EXIT", OME_OSD_Exit, cmsMenuExit, (void*)CMS_EXIT, 0},
#ifdef CMS_MENU_DEBUG
{"ERR SAMPLE", OME_Submenu, cmsMenuChange, &menuInfoEntries[0], 0},
OSD_SUBMENU_ENTRY("ERR SAMPLE", &menuInfoEntries[0]),
#endif

{NULL,OME_END, NULL, NULL, 0}
OSD_END_ENTRY,
};

CMS_Menu menuMain = {
const CMS_Menu menuMain = {
#ifdef CMS_MENU_DEBUG
.GUARD_text = "MENUMAIN",
.GUARD_type = OME_MENU,
Expand Down
2 changes: 1 addition & 1 deletion src/main/cms/cms_menu_builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

#include "cms/cms_types.h"

extern CMS_Menu menuMain;
extern const CMS_Menu menuMain;
Loading

0 comments on commit 4d44954

Please sign in to comment.