1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

LP-550 Set OptionalModules>ModuleName to Enabled if module is builtin.

This commit is contained in:
Laurent Lalanne 2017-10-29 15:41:57 +01:00
parent 8c9cd5d0ec
commit 8da65e8068
6 changed files with 35 additions and 20 deletions

View File

@ -93,15 +93,16 @@ int32_t AirspeedStart()
*/
int32_t AirspeedInitialize()
{
HwSettingsOptionalModulesData optionalModules;
HwSettingsOptionalModulesGet(&optionalModules);
#ifdef MODULE_AIRSPEED_BUILTIN
airspeedEnabled = true;
optionalModules.Airspeed = HWSETTINGS_OPTIONALMODULES_ENABLED;
HwSettingsOptionalModulesSet(&optionalModules);
#else
HwSettingsOptionalModulesOptions optionalModules[HWSETTINGS_OPTIONALMODULES_NUMELEM];
HwSettingsOptionalModulesArrayGet(optionalModules);
if (optionalModules[HWSETTINGS_OPTIONALMODULES_AIRSPEED] == HWSETTINGS_OPTIONALMODULES_ENABLED) {
if (optionalModules.Airspeed == HWSETTINGS_OPTIONALMODULES_ENABLED) {
airspeedEnabled = true;
} else {
airspeedEnabled = false;

View File

@ -164,11 +164,15 @@ static void UpdateStabilizationDesired(bool doingIdent);
*/
int32_t AutoTuneInitialize(void)
{
HwSettingsOptionalModulesData optionalModules;
HwSettingsOptionalModulesGet(&optionalModules);
#if defined(MODULE_AUTOTUNE_BUILTIN)
moduleEnabled = true;
optionalModules.AutoTune = HWSETTINGS_OPTIONALMODULES_ENABLED;
HwSettingsOptionalModulesSet(&optionalModules);
#else
HwSettingsOptionalModulesData optionalModules;
HwSettingsOptionalModulesGet(&optionalModules);
if (optionalModules.AutoTune == HWSETTINGS_OPTIONALMODULES_ENABLED) {
// even though the AutoTune module is automatically enabled
// (below, when the flight mode switch is configured to use autotune)

View File

@ -90,12 +90,15 @@ int32_t BatteryInitialize(void)
{
bool batteryEnabled;
#ifdef MODULE_BATTERY_BUILTIN
batteryEnabled = true;
#else
HwSettingsOptionalModulesData optionalModules;
HwSettingsOptionalModulesGet(&optionalModules);
#ifdef MODULE_BATTERY_BUILTIN
batteryEnabled = true;
optionalModules.Battery = HWSETTINGS_OPTIONALMODULES_ENABLED;
HwSettingsOptionalModulesSet(&optionalModules);
#else
if (optionalModules.Battery == HWSETTINGS_OPTIONALMODULES_ENABLED) {
batteryEnabled = true;
} else {

View File

@ -92,13 +92,15 @@ int32_t CameraStabInitialize(void)
{
bool cameraStabEnabled;
#ifdef MODULE_CAMERASTAB_BUILTIN
cameraStabEnabled = true;
#else
HwSettingsOptionalModulesData optionalModules;
HwSettingsOptionalModulesGet(&optionalModules);
#ifdef MODULE_CAMERASTAB_BUILTIN
cameraStabEnabled = true;
optionalModules.CameraStab = HWSETTINGS_OPTIONALMODULES_ENABLED;
HwSettingsOptionalModulesSet(&optionalModules);
#else
if (optionalModules.CameraStab == HWSETTINGS_OPTIONALMODULES_ENABLED) {
cameraStabEnabled = true;
} else {

View File

@ -196,13 +196,15 @@ int32_t GPSStart(void)
int32_t GPSInitialize(void)
{
#ifdef MODULE_GPS_BUILTIN
gpsEnabled = true;
#else
HwSettingsOptionalModulesData optionalModules;
HwSettingsOptionalModulesGet(&optionalModules);
#ifdef MODULE_GPS_BUILTIN
gpsEnabled = true;
optionalModules.GPS = HWSETTINGS_OPTIONALMODULES_ENABLED;
HwSettingsOptionalModulesSet(&optionalModules);
#else
if (optionalModules.GPS == HWSETTINGS_OPTIONALMODULES_ENABLED) {
gpsEnabled = true;
} else {

View File

@ -101,12 +101,15 @@ int32_t TxPIDInitialize(void)
{
bool txPIDEnabled;
#ifdef MODULE_TXPID_BUILTIN
txPIDEnabled = true;
#else
HwSettingsOptionalModulesData optionalModules;
HwSettingsOptionalModulesGet(&optionalModules);
#ifdef MODULE_TXPID_BUILTIN
txPIDEnabled = true;
optionalModules.TxPID = HWSETTINGS_OPTIONALMODULES_ENABLED;
HwSettingsOptionalModulesSet(&optionalModules);
#else
if (optionalModules.TxPID == HWSETTINGS_OPTIONALMODULES_ENABLED) {
txPIDEnabled = true;
} else {