Added dummy PG. Fixed setting of profile

This commit is contained in:
Martin Budden 2016-12-29 17:15:16 +00:00 committed by borisbstyle
parent 029015afd8
commit 2aa89cf791
4 changed files with 19 additions and 7 deletions

View File

@ -35,6 +35,15 @@
#include "fc/config.h"
// declare a dummy PG, since scanEEPROM assumes there is at least one PG
// !!TODO remove once first PG has been created out of masterConfg
typedef struct dummpConfig_s {
uint8_t dummy;
} dummyConfig_t;
PG_DECLARE(dummyConfig_t, dummyConfig);
#define PG_DUMMY_CONFIG 1
PG_REGISTER(dummyConfig_t, dummyConfig, PG_DUMMY_CONFIG, 0);
extern uint8_t __config_start; // configured via linker script when building binaries.
extern uint8_t __config_end;

View File

@ -16,7 +16,7 @@
*/
// FC configuration
#define PG_FAILSAFE_CONFIG 1 // strruct OK
#define PG_FAILSAFE_CONFIG 1 // struct OK
#define PG_BOARD_ALIGNMENT 2 // struct OK
#define PG_GIMBAL_CONFIG 3 // struct OK
#define PG_MOTOR_MIXER 4 // two structs mixerConfig_t servoMixerConfig_t

View File

@ -550,7 +550,7 @@ uint8_t getCurrentProfile(void)
return masterConfig.current_profile_index;
}
void setProfile(uint8_t profileIndex)
static void setProfile(uint8_t profileIndex)
{
currentProfile = &masterConfig.profile[profileIndex];
currentControlRateProfileIndex = currentProfile->activeRateProfile;
@ -1139,10 +1139,14 @@ void readEEPROM(void)
failureMode(FAILURE_INVALID_EEPROM_CONTENTS);
}
pgActivateProfile(getCurrentProfile());
// pgActivateProfile(getCurrentProfile());
// setControlRateProfile(rateProfileSelection()->defaultRateProfileIndex);
setControlRateProfile(0);
if (masterConfig.current_profile_index > MAX_PROFILE_COUNT - 1) {// sanity check
masterConfig.current_profile_index = 0;
}
setProfile(masterConfig.current_profile_index);
validateAndFixConfig();
activateConfig();

View File

@ -82,7 +82,6 @@ void activateConfig(void);
uint8_t getCurrentProfile(void);
void changeProfile(uint8_t profileIndex);
void setProfile(uint8_t profileIndex);
struct profile_s;
void resetProfile(struct profile_s *profile);
@ -91,7 +90,7 @@ void changeControlRateProfile(uint8_t profileIndex);
bool canSoftwareSerialBeUsed(void);
uint16_t getCurrentMinthrottle(void);
struct master_s;
struct master_s;
void targetConfiguration(struct master_s *config);
void targetValidateConfiguration(struct master_s *config);