1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

When in ACRO mode use trim sticks to adjust RATE profile

This commit is contained in:
Martin Budden 2017-11-15 09:03:39 +00:00
parent 75632daf6b
commit 36957d6075
3 changed files with 45 additions and 25 deletions

View file

@ -243,13 +243,13 @@ void processRcStickPositions(throttleStatus_e throttleStatus)
return; return;
} }
// Multiple configuration profiles // Change PID profile
int newPidProfile = 0; int newPidProfile = 0;
if (rcSticks == THR_LO + YAW_LO + PIT_CE + ROL_LO) { // ROLL left -> Profile 1 if (rcSticks == THR_LO + YAW_LO + PIT_CE + ROL_LO) { // ROLL left -> PID profile 1
newPidProfile = 1; newPidProfile = 1;
} else if (rcSticks == THR_LO + YAW_LO + PIT_HI + ROL_CE) { // PITCH up -> Profile 2 } else if (rcSticks == THR_LO + YAW_LO + PIT_HI + ROL_CE) { // PITCH up -> PID profile 2
newPidProfile = 2; newPidProfile = 2;
} else if (rcSticks == THR_LO + YAW_LO + PIT_CE + ROL_HI) { // ROLL right -> Profile 3 } else if (rcSticks == THR_LO + YAW_LO + PIT_CE + ROL_HI) { // ROLL right -> PID profile 3
newPidProfile = 3; newPidProfile = 3;
} }
if (newPidProfile) { if (newPidProfile) {
@ -275,7 +275,8 @@ void processRcStickPositions(throttleStatus_e throttleStatus)
} }
// Accelerometer Trim if (FLIGHT_MODE(ANGLE_MODE|HORIZON_MODE)) {
// in ANGLE or HORIZON mode, so use sticks to apply accelerometer trims
rollAndPitchTrims_t accelerometerTrimsDelta; rollAndPitchTrims_t accelerometerTrimsDelta;
memset(&accelerometerTrimsDelta, 0, sizeof(accelerometerTrimsDelta)); memset(&accelerometerTrimsDelta, 0, sizeof(accelerometerTrimsDelta));
@ -298,6 +299,23 @@ void processRcStickPositions(throttleStatus_e throttleStatus)
repeatAfter(STICK_AUTOREPEAT_MS); repeatAfter(STICK_AUTOREPEAT_MS);
return; return;
} }
} else {
// in ACRO mode, so use sticks to change RATE profile
switch (rcSticks) {
case THR_HI + YAW_CE + PIT_HI + ROL_CE:
changeControlRateProfile(0);
return;
case THR_HI + YAW_CE + PIT_LO + ROL_CE:
changeControlRateProfile(1);
return;
case THR_HI + YAW_CE + PIT_CE + ROL_HI:
changeControlRateProfile(2);
return;
case THR_HI + YAW_CE + PIT_CE + ROL_LO:
changeControlRateProfile(3);
return;
}
}
#ifdef USE_DASHBOARD #ifdef USE_DASHBOARD
if (rcSticks == THR_LO + YAW_CE + PIT_HI + ROL_LO) { if (rcSticks == THR_LO + YAW_CE + PIT_HI + ROL_LO) {

View file

@ -662,6 +662,7 @@ extern "C" {
void accSetCalibrationCycles(uint16_t) {} void accSetCalibrationCycles(uint16_t) {}
void baroSetCalibrationCycles(uint16_t) {} void baroSetCalibrationCycles(uint16_t) {}
void changePidProfile(uint8_t) {} void changePidProfile(uint8_t) {}
void changeControlRateProfile(uint8_t) {}
void dashboardEnablePageCycling(void) {} void dashboardEnablePageCycling(void) {}
void dashboardDisablePageCycling(void) {} void dashboardDisablePageCycling(void) {}
bool imuQuaternionHeadfreeOffsetSet(void) { return true; } bool imuQuaternionHeadfreeOffsetSet(void) { return true; }

View file

@ -699,6 +699,7 @@ void blackboxLogEvent(FlightLogEvent, flightLogEventData_t *) {}
bool cmsInMenu = false; bool cmsInMenu = false;
uint8_t armingFlags = 0; uint8_t armingFlags = 0;
uint16_t flightModeFlags = 0;
int16_t heading; int16_t heading;
uint8_t stateFlags = 0; uint8_t stateFlags = 0;
int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT]; int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT];