diff --git a/src/main/fc/config.h b/src/main/fc/config.h index 96b6065a96..ea73cd4b5e 100644 --- a/src/main/fc/config.h +++ b/src/main/fc/config.h @@ -35,6 +35,7 @@ typedef struct systemConfig_s { uint8_t activeRateProfile; uint8_t debug_mode; uint8_t task_statistics; + uint8_t rateProfile6PosSwitch; uint8_t cpu_overclock; uint8_t powerOnArmingGraceTime; // in seconds char boardIdentifier[sizeof(TARGET_BOARD_IDENTIFIER) + 1]; diff --git a/src/main/fc/controlrate_profile.h b/src/main/fc/controlrate_profile.h index 890e6614e9..7536856a71 100644 --- a/src/main/fc/controlrate_profile.h +++ b/src/main/fc/controlrate_profile.h @@ -21,7 +21,7 @@ #include "pg/pg.h" -#define CONTROL_RATE_PROFILE_COUNT 3 +#define CONTROL_RATE_PROFILE_COUNT 6 typedef enum { RATES_TYPE_BETAFLIGHT = 0, diff --git a/src/main/fc/rc_adjustments.c b/src/main/fc/rc_adjustments.c index f53eef8acb..d1342b2444 100644 --- a/src/main/fc/rc_adjustments.c +++ b/src/main/fc/rc_adjustments.c @@ -484,7 +484,11 @@ void processRcAdjustments(controlRateConfig_t *controlRateConfig) newValue = applyStepAdjustment(controlRateConfig, adjustmentFunction, delta); pidInitConfig(pidProfile); } else if (adjustmentState->config->mode == ADJUSTMENT_MODE_SELECT) { - const uint16_t rangeWidth = ((2100 - 900) / adjustmentState->config->data.switchPositions); + int switchPositions = adjustmentState->config->data.switchPositions; + if (adjustmentFunction == ADJUSTMENT_RATE_PROFILE && systemConfig()->rateProfile6PosSwitch) { + switchPositions = 6; + } + const uint16_t rangeWidth = (2100 - 900) / switchPositions; const uint8_t position = (constrain(rcData[channelIndex], 900, 2100 - 1) - 900) / rangeWidth; newValue = applySelectAdjustment(adjustmentFunction, position); } diff --git a/src/main/interface/settings.c b/src/main/interface/settings.c index 9e30393454..4dcfdfcc1b 100644 --- a/src/main/interface/settings.c +++ b/src/main/interface/settings.c @@ -782,6 +782,7 @@ const clivalue_t valueTable[] = { { "task_statistics", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, task_statistics) }, #endif { "debug_mode", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_DEBUG }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, debug_mode) }, + { "rate_6pos_switch", VAR_INT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, rateProfile6PosSwitch) }, #if defined(STM32F4) && !defined(DISABLE_OVERCLOCK) { "cpu_overclock", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, cpu_overclock) }, #endif diff --git a/src/test/unit/rc_controls_unittest.cc b/src/test/unit/rc_controls_unittest.cc index 45557e0cbd..04bad39a84 100644 --- a/src/test/unit/rc_controls_unittest.cc +++ b/src/test/unit/rc_controls_unittest.cc @@ -44,6 +44,7 @@ extern "C" { #include "flight/pid.h" + #include "fc/config.h" #include "fc/controlrate_profile.h" #include "fc/rc_modes.h" #include "fc/rc_adjustments.h" @@ -720,6 +721,7 @@ uint8_t stateFlags = 0; int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT]; rxRuntimeConfig_t rxRuntimeConfig; PG_REGISTER(blackboxConfig_t, blackboxConfig, PG_BLACKBOX_CONFIG, 0); +PG_REGISTER(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 2); void resetArmingDisabled(void) {} timeDelta_t getTaskDeltaTime(cfTaskId_e) { return 20000; } }