1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Merge branch 'master' into msp-on-multiple-ports

Conflicts:
	src/main/config/config.c
	src/main/io/serial_msp.c
This commit is contained in:
Dominic Clifton 2014-08-22 22:30:33 +01:00
commit 4604403098
2 changed files with 11 additions and 6 deletions

View file

@ -210,6 +210,12 @@ void resetSerialConfig(serialConfig_t *serialConfig)
serialConfig->reboot_character = 'R'; serialConfig->reboot_character = 'R';
} }
static void setProfile(uint8_t profileIndex)
{
currentProfile = &masterConfig.profile[profileIndex];
}
// Default settings // Default settings
static void resetConf(void) static void resetConf(void)
{ {
@ -218,7 +224,7 @@ static void resetConf(void)
// Clear all configuration // Clear all configuration
memset(&masterConfig, 0, sizeof(master_t)); memset(&masterConfig, 0, sizeof(master_t));
memset(&currentProfile, 0, sizeof(profile_t)); setProfile(0);
masterConfig.version = EEPROM_CONF_VERSION; masterConfig.version = EEPROM_CONF_VERSION;
masterConfig.mixerConfiguration = MULTITYPE_QUADX; masterConfig.mixerConfiguration = MULTITYPE_QUADX;
@ -356,9 +362,9 @@ static void resetConf(void)
for (i = 0; i < MAX_SUPPORTED_MOTORS; i++) for (i = 0; i < MAX_SUPPORTED_MOTORS; i++)
masterConfig.customMixer[i].throttle = 0.0f; masterConfig.customMixer[i].throttle = 0.0f;
// copy default config into all 3 profiles // copy first profile into remaining profile
for (i = 0; i < 3; i++) for (i = 1; i < 3; i++)
memcpy(&masterConfig.profile[i], &currentProfile, sizeof(profile_t)); memcpy(&masterConfig.profile[i], currentProfile, sizeof(profile_t));
} }
static uint8_t calculateChecksum(const uint8_t *data, uint32_t length) static uint8_t calculateChecksum(const uint8_t *data, uint32_t length)
@ -530,7 +536,7 @@ void readEEPROM(void)
if (masterConfig.current_profile_index > 2) // sanity check if (masterConfig.current_profile_index > 2) // sanity check
masterConfig.current_profile_index = 0; masterConfig.current_profile_index = 0;
currentProfile = &masterConfig.profile[masterConfig.current_profile_index]; setProfile(masterConfig.current_profile_index);
validateAndFixConfig(); validateAndFixConfig();
activateConfig(); activateConfig();

View file

@ -817,7 +817,6 @@ static bool processInCommand(void)
headSerialError(0); headSerialError(0);
return true; return true;
} }
//copyCurrentProfileToProfileSlot(masterConfig.current_profile_index);
writeEEPROM(); writeEEPROM();
readEEPROM(); readEEPROM();
break; break;