1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-26 09:45:33 +03:00

mixer profile switching by cli

This commit is contained in:
shota 2022-11-06 02:28:52 +09:00
parent c398c526ec
commit 0b247d9bfc
12 changed files with 123 additions and 19 deletions

View file

@ -107,6 +107,7 @@ PG_REGISTER_WITH_RESET_TEMPLATE(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG,
PG_RESET_TEMPLATE(systemConfig_t, systemConfig,
.current_profile_index = 0,
.current_battery_profile_index = 0,
.current_mixer_profile_index = 0,
.debug_mode = SETTING_DEBUG_MODE_DEFAULT,
#ifdef USE_DEV_TOOLS
.groundTestMode = SETTING_GROUND_TEST_MODE_DEFAULT, // disables motors, set heading trusted for FW (for dev use)
@ -417,6 +418,35 @@ void setConfigBatteryProfileAndWriteEEPROM(uint8_t profileIndex)
beeperConfirmationBeeps(profileIndex + 1);
}
uint8_t getConfigMixerProfile(void)
{
return systemConfig()->current_mixer_profile_index;
}
bool setConfigMixerProfile(uint8_t profileIndex)
{
bool ret = true; // return true if current_mixer_profile_index has changed
if (systemConfig()->current_mixer_profile_index == profileIndex) {
ret = false;
}
if (profileIndex >= MAX_MIXER_PROFILE_COUNT) {// sanity check
profileIndex = 0;
}
systemConfigMutable()->current_mixer_profile_index = profileIndex;
// setMixerProfile(profileIndex);
return ret;
}
void setConfigMixerProfileAndWriteEEPROM(uint8_t profileIndex)
{
if (setConfigMixerProfile(profileIndex)) {
// profile has changed, so ensure current values saved before new profile is loaded
writeEEPROM();
readEEPROM();
}
beeperConfirmationBeeps(profileIndex + 1);
}
void setGyroCalibrationAndWriteEEPROM(int16_t getGyroZero[XYZ_AXIS_COUNT]) {
gyroConfigMutable()->gyro_zero_cal[X] = getGyroZero[X];
gyroConfigMutable()->gyro_zero_cal[Y] = getGyroZero[Y];