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

Increased number of rate profiles to 6

This commit is contained in:
Martin Budden 2017-10-09 22:07:55 +01:00
parent ab1812455f
commit 7acebf8b34
5 changed files with 10 additions and 2 deletions

View file

@ -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];

View file

@ -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,

View file

@ -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);
}

View file

@ -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

View file

@ -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; }
}