1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 20:35:33 +03:00

Revert left stick constraints and introduce context

This commit is contained in:
jflyper 2017-07-21 20:38:22 +09:00
parent e955fa9a84
commit 4a2ef89ea8
4 changed files with 17 additions and 6 deletions

View file

@ -130,7 +130,7 @@ static displayPort_t *cmsDisplayPortSelectNext(void)
#define RIGHT_MENU_COLUMN(p) ((p)->cols - 8) #define RIGHT_MENU_COLUMN(p) ((p)->cols - 8)
#define MAX_MENU_ITEMS(p) ((p)->rows - 2) #define MAX_MENU_ITEMS(p) ((p)->rows - 2)
static bool cmsInMenu = false; bool cmsInMenu = false;
typedef struct cmsCtx_s { typedef struct cmsCtx_s {
const CMS_Menu *menu; // menu for this context const CMS_Menu *menu; // menu for this context
@ -913,19 +913,19 @@ void cmsUpdate(uint32_t currentTimeUs)
if (IS_MID(THROTTLE) && IS_LO(YAW) && IS_HI(PITCH) && !ARMING_FLAG(ARMED)) { if (IS_MID(THROTTLE) && IS_LO(YAW) && IS_HI(PITCH) && !ARMING_FLAG(ARMED)) {
key = KEY_MENU; key = KEY_MENU;
} }
else if (IS_MID(THROTTLE) && IS_MID(YAW) && IS_MID(ROLL) && IS_HI(PITCH)) { else if (IS_HI(PITCH)) {
key = KEY_UP; key = KEY_UP;
} }
else if (IS_MID(THROTTLE) && IS_MID(YAW) && IS_MID(ROLL) && IS_LO(PITCH)) { else if (IS_LO(PITCH)) {
key = KEY_DOWN; key = KEY_DOWN;
} }
else if (IS_MID(THROTTLE) && IS_MID(YAW) && IS_LO(ROLL) && IS_MID(PITCH)) { else if (IS_LO(ROLL)) {
key = KEY_LEFT; key = KEY_LEFT;
} }
else if (IS_MID(THROTTLE) && IS_MID(YAW) && IS_HI(ROLL) && IS_MID(PITCH)) { else if (IS_HI(ROLL)) {
key = KEY_RIGHT; key = KEY_RIGHT;
} }
else if ((IS_HI(YAW) || IS_LO(YAW)) && IS_MID(THROTTLE) && IS_MID(ROLL) && IS_MID(PITCH)) else if (IS_HI(YAW) || IS_LO(YAW))
{ {
key = KEY_ESC; key = KEY_ESC;
} }

View file

@ -4,6 +4,8 @@
#include "common/time.h" #include "common/time.h"
extern bool cmsInMenu;
// Device management // Device management
bool cmsDisplayPortRegister(displayPort_t *pDisplay); bool cmsDisplayPortRegister(displayPort_t *pDisplay);

View file

@ -34,6 +34,8 @@
#include "config/parameter_group.h" #include "config/parameter_group.h"
#include "config/parameter_group_ids.h" #include "config/parameter_group_ids.h"
#include "cms/cms.h"
#include "drivers/camera_control.h" #include "drivers/camera_control.h"
#include "fc/config.h" #include "fc/config.h"
@ -124,6 +126,12 @@ void processRcStickPositions(throttleStatus_e throttleStatus)
uint8_t stTmp = 0; uint8_t stTmp = 0;
int i; int i;
#ifdef CMS
if (cmsInMenu) {
return;
}
#endif
// ------------------ STICKS COMMAND HANDLER -------------------- // ------------------ STICKS COMMAND HANDLER --------------------
// checking sticks positions // checking sticks positions
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {

View file

@ -695,6 +695,7 @@ void baroSetCalibrationCycles(uint16_t) {}
void blackboxLogEvent(FlightLogEvent, flightLogEventData_t *) {} void blackboxLogEvent(FlightLogEvent, flightLogEventData_t *) {}
bool cmsInMenu = false;
uint8_t armingFlags = 0; uint8_t armingFlags = 0;
int16_t heading; int16_t heading;
uint8_t stateFlags = 0; uint8_t stateFlags = 0;