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

Merge remote-tracking branch 'origin/master' into dzikuvx-ez-tune

This commit is contained in:
Pawel Spychalski (DzikuVx) 2023-10-08 13:35:04 +02:00
commit a151d664b3
223 changed files with 2709 additions and 1755 deletions

View file

@ -108,6 +108,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)
@ -305,6 +306,7 @@ static void activateConfig(void)
{
activateControlRateConfig();
activateBatteryProfile();
activateMixerConfig();
resetAdjustmentStates();
@ -331,6 +333,7 @@ void readEEPROM(void)
setConfigProfile(getConfigProfile());
setConfigBatteryProfile(getConfigBatteryProfile());
setConfigMixerProfile(getConfigMixerProfile());
validateAndFixConfig();
activateConfig();
@ -473,6 +476,36 @@ 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;
return ret;
}
void setConfigMixerProfileAndWriteEEPROM(uint8_t profileIndex)
{
if (setConfigMixerProfile(profileIndex)) {
// profile has changed, so ensure current values saved before new profile is loaded
suspendRxSignal();
writeEEPROM();
readEEPROM();
resumeRxSignal();
}
beeperConfirmationBeeps(profileIndex + 1);
}
void setGyroCalibration(float getGyroZero[XYZ_AXIS_COUNT])
{
gyroConfigMutable()->gyro_zero_cal[X] = (int16_t) getGyroZero[X];