1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Merged in mindnever/librepilot/LP-173-Init_all_settings_objects_automatically (pull request #467)

LP-173 Initialize all settings objects automatically

Approved-by: Vladimir Zidar <mr_w@mindnever.org>
Approved-by: Philippe Renon <philippe_renon@yahoo.fr>
Approved-by: Jan NIJS <dr.oblivium@gmail.com>
Approved-by: Lalanne Laurent <f5soh@free.fr>
This commit is contained in:
Vladimir Zidar 2017-10-29 12:14:42 +00:00 committed by Lalanne Laurent
commit 754eca955a
82 changed files with 142 additions and 168 deletions

View File

@ -80,15 +80,12 @@ static float applyExpo(float value, float expo)
*/
void plan_initialize()
{
TakeOffLocationInitialize();
PositionStateInitialize();
PathDesiredInitialize();
FlightModeSettingsInitialize();
FlightStatusInitialize();
AttitudeStateInitialize();
ManualControlCommandInitialize();
VelocityStateInitialize();
VtolPathFollowerSettingsInitialize();
StabilizationBankInitialize();
StabilizationDesiredInitialize();
}

View File

@ -73,7 +73,6 @@ int32_t configuration_check()
// Classify navigation capability
#ifdef REVOLUTION
RevoSettingsInitialize();
RevoSettingsFusionAlgorithmOptions revoFusion;
RevoSettingsFusionAlgorithmGet(&revoFusion);
bool navCapableFusion;

View File

@ -147,11 +147,9 @@ int32_t ActuatorStart()
int32_t ActuatorInitialize()
{
// Register for notification of changes to ActuatorSettings
ActuatorSettingsInitialize();
ActuatorSettingsConnectCallback(ActuatorSettingsUpdatedCb);
// Register for notification of changes to MixerSettings
MixerSettingsInitialize();
MixerSettingsConnectCallback(MixerSettingsUpdatedCb);
// Listen for ActuatorDesired updates (Primary input to this module)
@ -164,7 +162,6 @@ int32_t ActuatorInitialize()
// Check if CameraStab module is enabled
HwSettingsOptionalModulesData optionalModules;
HwSettingsInitialize();
HwSettingsOptionalModulesGet(&optionalModules);
camStabEnabled = (optionalModules.CameraStab == HWSETTINGS_OPTIONALMODULES_ENABLED);
camControlEnabled = (optionalModules.CameraControl == HWSETTINGS_OPTIONALMODULES_ENABLED);
@ -177,10 +174,8 @@ int32_t ActuatorInitialize()
#endif
#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
VtolPathFollowerSettingsInitialize();
VtolPathFollowerSettingsConnectCallback(&SettingsUpdatedCb);
#endif
SystemSettingsInitialize();
SystemSettingsConnectCallback(&SettingsUpdatedCb);
return 0;

View File

@ -97,7 +97,6 @@ int32_t AirspeedInitialize()
airspeedEnabled = true;
#else
HwSettingsInitialize();
HwSettingsOptionalModulesOptions optionalModules[HWSETTINGS_OPTIONALMODULES_NUMELEM];
HwSettingsOptionalModulesArrayGet(optionalModules);
@ -121,7 +120,6 @@ int32_t AirspeedInitialize()
}
AirspeedSensorInitialize();
AirspeedSettingsInitialize();
AirspeedSettingsConnectCallback(AirspeedSettingsUpdatedCb);

View File

@ -103,7 +103,6 @@ int32_t AltitudeInitialize()
#ifdef MODULE_ALTITUDE_BUILTIN
altitudeEnabled = 1;
#else
HwSettingsInitialize();
uint8_t optionalModules[HWSETTINGS_OPTIONALMODULES_NUMELEM];
HwSettingsOptionalModulesGet(optionalModules);
if (optionalModules[HWSETTINGS_OPTIONALMODULES_ALTITUDE] == HWSETTINGS_OPTIONALMODULES_ENABLED) {

View File

@ -197,8 +197,6 @@ int32_t AttitudeStart(void)
int32_t AttitudeInitialize(void)
{
AttitudeStateInitialize();
AttitudeSettingsInitialize();
AccelGyroSettingsInitialize();
AccelStateInitialize();
GyroStateInitialize();

View File

@ -164,15 +164,9 @@ static void UpdateStabilizationDesired(bool doingIdent);
*/
int32_t AutoTuneInitialize(void)
{
// do this here since module can become disabled for several reasons
// even for MODULE_AutoTune_BUILTIN
FlightModeSettingsInitialize();
#if defined(MODULE_AutoTune_BUILTIN)
moduleEnabled = true;
#else
// HwSettings is only used right here, so init here
HwSettingsInitialize();
HwSettingsOptionalModulesData optionalModules;
HwSettingsOptionalModulesGet(&optionalModules);
if (optionalModules.AutoTune == HWSETTINGS_OPTIONALMODULES_ENABLED) {
@ -195,10 +189,6 @@ int32_t AutoTuneInitialize(void)
GyroStateInitialize();
ManualControlCommandInitialize();
StabilizationBankInitialize();
StabilizationSettingsBank1Initialize();
StabilizationSettingsBank2Initialize();
StabilizationSettingsBank3Initialize();
SystemIdentSettingsInitialize();
SystemIdentStateInitialize();
atQueue = xQueueCreate(AT_QUEUE_NUMELEM, sizeof(struct at_queued_data));

View File

@ -95,7 +95,6 @@ int32_t BatteryInitialize(void)
#ifdef MODULE_BATTERY_BUILTIN
batteryEnabled = true;
#else
HwSettingsInitialize();
HwSettingsOptionalModulesData optionalModules;
HwSettingsOptionalModulesGet(&optionalModules);
@ -127,7 +126,6 @@ int32_t BatteryInitialize(void)
// Start module
if (batteryEnabled) {
FlightBatteryStateInitialize();
FlightBatterySettingsInitialize();
SystemStatsInitialize();
static UAVObjEvent ev;

View File

@ -90,7 +90,6 @@ static void FillActivityInfo();
int32_t CameraControlInitialize(void)
{
ccd = 0;
HwSettingsInitialize();
HwSettingsOptionalModulesData modules;
HwSettingsOptionalModulesGet(&modules);
if (modules.CameraControl == HWSETTINGS_OPTIONALMODULES_ENABLED) {
@ -99,9 +98,7 @@ int32_t CameraControlInitialize(void)
ccd->callbackHandle = PIOS_CALLBACKSCHEDULER_Create(&CameraControlTask, CALLBACK_PRIORITY, CBTASK_PRIORITY, CALLBACKINFO_RUNNING_CAMERACONTROL, STACK_SIZE_BYTES);
CameraControlActivityInitialize();
CameraDesiredInitialize();
CameraControlSettingsInitialize();
CameraControlSettingsConnectCallback(SettingsUpdateCb);
HomeLocationInitialize();
HomeLocationConnectCallback(HomeLocationUpdateCb);
GPSTimeInitialize();
PositionStateInitialize();

View File

@ -97,7 +97,6 @@ int32_t CameraStabInitialize(void)
#else
HwSettingsOptionalModulesData optionalModules;
HwSettingsInitialize();
HwSettingsOptionalModulesGet(&optionalModules);
if (optionalModules.CameraStab == HWSETTINGS_OPTIONALMODULES_ENABLED) {
@ -119,7 +118,6 @@ int32_t CameraStabInitialize(void)
csd->lastSysTime = xTaskGetTickCount();
AttitudeStateInitialize();
CameraStabSettingsInitialize();
CameraDesiredInitialize();
UAVObjEvent ev = {

View File

@ -98,7 +98,6 @@ int32_t MagBaroInitialize()
#ifdef MODULE_MAGBARO_BUILTIN
magbaroEnabled = 1;
#else
HwSettingsInitialize();
uint8_t optionalModules[HWSETTINGS_OPTIONALMODULES_NUMELEM];
HwSettingsOptionalModulesGet(optionalModules);
if (optionalModules[HWSETTINGS_OPTIONALMODULES_MAGBARO] == HWSETTINGS_OPTIONALMODULES_ENABLED) {

View File

@ -43,7 +43,6 @@ static int32_t fault_initialize(void)
#ifdef MODULE_FAULT_BUILTIN
module_enabled = true;
#else
HwSettingsInitialize();
uint8_t optionalModules[HWSETTINGS_OPTIONALMODULES_NUMELEM];
HwSettingsOptionalModulesGet(optionalModules);
@ -61,7 +60,6 @@ static int32_t fault_initialize(void)
* we've booted in BootFault recovery mode with all optional
* modules disabled.
*/
FaultSettingsInitialize();
if (module_enabled) {
FaultSettingsActivateFaultGet(&active_fault);

View File

@ -79,7 +79,6 @@ int32_t FlightPlanInitialize()
FlightPlanStatusInitialize();
FlightPlanControlInitialize();
FlightPlanSettingsInitialize();
// Listen for object updates
FlightPlanControlConnectCallback(&objectUpdatedCb);

View File

@ -196,7 +196,6 @@ int32_t GPSStart(void)
int32_t GPSInitialize(void)
{
HwSettingsInitialize();
#ifdef MODULE_GPS_BUILTIN
gpsEnabled = true;
#else
@ -219,17 +218,14 @@ int32_t GPSInitialize(void)
GPSVelocitySensorInitialize();
GPSTimeInitialize();
GPSSatellitesInitialize();
HomeLocationInitialize();
#if defined(ANY_FULL_MAG_PARSER)
AuxMagSensorInitialize();
AuxMagSettingsInitialize();
GPSExtendedStatusInitialize();
// Initialize mag parameters
AuxMagSettingsUpdatedCb(NULL);
AuxMagSettingsConnectCallback(AuxMagSettingsUpdatedCb);
#endif
GPSSettingsInitialize();
// updateHwSettings() uses gpsSettings
GPSSettingsGet(&gpsSettings);
// must updateHwSettings() before updateGpsSettings() so baud rate is set before GPS serial code starts running
@ -242,10 +238,6 @@ int32_t GPSInitialize(void)
GPSTimeInitialize();
GPSSatellitesInitialize();
#endif
#if defined(PIOS_GPS_SETS_HOMELOCATION)
HomeLocationInitialize();
#endif
GPSSettingsInitialize();
// updateHwSettings() uses gpsSettings
GPSSettingsGet(&gpsSettings);
// must updateHwSettings() before updateGpsSettings() so baud rate is set before GPS serial code starts running

View File

@ -52,7 +52,6 @@ static void FlightStatusUpdatedCb(UAVObjEvent *ev);
int32_t LoggingInitialize(void)
{
DebugLogSettingsInitialize();
DebugLogControlInitialize();
DebugLogStatusInitialize();
DebugLogEntryInitialize();

View File

@ -167,15 +167,10 @@ int32_t ManualControlInitialize()
ManualControlCommandInitialize();
FlightStatusInitialize();
ManualControlSettingsInitialize();
FlightModeSettingsInitialize();
SystemSettingsInitialize();
StabilizationSettingsInitialize();
AccessoryDesiredInitialize();
#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
SystemAlarmsInitialize();
VtolSelfTuningStatsInitialize();
VtolPathFollowerSettingsInitialize();
VtolPathFollowerSettingsConnectCallback(&SettingsUpdatedCb);
SystemSettingsConnectCallback(&SettingsUpdatedCb);
#endif /* ifndef PIOS_EXCLUDE_ADVANCED_FEATURES */

View File

@ -40,10 +40,10 @@ static void SetTakeOffLocation();
void takeOffLocationHandlerInit()
{
TakeOffLocationInitialize();
// check whether there is a preset/valid takeoff location
TakeOffLocationModeOptions mode;
TakeOffLocationStatusOptions status;
TakeOffLocationModeGet(&mode);
TakeOffLocationStatusGet(&status);
// preset with invalid location will actually behave like FirstTakeoff

View File

@ -2426,11 +2426,7 @@ int32_t osdgenInitialize(void)
GPSTimeInitialize();
GPSSatellitesInitialize();
#endif
#ifdef PIOS_GPS_SETS_HOMELOCATION
HomeLocationInitialize();
#endif
#endif
OsdSettingsInitialize();
BaroSensorInitialize();
FlightStatusInitialize();

View File

@ -277,7 +277,6 @@ static int32_t osdoutputInitialize(void)
#ifdef MODULE_OSDOUTPUT_BUILTIN
osdoutputEnabled = 1;
#else
HwSettingsInitialize();
HwSettingsOptionalModulesData optionalModules;
HwSettingsOptionalModulesGet(&optionalModules);
if (optionalModules.OsdHk == HWSETTINGS_OPTIONALMODULES_ENABLED) {

View File

@ -81,7 +81,6 @@ int32_t OveroSyncInitialize(void)
overoEnabled = true;
#else
HwSettingsInitialize();
uint8_t optionalModules[HWSETTINGS_OPTIONALMODULES_NUMELEM];
HwSettingsOptionalModulesGet(optionalModules);

View File

@ -154,12 +154,8 @@ extern "C" int32_t PathFollowerStart()
extern "C" int32_t PathFollowerInitialize()
{
// initialize objects
GroundPathFollowerSettingsInitialize();
FixedWingPathFollowerSettingsInitialize();
FixedWingPathFollowerStatusInitialize();
VtolPathFollowerSettingsInitialize();
FlightStatusInitialize();
FlightModeSettingsInitialize();
PathStatusInitialize();
PathSummaryInitialize();
PathDesiredInitialize();
@ -169,10 +165,8 @@ extern "C" int32_t PathFollowerInitialize()
StabilizationDesiredInitialize();
AirspeedStateInitialize();
AttitudeStateInitialize();
TakeOffLocationInitialize();
PoiLocationInitialize();
ManualControlCommandInitialize();
SystemSettingsInitialize();
StabilizationBankInitialize();
VtolSelfTuningStatsInitialize();
PIDStatusInitialize();
@ -181,7 +175,6 @@ extern "C" int32_t PathFollowerInitialize()
StatusVtolAutoTakeoffInitialize();
// VtolLandFSM additional objects
HomeLocationInitialize();
AccelStateInitialize();
// Init references to controllers

View File

@ -151,13 +151,9 @@ int32_t ReceiverInitialize()
ManualControlCommandInitialize();
ReceiverActivityInitialize();
ReceiverStatusInitialize();
ManualControlSettingsInitialize();
#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
StabilizationSettingsInitialize();
VtolPathFollowerSettingsInitialize();
VtolPathFollowerSettingsConnectCallback(&SettingsUpdatedCb);
#endif
SystemSettingsInitialize();
SystemSettingsConnectCallback(&SettingsUpdatedCb);

View File

@ -210,14 +210,9 @@ int32_t SensorsInitialize(void)
AccelSensorInitialize();
MagSensorInitialize();
BaroSensorInitialize();
RevoCalibrationInitialize();
RevoSettingsInitialize();
AttitudeSettingsInitialize();
AccelGyroSettingsInitialize();
#if defined(PIOS_INCLUDE_HMC5X83)
// for auxmagsupport.c helpers
AuxMagSettingsInitialize();
AuxMagSensorInitialize();
#endif

View File

@ -115,7 +115,6 @@ int32_t SensorsInitialize(void)
GPSPositionSensorInitialize();
GPSVelocitySensorInitialize();
MagSensorInitialize();
RevoCalibrationInitialize();
return 0;
}

View File

@ -191,7 +191,6 @@ static void VelocityStateUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
*/
void stabilizationAltitudeloopInit()
{
AltitudeHoldSettingsInitialize();
AltitudeHoldStatusInitialize();
PositionStateInitialize();
VelocityStateInitialize();

View File

@ -95,12 +95,8 @@ int32_t StabilizationInitialize()
{
// Initialize variables
StabilizationDesiredInitialize();
StabilizationSettingsInitialize();
StabilizationStatusInitialize();
StabilizationBankInitialize();
StabilizationSettingsBank1Initialize();
StabilizationSettingsBank2Initialize();
StabilizationSettingsBank3Initialize();
RateDesiredInitialize();
ManualControlCommandInitialize(); // only used for PID bank selection based on flight mode switch
sin_lookup_initalize();

View File

@ -83,11 +83,9 @@ int32_t filterAltitudeInitialize(stateFilter *handle)
handle->init = &init;
handle->filter = &filter;
handle->localdata = pios_malloc(sizeof(struct data));
HomeLocationInitialize();
AttitudeStateInitialize();
AltitudeFilterSettingsInitialize();
AltitudeFilterSettingsConnectCallback(&settingsUpdatedCb);
reloadSettings = true;
reloadSettings = true;
return STACK_REQUIRED;
}

View File

@ -99,7 +99,6 @@ static int32_t maininit(stateFilter *self)
this->gpsAlt = 0.0f;
this->first_run = INIT_CYCLES;
RevoSettingsInitialize();
RevoSettingsBaroGPSOffsetCorrectionAlphaGet(&this->baroGPSOffsetCorrectionAlpha);
return 0;

View File

@ -104,8 +104,6 @@ static void globalInit(void)
if (!initialized) {
initialized = 1;
FlightStatusInitialize();
HomeLocationInitialize();
RevoCalibrationInitialize();
FlightStatusConnectCallback(&flightStatusUpdatedCb);
flightStatusUpdatedCb(NULL);
}

View File

@ -93,9 +93,7 @@ static int32_t globalInit(stateFilter *handle, bool usePos, bool navOnly)
struct data *this = (struct data *)handle->localdata;
this->usePos = usePos;
this->navOnly = navOnly;
EKFConfigurationInitialize();
EKFStateVarianceInitialize();
HomeLocationInitialize();
return STACK_REQUIRED;
}

View File

@ -61,9 +61,7 @@ int32_t filterLLAInitialize(stateFilter *handle)
handle->init = &init;
handle->filter = &filter;
handle->localdata = pios_malloc(sizeof(struct data));
GPSSettingsInitialize();
GPSPositionSensorInitialize();
HomeLocationInitialize();
return STACK_REQUIRED;
}

View File

@ -72,7 +72,6 @@ int32_t filterMagInitialize(stateFilter *handle)
handle->init = &init;
handle->filter = &filter;
handle->localdata = pios_malloc(sizeof(struct data));
HomeLocationInitialize();
return STACK_REQUIRED;
}

View File

@ -83,7 +83,6 @@ static int32_t init(stateFilter *self)
this->oldPos[2] = 0.0f;
this->inited = 0;
RevoSettingsInitialize();
RevoSettingsVelocityPostProcessingLowPassAlphaGet(&this->alpha);
PIOS_DELTATIME_Init(&this->dtconfig, DT_INIT, DT_MIN, DT_MAX, DT_ALPHA);

View File

@ -326,8 +326,6 @@ static inline int32_t maxint32_t(int32_t a, int32_t b)
*/
int32_t StateEstimationInitialize(void)
{
RevoSettingsInitialize();
GyroSensorInitialize();
MagSensorInitialize();
AuxMagSensorInitialize();
@ -336,15 +334,12 @@ int32_t StateEstimationInitialize(void)
GPSVelocitySensorInitialize();
GPSPositionSensorInitialize();
HomeLocationInitialize();
GyroStateInitialize();
AccelStateInitialize();
MagStateInitialize();
AirspeedStateInitialize();
PositionStateInitialize();
VelocityStateInitialize();
AuxMagSettingsInitialize();
RevoSettingsConnectCallback(&settingsUpdatedCb);

View File

@ -159,7 +159,6 @@ int32_t SystemModStart(void)
int32_t SystemModInitialize(void)
{
// Must registers objects here for system thread because ObjectManager started in OpenPilotInit
SystemSettingsInitialize();
SystemStatsInitialize();
FlightStatusInitialize();
ObjectPersistenceInitialize();

View File

@ -267,10 +267,7 @@ void TelemetryInitializeChannel(channelContext *channel)
*/
int32_t TelemetryInitialize(void)
{
HwSettingsInitialize();
#ifdef PIOS_INCLUDE_RFM22B
OPLinkSettingsInitialize();
OPLinkSettingsData data;
OPLinkSettingsGet(&data);

View File

@ -102,11 +102,6 @@ int32_t TxPIDInitialize(void)
bool txPIDEnabled;
HwSettingsOptionalModulesData optionalModules;
#ifdef REVOLUTION
AltitudeHoldSettingsInitialize();
#endif
HwSettingsInitialize();
HwSettingsOptionalModulesGet(&optionalModules);
if (optionalModules.TxPID == HWSETTINGS_OPTIONALMODULES_ENABLED) {
@ -116,7 +111,6 @@ int32_t TxPIDInitialize(void)
}
if (txPIDEnabled) {
TxPIDSettingsInitialize();
TxPIDStatusInitialize();
AccessoryDesiredInitialize();
@ -136,14 +130,12 @@ int32_t TxPIDInitialize(void)
// StabilizationSettings update rate permanently. Use Metadata via
// browser to reset to defaults (telemetryAcked=true, OnChange).
UAVObjMetadata metadata;
StabilizationSettingsInitialize();
StabilizationSettingsGetMetadata(&metadata);
metadata.telemetryAcked = 0;
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;
metadata.telemetryUpdatePeriod = TELEMETRY_UPDATE_PERIOD_MS;
StabilizationSettingsSetMetadata(&metadata);
AttitudeSettingsInitialize();
AttitudeSettingsGetMetadata(&metadata);
metadata.telemetryAcked = 0;
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;

View File

@ -125,7 +125,6 @@ static int32_t uavoHoTTBridgeInitialize(void)
PIOS_COM_ChangeBaud(PIOS_COM_HOTT, 19200);
bool param = true;
PIOS_COM_Ioctl(PIOS_COM_HOTT, PIOS_IOCTL_USART_SET_HALFDUPLEX, &param);
HoTTBridgeSettingsInitialize();
HoTTBridgeStatusInitialize();
// allocate memory for telemetry data

View File

@ -565,7 +565,6 @@ void PIOS_BOARD_IO_Configure_OPLink_RCVR()
void PIOS_BOARD_IO_Configure_RFM22B()
{
#if defined(PIOS_INCLUDE_RFM22B)
OPLinkSettingsInitialize();
OPLinkStatusInitialize();
#endif /* PIOS_INCLUDE_RFM22B */
#if defined(PIOS_INCLUDE_OPLINKRCVR) && defined(PIOS_INCLUDE_RCVR)

View File

@ -147,7 +147,6 @@ void PIOS_BOARD_Sensors_Configure()
# endif /* PIOS_INCLUDE_HMC5X83_INTERNAL */
# ifdef PIOS_INCLUDE_HMC5X83
AuxMagSettingsInitialize();
AuxMagSettingsTypeOptions option;
AuxMagSettingsTypeGet(&option);

View File

@ -1156,7 +1156,6 @@ int32_t PIOS_OpenLRS_Init(uint32_t *openlrs_id, uint32_t spi_id,
openlrs_dev->ppm_callback = 0;
OPLinkSettingsInitialize();
OPLinkStatusInitialize();
DEBUG_PRINTF(2, "OpenLRS UAVOs Initialized\r\n");
OPLinkSettingsData binding;

View File

@ -52,6 +52,10 @@ typedef struct {
/* Init module section */
extern initmodule_t __module_initcall_start[], __module_initcall_end[];
extern volatile int initTaskDone;
/* Init settings section */
extern initcall_t __settings_initcall_start[], __settings_initcall_end[];
#ifdef USE_SIM_POSIX
extern void InitModules();
@ -60,6 +64,8 @@ extern int32_t SystemModInitialize(void);
#define MODULE_INITCALL(ifn, sfn)
#define SETTINGS_INITCALL(fn)
#define MODULE_TASKCREATE_ALL \
{ \
/* Start all module threads */ \
@ -92,8 +98,15 @@ extern int32_t SystemModInitialize(void);
static initmodule_t __initcall_##ifn __attribute__((__used__)) \
__attribute__((__section__(".initcall" level ".init"))) = { .fn_minit = ifn, .fn_tinit = sfn }
#define __define_settings_initcall(level, fn) \
static initcall_t __initcall_##fn __attribute__((__used__)) \
__attribute__((__section__(".initcall" level ".init"))) = fn
#define MODULE_INITCALL(ifn, sfn) __define_module_initcall("module", ifn, sfn)
#define SETTINGS_INITCALL(fn) __define_settings_initcall("settings", fn)
#define MODULE_INITIALISE_ALL \
{ for (initmodule_t *fn = __module_initcall_start; fn < __module_initcall_end; fn++) { \
if (fn->fn_minit) { \
@ -111,6 +124,14 @@ extern int32_t SystemModInitialize(void);
} \
}
#define SETTINGS_INITIALISE_ALL \
{ for (const initcall_t *fn = __settings_initcall_start; fn < __settings_initcall_end; fn++) { \
if (*fn) { \
(*fn)(); \
} \
} \
}
#endif /* USE_SIM_POSIX */
#endif /* PIOS_INITCALL_H */

View File

@ -61,8 +61,8 @@
*/
int32_t PIOS_MPU6000_CONFIG_Configure()
{
MPUGyroAccelSettingsInitialize();
MPUGyroAccelSettingsData mpuSettings;
MPUGyroAccelSettingsGet(&mpuSettings);
return PIOS_MPU6000_ConfigureRanges(
PIOS_MPU6000_CONFIG_MAP_GYROSCALE(mpuSettings.GyroScale),

View File

@ -61,8 +61,8 @@
*/
int32_t PIOS_MPU9250_CONFIG_Configure()
{
MPUGyroAccelSettingsInitialize();
MPUGyroAccelSettingsData mpuSettings;
MPUGyroAccelSettingsGet(&mpuSettings);
return PIOS_MPU9250_ConfigureRanges(
PIOS_MPU9250_CONFIG_MAP_GYROSCALE(mpuSettings.GyroScale),

View File

@ -37,6 +37,16 @@ SECTIONS
__module_initcall_end = .;
} >FLASH
/* settings init sections */
.initcallsettings.init :
{
. = ALIGN(4);
__settings_initcall_start = .;
KEEP(*(.initcallsettings.init))
. = ALIGN(4);
__settings_initcall_end = .;
} >FLASH
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)

View File

@ -32,6 +32,16 @@ SECTIONS
__module_initcall_end = .;
} >FLASH
/* settings init sections */
.initcallsettings.init :
{
. = ALIGN(4);
__settings_initcall_start = .;
KEEP(*(.initcallsettings.init))
. = ALIGN(4);
__settings_initcall_end = .;
} >FLASH
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)

View File

@ -32,6 +32,16 @@ SECTIONS
__module_initcall_end = .;
} >FLASH
/* settings init sections */
.initcallsettings.init :
{
. = ALIGN(4);
__settings_initcall_start = .;
KEEP(*(.initcallsettings.init))
. = ALIGN(4);
__settings_initcall_end = .;
} >FLASH
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)

View File

@ -39,6 +39,15 @@ SECTIONS
__module_initcall_end = .;
} >FLASH
/* settings init sections */
.initcallsettings.init :
{
. = ALIGN(4);
__settings_initcall_start = .;
KEEP(*(.initcallsettings.init))
. = ALIGN(4);
__settings_initcall_end = .;
} >FLASH
/*
* C++ exception handling.

View File

@ -39,6 +39,16 @@ SECTIONS
__module_initcall_end = .;
} >FLASH
/* settings init sections */
.initcallsettings.init :
{
. = ALIGN(4);
__settings_initcall_start = .;
KEEP(*(.initcallsettings.init))
. = ALIGN(4);
__settings_initcall_end = .;
} >FLASH
/*
* C++ exception handling.
*/

View File

@ -39,6 +39,16 @@ SECTIONS
__module_initcall_end = .;
} >FLASH
/* settings init sections */
.initcallsettings.init :
{
. = ALIGN(4);
__settings_initcall_start = .;
KEEP(*(.initcallsettings.init))
. = ALIGN(4);
__settings_initcall_end = .;
} >FLASH
/*
* C++ exception handling.
*/

View File

@ -39,6 +39,16 @@ SECTIONS
__module_initcall_end = .;
} >FLASH
/* settings init sections */
.initcallsettings.init :
{
. = ALIGN(4);
__settings_initcall_start = .;
KEEP(*(.initcallsettings.init))
. = ALIGN(4);
__settings_initcall_end = .;
} >FLASH
/*
* C++ exception handling.
*/

View File

@ -39,6 +39,16 @@ SECTIONS
__module_initcall_end = .;
} >FLASH
/* settings init sections */
.initcallsettings.init :
{
. = ALIGN(4);
__settings_initcall_start = .;
KEEP(*(.initcallsettings.init))
. = ALIGN(4);
__settings_initcall_end = .;
} >FLASH
/*
* C++ exception handling.
*/

View File

@ -39,6 +39,16 @@ SECTIONS
__module_initcall_end = .;
} >FLASH
/* settings init sections */
.initcallsettings.init :
{
. = ALIGN(4);
__settings_initcall_start = .;
KEEP(*(.initcallsettings.init))
. = ALIGN(4);
__settings_initcall_end = .;
} >FLASH
/*
* C++ exception handling.
*/

View File

@ -39,6 +39,16 @@ SECTIONS
__module_initcall_end = .;
} >FLASH
/* settings init sections */
.initcallsettings.init :
{
. = ALIGN(4);
__settings_initcall_start = .;
KEEP(*(.initcallsettings.init))
. = ALIGN(4);
__settings_initcall_end = .;
} >FLASH
/*
* C++ exception handling.
*/

View File

@ -77,8 +77,6 @@ UAVOBJSRCFILENAMES += mixerstatus
UAVOBJSRCFILENAMES += nedaccel
UAVOBJSRCFILENAMES += objectpersistence
UAVOBJSRCFILENAMES += oplinkreceiver
UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathplan

View File

@ -107,6 +107,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
SETTINGS_INITIALISE_ALL;
#if defined(PIOS_INCLUDE_RTC)
/* Initialize the real-time clock and its associated tick */
@ -123,8 +124,6 @@ void PIOS_Board_Init(void)
PIOS_IAP_WriteBootCmd(2, 0);
}
HwSettingsInitialize();
#ifndef ERASE_FLASH
#ifdef PIOS_INCLUDE_WDG
/* Initialize watchdog as early as possible to catch faults during init */
@ -285,7 +284,6 @@ void PIOS_Board_Init(void)
// Attach the board config check hook
SANITYCHECK_AttachHook(&CopterControlConfigHook);
// trigger a config check if actuatorsettings are updated
ActuatorSettingsInitialize();
ActuatorSettingsConnectCallback(ActuatorSettingsUpdatedCb);
}

View File

@ -94,7 +94,6 @@ ifndef TESTAPP
SRC += $(FLIGHT_UAVOBJ_DIR)/objectpersistence.c
SRC += $(FLIGHT_UAVOBJ_DIR)/gcstelemetrystats.c
SRC += $(FLIGHT_UAVOBJ_DIR)/flighttelemetrystats.c
SRC += $(FLIGHT_UAVOBJ_DIR)/faultsettings.c
SRC += $(FLIGHT_UAVOBJ_DIR)/flightstatus.c
SRC += $(FLIGHT_UAVOBJ_DIR)/systemstats.c
SRC += $(FLIGHT_UAVOBJ_DIR)/systemalarms.c

View File

@ -159,6 +159,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
SETTINGS_INITIALISE_ALL;
#if defined(PIOS_INCLUDE_RTC)
/* Initialize the real-time clock and its associated tick */
@ -175,8 +176,6 @@ void PIOS_Board_Init(void)
PIOS_IAP_WriteBootCmd(2, 0);
}
HwSettingsInitialize();
#ifndef ERASE_FLASH
#ifdef PIOS_INCLUDE_WDG
/* Initialize watchdog as early as possible to catch faults during init */
@ -331,7 +330,6 @@ void PIOS_Board_Init(void)
// Attach the board config check hook
SANITYCHECK_AttachHook(&CopterControlConfigHook);
// trigger a config check if actuatorsettings are updated
ActuatorSettingsInitialize();
ActuatorSettingsConnectCallback(ActuatorSettingsUpdatedCb);
}

View File

@ -77,8 +77,6 @@ UAVOBJSRCFILENAMES += mixerstatus
UAVOBJSRCFILENAMES += nedaccel
UAVOBJSRCFILENAMES += objectpersistence
UAVOBJSRCFILENAMES += oplinkreceiver
UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathplan

View File

@ -187,7 +187,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
HwSettingsInitialize();
SETTINGS_INITIALISE_ALL;
/* Initialize the alarms library */
AlarmsInitialize();

View File

@ -77,8 +77,6 @@ UAVOBJSRCFILENAMES += mixerstatus
UAVOBJSRCFILENAMES += nedaccel
UAVOBJSRCFILENAMES += objectpersistence
UAVOBJSRCFILENAMES += oplinkreceiver
UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathplan

View File

@ -135,6 +135,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
SETTINGS_INITIALISE_ALL;
#if defined(PIOS_INCLUDE_RTC)
/* Initialize the real-time clock and its associated tick */
@ -151,9 +152,6 @@ void PIOS_Board_Init(void)
PIOS_IAP_WriteBootCmd(2, 0);
}
HwSettingsInitialize();
HwSPRacingF3EVOSettingsInitialize();
#ifndef ERASE_FLASH
#ifdef PIOS_INCLUDE_WDG
/* Initialize watchdog as early as possible to catch faults during init */

View File

@ -101,6 +101,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
SETTINGS_INITIALISE_ALL;
/* Set up the SPI interface to the rfm22b */
if (PIOS_SPI_Init(&pios_spi_rfm22b_id, &pios_spi_rfm22b_cfg)) {
@ -133,7 +134,6 @@ void PIOS_Board_Init(void)
PIOS_IAP_WriteBootCmd(2, 0);
}
OPLinkSettingsInitialize();
OPLinkReceiverInitialize();
/* Retrieve the settings object. */

View File

@ -170,8 +170,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
HwSettingsInitialize();
SETTINGS_INITIALISE_ALL;
#ifdef PIOS_INCLUDE_WDG
/* Initialize watchdog as early as possible to catch faults during init */

View File

@ -77,8 +77,6 @@ UAVOBJSRCFILENAMES += mixerstatus
UAVOBJSRCFILENAMES += nedaccel
UAVOBJSRCFILENAMES += objectpersistence
UAVOBJSRCFILENAMES += oplinkreceiver
UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathplan

View File

@ -136,6 +136,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
SETTINGS_INITIALISE_ALL;
#if defined(PIOS_INCLUDE_RTC)
/* Initialize the real-time clock and its associated tick */
@ -152,9 +153,6 @@ void PIOS_Board_Init(void)
PIOS_IAP_WriteBootCmd(2, 0);
}
HwSettingsInitialize();
HwPikoBLXSettingsInitialize();
#ifndef ERASE_FLASH
#ifdef PIOS_INCLUDE_WDG
/* Initialize watchdog as early as possible to catch faults during init */

View File

@ -77,8 +77,6 @@ UAVOBJSRCFILENAMES += mixerstatus
UAVOBJSRCFILENAMES += nedaccel
UAVOBJSRCFILENAMES += objectpersistence
UAVOBJSRCFILENAMES += oplinkreceiver
UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathplan

View File

@ -179,7 +179,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
HwSettingsInitialize();
SETTINGS_INITIALISE_ALL;
/* Initialize the alarms library */
AlarmsInitialize();

View File

@ -77,8 +77,6 @@ UAVOBJSRCFILENAMES += mixerstatus
UAVOBJSRCFILENAMES += nedaccel
UAVOBJSRCFILENAMES += objectpersistence
UAVOBJSRCFILENAMES += oplinkreceiver
UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathplan

View File

@ -171,7 +171,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
HwSettingsInitialize();
SETTINGS_INITIALISE_ALL;
/* Initialize the alarms library */
AlarmsInitialize();
@ -289,7 +289,6 @@ void PIOS_Board_Init(void)
// Attach the board config check hook
SANITYCHECK_AttachHook(&RevoNanoConfigHook);
// trigger a config check if actuatorsettings are updated
ActuatorSettingsInitialize();
ActuatorSettingsConnectCallback(ActuatorSettingsUpdatedCb);
}

View File

@ -131,8 +131,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
HwSettingsInitialize();
SETTINGS_INITIALISE_ALL;
/* Initialize the alarms library */
AlarmsInitialize();

View File

@ -79,7 +79,6 @@ UAVOBJSRCFILENAMES += mixersettings
UAVOBJSRCFILENAMES += mixerstatus
UAVOBJSRCFILENAMES += nedaccel
UAVOBJSRCFILENAMES += objectpersistence
UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathplan

View File

@ -142,8 +142,6 @@ void PIOS_Board_Init(void)
EventDispatcherInitialize();
UAVObjInitialize();
HwSettingsInitialize();
UAVObjectsInitializeAll();
/* Initialize the alarms library */

View File

@ -77,8 +77,6 @@ UAVOBJSRCFILENAMES += mixerstatus
UAVOBJSRCFILENAMES += nedaccel
UAVOBJSRCFILENAMES += objectpersistence
UAVOBJSRCFILENAMES += oplinkreceiver
UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathplan

View File

@ -173,7 +173,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
HwSettingsInitialize();
SETTINGS_INITIALISE_ALL;
/* Initialize the alarms library */
AlarmsInitialize();

View File

@ -77,8 +77,6 @@ UAVOBJSRCFILENAMES += mixerstatus
UAVOBJSRCFILENAMES += nedaccel
UAVOBJSRCFILENAMES += objectpersistence
UAVOBJSRCFILENAMES += oplinkreceiver
UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathplan

View File

@ -124,6 +124,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
SETTINGS_INITIALISE_ALL;
#if defined(PIOS_INCLUDE_RTC)
/* Initialize the real-time clock and its associated tick */
@ -140,9 +141,6 @@ void PIOS_Board_Init(void)
PIOS_IAP_WriteBootCmd(2, 0);
}
HwSettingsInitialize();
HwSPRacingF3SettingsInitialize();
#ifndef ERASE_FLASH
#ifdef PIOS_INCLUDE_WDG
/* Initialize watchdog as early as possible to catch faults during init */

View File

@ -77,8 +77,6 @@ UAVOBJSRCFILENAMES += mixerstatus
UAVOBJSRCFILENAMES += nedaccel
UAVOBJSRCFILENAMES += objectpersistence
UAVOBJSRCFILENAMES += oplinkreceiver
UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathplan

View File

@ -135,6 +135,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
SETTINGS_INITIALISE_ALL;
#if defined(PIOS_INCLUDE_RTC)
/* Initialize the real-time clock and its associated tick */
@ -151,9 +152,6 @@ void PIOS_Board_Init(void)
PIOS_IAP_WriteBootCmd(2, 0);
}
HwSettingsInitialize();
HwSPRacingF3EVOSettingsInitialize();
#ifndef ERASE_FLASH
#ifdef PIOS_INCLUDE_WDG
/* Initialize watchdog as early as possible to catch faults during init */

View File

@ -77,8 +77,6 @@ UAVOBJSRCFILENAMES += mixerstatus
UAVOBJSRCFILENAMES += nedaccel
UAVOBJSRCFILENAMES += objectpersistence
UAVOBJSRCFILENAMES += oplinkreceiver
UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathplan

View File

@ -146,6 +146,7 @@ void PIOS_Board_Init(void)
/* Initialize UAVObject libraries */
EventDispatcherInitialize();
UAVObjInitialize();
SETTINGS_INITIALISE_ALL;
#if defined(PIOS_INCLUDE_RTC)
/* Initialize the real-time clock and its associated tick */
@ -162,9 +163,6 @@ void PIOS_Board_Init(void)
PIOS_IAP_WriteBootCmd(2, 0);
}
HwSettingsInitialize();
HwTinyFISHSettingsInitialize();
#ifndef ERASE_FLASH
#ifdef PIOS_INCLUDE_WDG
/* Initialize watchdog as early as possible to catch faults during init */

View File

@ -46,6 +46,10 @@ static UAVObjHandle handle __attribute__((section("__DATA,_uavo_handles")));
static UAVObjHandle handle __attribute__((section("_uavo_handles")));
#endif
#if $(NAMEUC)_ISSETTINGS
SETTINGS_INITCALL($(NAME)Initialize);
#endif
/**
* Initialize object.
* \return 0 Success