mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
Moved rate profiles out of pid profiles
This commit is contained in:
parent
ff40e8c844
commit
051c9cca48
16 changed files with 61 additions and 60 deletions
|
@ -1179,7 +1179,7 @@ static bool blackboxWriteSysinfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
const profile_t *currentProfile = &masterConfig.profile[systemConfig()->current_profile_index];
|
const profile_t *currentProfile = &masterConfig.profile[systemConfig()->current_profile_index];
|
||||||
const controlRateConfig_t *currentControlRateProfile = ¤tProfile->controlRateProfile[masterConfig.profile[systemConfig()->current_profile_index].activeRateProfile];
|
const controlRateConfig_t *currentControlRateProfile = controlRateProfiles(systemConfig()->activeRateProfile);
|
||||||
switch (xmitState.headerIndex) {
|
switch (xmitState.headerIndex) {
|
||||||
BLACKBOX_PRINT_HEADER_LINE("Firmware type:%s", "Cleanflight");
|
BLACKBOX_PRINT_HEADER_LINE("Firmware type:%s", "Cleanflight");
|
||||||
BLACKBOX_PRINT_HEADER_LINE("Firmware revision:%s %s (%s) %s", FC_FIRMWARE_NAME, FC_VERSION_STRING, shortGitRevision, targetName);
|
BLACKBOX_PRINT_HEADER_LINE("Firmware revision:%s %s (%s) %s", FC_FIRMWARE_NAME, FC_VERSION_STRING, shortGitRevision, targetName);
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
|
|
||||||
#include "drivers/system.h"
|
#include "drivers/system.h"
|
||||||
|
|
||||||
|
#include "fc/config.h"
|
||||||
|
|
||||||
#include "io/asyncfatfs/asyncfatfs.h"
|
#include "io/asyncfatfs/asyncfatfs.h"
|
||||||
#include "io/flashfs.h"
|
#include "io/flashfs.h"
|
||||||
#include "io/beeper.h"
|
#include "io/beeper.h"
|
||||||
|
|
|
@ -67,7 +67,7 @@ static long cmsx_menuImu_onEnter(void)
|
||||||
profileIndex = systemConfig()->current_profile_index;
|
profileIndex = systemConfig()->current_profile_index;
|
||||||
tmpProfileIndex = profileIndex + 1;
|
tmpProfileIndex = profileIndex + 1;
|
||||||
|
|
||||||
rateProfileIndex = masterConfig.profile[profileIndex].activeRateProfile;
|
rateProfileIndex = systemConfig()->activeRateProfile;
|
||||||
tmpRateProfileIndex = rateProfileIndex + 1;
|
tmpRateProfileIndex = rateProfileIndex + 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -78,7 +78,7 @@ static long cmsx_menuImu_onExit(const OSD_Entry *self)
|
||||||
UNUSED(self);
|
UNUSED(self);
|
||||||
|
|
||||||
systemConfigMutable()->current_profile_index = profileIndex;
|
systemConfigMutable()->current_profile_index = profileIndex;
|
||||||
masterConfig.profile[profileIndex].activeRateProfile = rateProfileIndex;
|
systemConfigMutable()->activeRateProfile = rateProfileIndex;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ static CMS_Menu cmsx_menuPid = {
|
||||||
|
|
||||||
static long cmsx_RateProfileRead(void)
|
static long cmsx_RateProfileRead(void)
|
||||||
{
|
{
|
||||||
memcpy(&rateProfile, &masterConfig.profile[profileIndex].controlRateProfile[rateProfileIndex], sizeof(controlRateConfig_t));
|
memcpy(&rateProfile, controlRateProfiles(rateProfileIndex), sizeof(controlRateConfig_t));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ static long cmsx_RateProfileWriteback(const OSD_Entry *self)
|
||||||
{
|
{
|
||||||
UNUSED(self);
|
UNUSED(self);
|
||||||
|
|
||||||
memcpy(&masterConfig.profile[profileIndex].controlRateProfile[rateProfileIndex], &rateProfile, sizeof(controlRateConfig_t));
|
memcpy(controlRateProfilesMutable(rateProfileIndex), &rateProfile, sizeof(controlRateConfig_t));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,16 +26,19 @@
|
||||||
|
|
||||||
#include "build/version.h"
|
#include "build/version.h"
|
||||||
|
|
||||||
#include "drivers/system.h"
|
#include "cms/cms.h"
|
||||||
|
#include "cms/cms_types.h"
|
||||||
|
#include "cms/cms_menu_ledstrip.h"
|
||||||
|
|
||||||
#include "config/config_profile.h"
|
#include "config/config_profile.h"
|
||||||
#include "config/feature.h"
|
#include "config/feature.h"
|
||||||
#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/system.h"
|
||||||
#include "cms/cms_types.h"
|
|
||||||
#include "cms/cms_menu_ledstrip.h"
|
#include "fc/config.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef LED_STRIP
|
#ifdef LED_STRIP
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
#include "config/parameter_group.h"
|
#include "config/parameter_group.h"
|
||||||
#include "config/parameter_group_ids.h"
|
#include "config/parameter_group_ids.h"
|
||||||
|
|
||||||
|
#include "fc/rc_controls.h"
|
||||||
|
|
||||||
#include "flight/mixer.h"
|
#include "flight/mixer.h"
|
||||||
|
|
||||||
#include "rx/rx.h"
|
#include "rx/rx.h"
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "drivers/display.h"
|
#include "drivers/display.h"
|
||||||
#include "drivers/serial.h"
|
#include "drivers/serial.h"
|
||||||
|
|
||||||
|
#include "fc/config.h"
|
||||||
#include "fc/rc_adjustments.h"
|
#include "fc/rc_adjustments.h"
|
||||||
#include "fc/rc_controls.h"
|
#include "fc/rc_controls.h"
|
||||||
#include "fc/fc_core.h"
|
#include "fc/fc_core.h"
|
||||||
|
@ -123,7 +124,6 @@
|
||||||
#define vtxConfig(x) (&masterConfig.vtxConfig)
|
#define vtxConfig(x) (&masterConfig.vtxConfig)
|
||||||
#define beeperConfig(x) (&masterConfig.beeperConfig)
|
#define beeperConfig(x) (&masterConfig.beeperConfig)
|
||||||
|
|
||||||
|
|
||||||
#define featureConfigMutable(x) (&masterConfig.featureConfig)
|
#define featureConfigMutable(x) (&masterConfig.featureConfig)
|
||||||
#define systemConfigMutable(x) (&masterConfig.systemConfig)
|
#define systemConfigMutable(x) (&masterConfig.systemConfig)
|
||||||
#define motorConfigMutable(x) (&masterConfig.motorConfig)
|
#define motorConfigMutable(x) (&masterConfig.motorConfig)
|
||||||
|
@ -179,12 +179,14 @@
|
||||||
#define rxFailsafeChannelConfigs(x) (&masterConfig.rxConfig.failsafe_channel_configurations[x])
|
#define rxFailsafeChannelConfigs(x) (&masterConfig.rxConfig.failsafe_channel_configurations[x])
|
||||||
#define osdConfig(x) (&masterConfig.osdProfile)
|
#define osdConfig(x) (&masterConfig.osdProfile)
|
||||||
#define modeActivationConditions(x) (&masterConfig.modeActivationProfile.modeActivationConditions[x])
|
#define modeActivationConditions(x) (&masterConfig.modeActivationProfile.modeActivationConditions[x])
|
||||||
|
#define controlRateProfiles(x) (&masterConfig.controlRateProfile[x])
|
||||||
|
|
||||||
#define servoParamsMutable(x) (&servoProfile()->servoConf[x])
|
#define servoParamsMutable(x) (&servoProfile()->servoConf[x])
|
||||||
#define adjustmentRangesMutable(x) (&masterConfig.adjustmentProfile.adjustmentRanges[x])
|
#define adjustmentRangesMutable(x) (&masterConfig.adjustmentProfile.adjustmentRanges[x])
|
||||||
#define rxFailsafeChannelConfigsMutable(x) (&masterConfig.rxConfig.>failsafe_channel_configurations[x])
|
#define rxFailsafeChannelConfigsMutable(x) (&masterConfig.rxConfig.>failsafe_channel_configurations[x])
|
||||||
#define osdConfigMutable(x) (&masterConfig.osdProfile)
|
#define osdConfigMutable(x) (&masterConfig.osdProfile)
|
||||||
#define modeActivationConditionsMutable(x) (&masterConfig.modeActivationProfile.modeActivationConditions[x])
|
#define modeActivationConditionsMutable(x) (&masterConfig.modeActivationProfile.modeActivationConditions[x])
|
||||||
|
#define controlRateProfilesMutable(x) (&masterConfig.controlRateProfile[x])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// System-wide
|
// System-wide
|
||||||
|
@ -301,6 +303,7 @@ typedef struct master_s {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
profile_t profile[MAX_PROFILE_COUNT];
|
profile_t profile[MAX_PROFILE_COUNT];
|
||||||
|
controlRateConfig_t controlRateProfile[MAX_RATEPROFILES];
|
||||||
|
|
||||||
modeActivationProfile_t modeActivationProfile;
|
modeActivationProfile_t modeActivationProfile;
|
||||||
adjustmentProfile_t adjustmentProfile;
|
adjustmentProfile_t adjustmentProfile;
|
||||||
|
|
|
@ -17,12 +17,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "fc/config.h"
|
|
||||||
#include "fc/rc_controls.h"
|
|
||||||
#include "flight/pid.h"
|
#include "flight/pid.h"
|
||||||
|
|
||||||
typedef struct profile_s {
|
typedef struct profile_s {
|
||||||
pidProfile_t pidProfile;
|
pidProfile_t pidProfile;
|
||||||
uint8_t activeRateProfile;
|
|
||||||
controlRateConfig_t controlRateProfile[MAX_RATEPROFILES];
|
|
||||||
} profile_t;
|
} profile_t;
|
||||||
|
|
|
@ -725,17 +725,17 @@ static const clivalue_t valueTable[] = {
|
||||||
{ "channel_forwarding_start", VAR_UINT8 | MASTER_VALUE, &channelForwardingConfig()->startChannel, .config.minmax = { AUX1, MAX_SUPPORTED_RC_CHANNEL_COUNT } },
|
{ "channel_forwarding_start", VAR_UINT8 | MASTER_VALUE, &channelForwardingConfig()->startChannel, .config.minmax = { AUX1, MAX_SUPPORTED_RC_CHANNEL_COUNT } },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{ "rc_rate", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].rcRate8, .config.minmax = { 0, 255 } },
|
{ "rc_rate", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.controlRateProfile[0].rcRate8, .config.minmax = { 0, 255 } },
|
||||||
{ "rc_rate_yaw", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].rcYawRate8, .config.minmax = { 0, 255 } },
|
{ "rc_rate_yaw", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.controlRateProfile[0].rcYawRate8, .config.minmax = { 0, 255 } },
|
||||||
{ "rc_expo", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].rcExpo8, .config.minmax = { 0, 100 } },
|
{ "rc_expo", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.controlRateProfile[0].rcExpo8, .config.minmax = { 0, 100 } },
|
||||||
{ "rc_yaw_expo", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].rcYawExpo8, .config.minmax = { 0, 100 } },
|
{ "rc_yaw_expo", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.controlRateProfile[0].rcYawExpo8, .config.minmax = { 0, 100 } },
|
||||||
{ "thr_mid", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].thrMid8, .config.minmax = { 0, 100 } },
|
{ "thr_mid", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.controlRateProfile[0].thrMid8, .config.minmax = { 0, 100 } },
|
||||||
{ "thr_expo", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].thrExpo8, .config.minmax = { 0, 100 } },
|
{ "thr_expo", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.controlRateProfile[0].thrExpo8, .config.minmax = { 0, 100 } },
|
||||||
{ "roll_srate", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].rates[FD_ROLL], .config.minmax = { 0, CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_MAX } },
|
{ "roll_srate", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.controlRateProfile[0].rates[FD_ROLL], .config.minmax = { 0, CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_MAX } },
|
||||||
{ "pitch_srate", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].rates[FD_PITCH], .config.minmax = { 0, CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_MAX } },
|
{ "pitch_srate", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.controlRateProfile[0].rates[FD_PITCH], .config.minmax = { 0, CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_MAX } },
|
||||||
{ "yaw_srate", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].rates[FD_YAW], .config.minmax = { 0, CONTROL_RATE_CONFIG_YAW_RATE_MAX } },
|
{ "yaw_srate", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.controlRateProfile[0].rates[FD_YAW], .config.minmax = { 0, CONTROL_RATE_CONFIG_YAW_RATE_MAX } },
|
||||||
{ "tpa_rate", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].dynThrPID, .config.minmax = { 0, CONTROL_RATE_CONFIG_TPA_MAX} },
|
{ "tpa_rate", VAR_UINT8 | PROFILE_RATE_VALUE, &masterConfig.controlRateProfile[0].dynThrPID, .config.minmax = { 0, CONTROL_RATE_CONFIG_TPA_MAX} },
|
||||||
{ "tpa_breakpoint", VAR_UINT16 | PROFILE_RATE_VALUE, &masterConfig.profile[0].controlRateProfile[0].tpa_breakpoint, .config.minmax = { PWM_RANGE_MIN, PWM_RANGE_MAX} },
|
{ "tpa_breakpoint", VAR_UINT16 | PROFILE_RATE_VALUE, &masterConfig.controlRateProfile[0].tpa_breakpoint, .config.minmax = { PWM_RANGE_MIN, PWM_RANGE_MAX} },
|
||||||
{ "airmode_start_throttle", VAR_UINT16 | MASTER_VALUE, &rxConfig()->airModeActivateThreshold, .config.minmax = {1000, 2000 } },
|
{ "airmode_start_throttle", VAR_UINT16 | MASTER_VALUE, &rxConfig()->airModeActivateThreshold, .config.minmax = {1000, 2000 } },
|
||||||
|
|
||||||
{ "failsafe_delay", VAR_UINT8 | MASTER_VALUE, &failsafeConfig()->failsafe_delay, .config.minmax = { 0, 200 } },
|
{ "failsafe_delay", VAR_UINT8 | MASTER_VALUE, &failsafeConfig()->failsafe_delay, .config.minmax = { 0, 200 } },
|
||||||
|
@ -4127,12 +4127,12 @@ static void printConfig(char *cmdline, bool doDiff)
|
||||||
dumpValues(MASTER_VALUE, dumpMask, &defaultConfig);
|
dumpValues(MASTER_VALUE, dumpMask, &defaultConfig);
|
||||||
|
|
||||||
if (dumpMask & DUMP_ALL) {
|
if (dumpMask & DUMP_ALL) {
|
||||||
uint8_t activeProfile = systemConfig()->current_profile_index;
|
const uint8_t activeProfile = systemConfig()->current_profile_index;
|
||||||
for (uint32_t profileCount=0; profileCount<MAX_PROFILE_COUNT;profileCount++) {
|
for (uint32_t profileCount=0; profileCount<MAX_PROFILE_COUNT;profileCount++) {
|
||||||
cliDumpProfile(profileCount, dumpMask, &defaultConfig);
|
cliDumpProfile(profileCount, dumpMask, &defaultConfig);
|
||||||
|
|
||||||
uint8_t currentRateIndex = currentProfile->activeRateProfile;
|
const uint8_t currentRateIndex = systemConfig()->activeRateProfile;
|
||||||
for (uint32_t rateCount = 0; rateCount<MAX_RATEPROFILES; rateCount++) {
|
for (uint32_t rateCount = 0; rateCount < MAX_RATEPROFILES; rateCount++) {
|
||||||
cliDumpRateProfile(rateCount, dumpMask, &defaultConfig);
|
cliDumpRateProfile(rateCount, dumpMask, &defaultConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4149,7 +4149,7 @@ static void printConfig(char *cmdline, bool doDiff)
|
||||||
cliPrint("save");
|
cliPrint("save");
|
||||||
} else {
|
} else {
|
||||||
cliDumpProfile(systemConfig()->current_profile_index, dumpMask, &defaultConfig);
|
cliDumpProfile(systemConfig()->current_profile_index, dumpMask, &defaultConfig);
|
||||||
cliDumpRateProfile(currentProfile->activeRateProfile, dumpMask, &defaultConfig);
|
cliDumpRateProfile(systemConfig()->activeRateProfile, dumpMask, &defaultConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4158,7 +4158,7 @@ static void printConfig(char *cmdline, bool doDiff)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dumpMask & DUMP_RATES) {
|
if (dumpMask & DUMP_RATES) {
|
||||||
cliDumpRateProfile(currentProfile->activeRateProfile, dumpMask, &defaultConfig);
|
cliDumpRateProfile(systemConfig()->activeRateProfile, dumpMask, &defaultConfig);
|
||||||
}
|
}
|
||||||
#ifdef USE_PARAMETER_GROUPS
|
#ifdef USE_PARAMETER_GROUPS
|
||||||
// restore configs from copies
|
// restore configs from copies
|
||||||
|
|
|
@ -131,7 +131,7 @@ static void resetCompassConfig(compassConfig_t* compassConfig)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void resetControlRateConfig(controlRateConfig_t *controlRateConfig)
|
static void resetControlRateProfile(controlRateConfig_t *controlRateConfig)
|
||||||
{
|
{
|
||||||
controlRateConfig->rcRate8 = 100;
|
controlRateConfig->rcRate8 = 100;
|
||||||
controlRateConfig->rcYawRate8 = 100;
|
controlRateConfig->rcYawRate8 = 100;
|
||||||
|
@ -201,12 +201,6 @@ static void resetPidProfile(pidProfile_t *pidProfile)
|
||||||
void resetProfile(profile_t *profile)
|
void resetProfile(profile_t *profile)
|
||||||
{
|
{
|
||||||
resetPidProfile(&profile->pidProfile);
|
resetPidProfile(&profile->pidProfile);
|
||||||
|
|
||||||
for (int rI = 0; rI<MAX_RATEPROFILES; rI++) {
|
|
||||||
resetControlRateConfig(&profile->controlRateProfile[rI]);
|
|
||||||
}
|
|
||||||
|
|
||||||
profile->activeRateProfile = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GPS
|
#ifdef GPS
|
||||||
|
@ -730,8 +724,6 @@ uint8_t getCurrentProfile(void)
|
||||||
static void setProfile(uint8_t profileIndex)
|
static void setProfile(uint8_t profileIndex)
|
||||||
{
|
{
|
||||||
currentProfile = &masterConfig.profile[profileIndex];
|
currentProfile = &masterConfig.profile[profileIndex];
|
||||||
currentControlRateProfileIndex = currentProfile->activeRateProfile;
|
|
||||||
currentControlRateProfile = ¤tProfile->controlRateProfile[currentControlRateProfileIndex];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t getCurrentControlRateProfile(void)
|
uint8_t getCurrentControlRateProfile(void)
|
||||||
|
@ -739,16 +731,16 @@ uint8_t getCurrentControlRateProfile(void)
|
||||||
return currentControlRateProfileIndex;
|
return currentControlRateProfileIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setControlRateProfile(uint8_t profileIndex)
|
static void setControlRateProfile(uint8_t controlRateProfileIndex)
|
||||||
{
|
{
|
||||||
currentControlRateProfileIndex = profileIndex;
|
systemConfigMutable()->activeRateProfile = controlRateProfileIndex;
|
||||||
masterConfig.profile[getCurrentProfile()].activeRateProfile = profileIndex;
|
currentControlRateProfileIndex = controlRateProfileIndex;
|
||||||
currentControlRateProfile = &masterConfig.profile[getCurrentProfile()].controlRateProfile[profileIndex];
|
currentControlRateProfile = controlRateProfilesMutable(controlRateProfileIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
controlRateConfig_t *getControlRateConfig(uint8_t profileIndex)
|
const controlRateConfig_t *getControlRateConfig(uint8_t controlRateProfileIndex)
|
||||||
{
|
{
|
||||||
return &masterConfig.profile[profileIndex].controlRateProfile[masterConfig.profile[profileIndex].activeRateProfile];
|
return controlRateProfiles(controlRateProfileIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getCurrentMinthrottle(void)
|
uint16_t getCurrentMinthrottle(void)
|
||||||
|
@ -948,6 +940,7 @@ void createDefaultConfig(master_t *config)
|
||||||
resetSerialConfig(&config->serialConfig);
|
resetSerialConfig(&config->serialConfig);
|
||||||
|
|
||||||
resetProfile(&config->profile[0]);
|
resetProfile(&config->profile[0]);
|
||||||
|
resetControlRateProfile(&config->controlRateProfile[0]);
|
||||||
|
|
||||||
config->compassConfig.mag_declination = 0;
|
config->compassConfig.mag_declination = 0;
|
||||||
|
|
||||||
|
@ -1267,7 +1260,7 @@ void readEEPROM(void)
|
||||||
// setControlRateProfile(rateProfileSelection()->defaultRateProfileIndex);
|
// setControlRateProfile(rateProfileSelection()->defaultRateProfileIndex);
|
||||||
|
|
||||||
if (systemConfig()->current_profile_index > MAX_PROFILE_COUNT - 1) {// sanity check
|
if (systemConfig()->current_profile_index > MAX_PROFILE_COUNT - 1) {// sanity check
|
||||||
systemConfig()->current_profile_index = 0;
|
systemConfigMutable()->current_profile_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
setProfile(systemConfig()->current_profile_index);
|
setProfile(systemConfig()->current_profile_index);
|
||||||
|
@ -1313,7 +1306,7 @@ void changeProfile(uint8_t profileIndex)
|
||||||
if (profileIndex >= MAX_PROFILE_COUNT) {
|
if (profileIndex >= MAX_PROFILE_COUNT) {
|
||||||
profileIndex = MAX_PROFILE_COUNT - 1;
|
profileIndex = MAX_PROFILE_COUNT - 1;
|
||||||
}
|
}
|
||||||
systemConfig()->current_profile_index = profileIndex;
|
systemConfigMutable()->current_profile_index = profileIndex;
|
||||||
writeEEPROM();
|
writeEEPROM();
|
||||||
readEEPROM();
|
readEEPROM();
|
||||||
beeperConfirmationBeeps(profileIndex + 1);
|
beeperConfirmationBeeps(profileIndex + 1);
|
||||||
|
|
|
@ -71,6 +71,7 @@ typedef enum {
|
||||||
|
|
||||||
typedef struct systemConfig_s {
|
typedef struct systemConfig_s {
|
||||||
uint8_t current_profile_index;
|
uint8_t current_profile_index;
|
||||||
|
uint8_t activeRateProfile;
|
||||||
uint8_t debug_mode;
|
uint8_t debug_mode;
|
||||||
uint8_t task_statistics;
|
uint8_t task_statistics;
|
||||||
char name[MAX_NAME_LENGTH + 1];
|
char name[MAX_NAME_LENGTH + 1];
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include "config/parameter_group.h"
|
||||||
|
|
||||||
#define MAX_PID_PROCESS_DENOM 16
|
#define MAX_PID_PROCESS_DENOM 16
|
||||||
#define PID_CONTROLLER_BETAFLIGHT 1
|
#define PID_CONTROLLER_BETAFLIGHT 1
|
||||||
|
|
|
@ -394,7 +394,7 @@ static void osdDrawSingleElement(uint8_t item)
|
||||||
case OSD_PIDRATE_PROFILE:
|
case OSD_PIDRATE_PROFILE:
|
||||||
{
|
{
|
||||||
const uint8_t profileIndex = systemConfig()->current_profile_index;
|
const uint8_t profileIndex = systemConfig()->current_profile_index;
|
||||||
const uint8_t rateProfileIndex = masterConfig.profile[profileIndex].activeRateProfile;
|
const uint8_t rateProfileIndex = systemConfig()->activeRateProfile;
|
||||||
sprintf(buff, "%d-%d", profileIndex + 1, rateProfileIndex + 1);
|
sprintf(buff, "%d-%d", profileIndex + 1, rateProfileIndex + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,8 @@ void targetConfiguration(master_t *config)
|
||||||
//config->rcControlsConfig.yaw_deadband = 10;
|
//config->rcControlsConfig.yaw_deadband = 10;
|
||||||
config->compassConfig.mag_hardware = 1;
|
config->compassConfig.mag_hardware = 1;
|
||||||
|
|
||||||
config->profile[0].controlRateProfile[0].dynThrPID = 45;
|
config->controlRateProfile[0].dynThrPID = 45;
|
||||||
config->profile[0].controlRateProfile[0].tpa_breakpoint = 1700;
|
config->controlRateProfile[0].tpa_breakpoint = 1700;
|
||||||
config->serialConfig.portConfigs[2].functionMask = FUNCTION_RX_SERIAL;
|
config->serialConfig.portConfigs[2].functionMask = FUNCTION_RX_SERIAL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -95,9 +95,9 @@ void targetConfiguration(master_t *config)
|
||||||
config->profile[0].pidProfile.I8[YAW] = 50;
|
config->profile[0].pidProfile.I8[YAW] = 50;
|
||||||
config->profile[0].pidProfile.D8[YAW] = 20;
|
config->profile[0].pidProfile.D8[YAW] = 20;
|
||||||
|
|
||||||
config->profile[0].controlRateProfile[0].rates[FD_ROLL] = 86;
|
config->controlRateProfile[0].rates[FD_ROLL] = 86;
|
||||||
config->profile[0].controlRateProfile[0].rates[FD_PITCH] = 86;
|
config->controlRateProfile[0].rates[FD_PITCH] = 86;
|
||||||
config->profile[0].controlRateProfile[0].rates[FD_YAW] = 80;
|
config->controlRateProfile[0].rates[FD_YAW] = 80;
|
||||||
|
|
||||||
targetApplyDefaultLedStripConfig(config->ledStripConfig.ledConfigs);
|
targetApplyDefaultLedStripConfig(config->ledStripConfig.ledConfigs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ void targetConfiguration(master_t *config)
|
||||||
config->profile[0].pidProfile.I8[PITCH] = 62;
|
config->profile[0].pidProfile.I8[PITCH] = 62;
|
||||||
config->profile[0].pidProfile.D8[PITCH] = 19;
|
config->profile[0].pidProfile.D8[PITCH] = 19;
|
||||||
|
|
||||||
config->profile[0].controlRateProfile[0].rcRate8 = 70;
|
config->controlRateProfile[0].rcRate8 = 70;
|
||||||
config->profile[0].pidProfile.I8[PIDLEVEL] = 40;
|
config->profile[0].pidProfile.I8[PIDLEVEL] = 40;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,12 +73,12 @@ void targetConfiguration(master_t *config)
|
||||||
config->profile[profileId].pidProfile.D8[PIDLEVEL] = 30;
|
config->profile[profileId].pidProfile.D8[PIDLEVEL] = 30;
|
||||||
|
|
||||||
for (int rateProfileId = 0; rateProfileId < MAX_RATEPROFILES; rateProfileId++) {
|
for (int rateProfileId = 0; rateProfileId < MAX_RATEPROFILES; rateProfileId++) {
|
||||||
config->profile[profileId].controlRateProfile[rateProfileId].rcRate8 = 100;
|
config->controlRateProfile[rateProfileId].rcRate8 = 100;
|
||||||
config->profile[profileId].controlRateProfile[rateProfileId].rcYawRate8 = 110;
|
config->controlRateProfile[rateProfileId].rcYawRate8 = 110;
|
||||||
config->profile[profileId].controlRateProfile[rateProfileId].rcExpo8 = 0;
|
config->controlRateProfile[rateProfileId].rcExpo8 = 0;
|
||||||
config->profile[profileId].controlRateProfile[rateProfileId].rates[ROLL] = 77;
|
config->controlRateProfile[rateProfileId].rates[ROLL] = 77;
|
||||||
config->profile[profileId].controlRateProfile[rateProfileId].rates[PITCH] = 77;
|
config->controlRateProfile[rateProfileId].rates[PITCH] = 77;
|
||||||
config->profile[profileId].controlRateProfile[rateProfileId].rates[YAW] = 80;
|
config->controlRateProfile[rateProfileId].rates[YAW] = 80;
|
||||||
|
|
||||||
config->profile[profileId].pidProfile.dtermSetpointWeight = 200;
|
config->profile[profileId].pidProfile.dtermSetpointWeight = 200;
|
||||||
config->profile[profileId].pidProfile.setpointRelaxRatio = 50;
|
config->profile[profileId].pidProfile.setpointRelaxRatio = 50;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue