2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
30 #include "build/debug.h"
31 #include "build/version.h"
33 #include "drivers/time.h"
36 #include "cms/cms_types.h"
37 #include "cms/cms_menu_ledstrip.h"
39 #include "common/utils.h"
41 #include "config/feature.h"
43 #include "pg/pg_ids.h"
46 #include "fc/config.h"
47 #include "fc/rc_controls.h"
49 #include "flight/mixer.h"
53 #include "sensors/battery.h"
59 static long cmsx_menuRcConfirmBack(const OSD_Entry
*self
)
61 if (self
&& self
->type
== OME_Back
)
70 static OSD_Entry cmsx_menuRcEntries
[] =
72 { "-- RC PREV --", OME_Label
, NULL
, NULL
, 0},
74 { "ROLL", OME_INT16
, NULL
, &(OSD_INT16_t
){ &rcData
[ROLL
], 1, 2500, 0 }, DYNAMIC
},
75 { "PITCH", OME_INT16
, NULL
, &(OSD_INT16_t
){ &rcData
[PITCH
], 1, 2500, 0 }, DYNAMIC
},
76 { "THR", OME_INT16
, NULL
, &(OSD_INT16_t
){ &rcData
[THROTTLE
], 1, 2500, 0 }, DYNAMIC
},
77 { "YAW", OME_INT16
, NULL
, &(OSD_INT16_t
){ &rcData
[YAW
], 1, 2500, 0 }, DYNAMIC
},
79 { "AUX1", OME_INT16
, NULL
, &(OSD_INT16_t
){ &rcData
[AUX1
], 1, 2500, 0 }, DYNAMIC
},
80 { "AUX2", OME_INT16
, NULL
, &(OSD_INT16_t
){ &rcData
[AUX2
], 1, 2500, 0 }, DYNAMIC
},
81 { "AUX3", OME_INT16
, NULL
, &(OSD_INT16_t
){ &rcData
[AUX3
], 1, 2500, 0 }, DYNAMIC
},
82 { "AUX4", OME_INT16
, NULL
, &(OSD_INT16_t
){ &rcData
[AUX4
], 1, 2500, 0 }, DYNAMIC
},
84 { "BACK", OME_Back
, NULL
, NULL
, 0},
85 {NULL
, OME_END
, NULL
, NULL
, 0}
88 CMS_Menu cmsx_menuRcPreview
= {
90 .GUARD_text
= "XRCPREV",
91 .GUARD_type
= OME_MENU
,
94 .onExit
= cmsx_menuRcConfirmBack
,
95 .entries
= cmsx_menuRcEntries
98 static uint16_t motorConfig_minthrottle
;
99 static uint8_t motorConfig_digitalIdleOffsetValue
;
100 static debugType_e systemConfig_debug_mode
;
102 static long cmsx_menuMiscOnEnter(void)
104 motorConfig_minthrottle
= motorConfig()->minthrottle
;
105 motorConfig_digitalIdleOffsetValue
= motorConfig()->digitalIdleOffsetValue
/ 10;
106 systemConfig_debug_mode
= systemConfig()->debug_mode
;
111 static long cmsx_menuMiscOnExit(const OSD_Entry
*self
)
115 motorConfigMutable()->minthrottle
= motorConfig_minthrottle
;
116 motorConfigMutable()->digitalIdleOffsetValue
= 10 * motorConfig_digitalIdleOffsetValue
;
117 systemConfigMutable()->debug_mode
= systemConfig_debug_mode
;
122 static OSD_Entry menuMiscEntries
[]=
124 { "-- MISC --", OME_Label
, NULL
, NULL
, 0 },
126 { "MIN THR", OME_UINT16
, NULL
, &(OSD_UINT16_t
){ &motorConfig_minthrottle
, 1000, 2000, 1 }, 0 },
127 { "DIGITAL IDLE", OME_UINT8
, NULL
, &(OSD_UINT8_t
) { &motorConfig_digitalIdleOffsetValue
, 0, 200, 1 }, 0 },
128 { "DEBUG MODE", OME_TAB
, NULL
, &(OSD_TAB_t
) { &systemConfig_debug_mode
, DEBUG_COUNT
- 1, debugModeNames
}, 0 },
129 { "RC PREV", OME_Submenu
, cmsMenuChange
, &cmsx_menuRcPreview
, 0},
131 { "BACK", OME_Back
, NULL
, NULL
, 0},
132 { NULL
, OME_END
, NULL
, NULL
, 0}
135 CMS_Menu cmsx_menuMisc
= {
136 #ifdef CMS_MENU_DEBUG
137 .GUARD_text
= "XMISC",
138 .GUARD_type
= OME_MENU
,
140 .onEnter
= cmsx_menuMiscOnEnter
,
141 .onExit
= cmsx_menuMiscOnExit
,
142 .entries
= menuMiscEntries