mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
Preparation for conversion to parameter groups 14
This commit is contained in:
parent
743b3e37e3
commit
c67d6eb4f1
11 changed files with 174 additions and 66 deletions
|
@ -22,16 +22,18 @@
|
|||
|
||||
#include "platform.h"
|
||||
|
||||
#include "build/version.h"
|
||||
|
||||
#ifdef CMS
|
||||
|
||||
#include "build/version.h"
|
||||
|
||||
#include "drivers/system.h"
|
||||
|
||||
#include "cms/cms.h"
|
||||
#include "cms/cms_types.h"
|
||||
#include "cms/cms_menu_ledstrip.h"
|
||||
|
||||
#include "common/utils.h"
|
||||
|
||||
#include "config/config_profile.h"
|
||||
#include "config/feature.h"
|
||||
#include "config/parameter_group.h"
|
||||
|
@ -43,7 +45,6 @@
|
|||
|
||||
#include "sensors/battery.h"
|
||||
|
||||
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
|
@ -86,14 +87,35 @@ CMS_Menu cmsx_menuRcPreview = {
|
|||
.entries = cmsx_menuRcEntries
|
||||
};
|
||||
|
||||
static uint16_t motorConfig_minthrottle;
|
||||
static uint8_t batteryConfig_vbatscale;
|
||||
static uint8_t batteryConfig_vbatmaxcellvoltage;
|
||||
|
||||
static long cmsx_menuMiscOnEnter(void)
|
||||
{
|
||||
motorConfig_minthrottle = motorConfig()->minthrottle;
|
||||
batteryConfig_vbatscale = batteryConfig()->vbatscale;
|
||||
batteryConfig_vbatmaxcellvoltage = batteryConfig()->vbatmaxcellvoltage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long cmsx_menuMiscOnExit(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
motorConfigMutable()->minthrottle = motorConfig_minthrottle;
|
||||
batteryConfigMutable()->vbatscale = batteryConfig_vbatscale;
|
||||
batteryConfigMutable()->vbatmaxcellvoltage = batteryConfig_vbatmaxcellvoltage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static OSD_Entry menuMiscEntries[]=
|
||||
{
|
||||
{ "-- MISC --", OME_Label, NULL, NULL, 0 },
|
||||
|
||||
{ "MIN THR", OME_UINT16, NULL, &(OSD_UINT16_t){ &motorConfig()->minthrottle, 1000, 2000, 1 }, 0 },
|
||||
{ "VBAT SCALE", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryConfig()->vbatscale, 1, 250, 1 }, 0 },
|
||||
{ "VBAT CLMAX", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryConfig()->vbatmaxcellvoltage, 10, 50, 1 }, 0 },
|
||||
{ "MIN THR", OME_UINT16, NULL, &(OSD_UINT16_t){ &motorConfig_minthrottle, 1000, 2000, 1 }, 0 },
|
||||
{ "VBAT SCALE", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryConfig_vbatscale, 1, 250, 1 }, 0 },
|
||||
{ "VBAT CLMAX", OME_UINT8, NULL, &(OSD_UINT8_t) { &batteryConfig_vbatmaxcellvoltage, 10, 50, 1 }, 0 },
|
||||
{ "RC PREV", OME_Submenu, cmsMenuChange, &cmsx_menuRcPreview, 0},
|
||||
|
||||
{ "BACK", OME_Back, NULL, NULL, 0},
|
||||
|
@ -103,8 +125,8 @@ static OSD_Entry menuMiscEntries[]=
|
|||
CMS_Menu cmsx_menuMisc = {
|
||||
.GUARD_text = "XMISC",
|
||||
.GUARD_type = OME_MENU,
|
||||
.onEnter = NULL,
|
||||
.onExit = NULL,
|
||||
.onEnter = cmsx_menuMiscOnEnter,
|
||||
.onExit = cmsx_menuMiscOnExit,
|
||||
.onGlobalExit = NULL,
|
||||
.entries = menuMiscEntries
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue