1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

Merge pull request #4519 from martinbudden/bf_cms_size_optimise

Size optimise CMS modules. Improve const correctness
This commit is contained in:
Michael Keller 2017-11-10 07:43:56 +13:00 committed by GitHub
commit 2bc0d5bc93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View file

@ -271,6 +271,9 @@ SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
cms/cms_menu_ledstrip.c \ cms/cms_menu_ledstrip.c \
cms/cms_menu_misc.c \ cms/cms_menu_misc.c \
cms/cms_menu_osd.c \ cms/cms_menu_osd.c \
cms/cms_menu_vtx_rtc6705.c \
cms/cms_menu_vtx_smartaudio.c \
cms/cms_menu_vtx_tramp.c \
io/vtx_string.c \ io/vtx_string.c \
io/vtx_settings_config.c \ io/vtx_settings_config.c \
io/vtx_rtc6705.c \ io/vtx_rtc6705.c \

View file

@ -492,7 +492,7 @@ static void cmsDrawMenu(displayPort_t *pDisplay, uint32_t currentTimeUs)
static void cmsMenuCountPage(displayPort_t *pDisplay) static void cmsMenuCountPage(displayPort_t *pDisplay)
{ {
OSD_Entry *p; const OSD_Entry *p;
for (p = currentCtx.menu->entries; p->type != OME_END; p++); for (p = currentCtx.menu->entries; p->type != OME_END; p++);
pageCount = (p - currentCtx.menu->entries - 1) / MAX_MENU_ITEMS(pDisplay) + 1; pageCount = (p - currentCtx.menu->entries - 1) / MAX_MENU_ITEMS(pDisplay) + 1;
} }
@ -501,7 +501,7 @@ STATIC_UNIT_TESTED long cmsMenuBack(displayPort_t *pDisplay); // Forward; will b
long cmsMenuChange(displayPort_t *pDisplay, const void *ptr) long cmsMenuChange(displayPort_t *pDisplay, const void *ptr)
{ {
CMS_Menu *pMenu = (CMS_Menu *)ptr; const CMS_Menu *pMenu = (const CMS_Menu *)ptr;
if (!pMenu) { if (!pMenu) {
return 0; return 0;

View file

@ -55,7 +55,7 @@ typedef long (*CMSEntryFuncPtr)(displayPort_t *displayPort, const void *ptr);
typedef struct typedef struct
{ {
const char *text; const char * const text;
const OSD_MenuElement type; const OSD_MenuElement type;
const CMSEntryFuncPtr func; const CMSEntryFuncPtr func;
void *data; void *data;