mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-06 21:54:15 +01:00
LP-73 uncrustify
This commit is contained in:
parent
5cb042e703
commit
e0a805518f
@ -84,7 +84,7 @@
|
|||||||
#define REGISTER_WDG()
|
#define REGISTER_WDG()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const TickType_t sensor_period_ticks = ((uint32_t) (1000.0f / PIOS_SENSOR_RATE / (float) portTICK_RATE_MS));
|
static const TickType_t sensor_period_ticks = ((uint32_t)(1000.0f / PIOS_SENSOR_RATE / (float)portTICK_RATE_MS));
|
||||||
|
|
||||||
// Interval in number of sample to recalculate temp bias
|
// Interval in number of sample to recalculate temp bias
|
||||||
#define TEMP_CALIB_INTERVAL 30
|
#define TEMP_CALIB_INTERVAL 30
|
||||||
@ -263,7 +263,7 @@ static void SensorsTask(__attribute__((unused)) void *parameters)
|
|||||||
bool sensors_test = true;
|
bool sensors_test = true;
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
LL_FOREACH((PIOS_SENSORS_Instance *)sensors_list, sensor) {
|
LL_FOREACH((PIOS_SENSORS_Instance *)sensors_list, sensor) {
|
||||||
RELOAD_WDG(); // mag tests on I2C have 200+(7x10)ms delay calls in them
|
RELOAD_WDG(); // mag tests on I2C have 200+(7x10)ms delay calls in them
|
||||||
sensors_test &= PIOS_SENSORS_Test(sensor);
|
sensors_test &= PIOS_SENSORS_Test(sensor);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@ -299,6 +299,7 @@ static void SensorsTask(__attribute__((unused)) void *parameters)
|
|||||||
LL_FOREACH((PIOS_SENSORS_Instance *)sensors_list, sensor) {
|
LL_FOREACH((PIOS_SENSORS_Instance *)sensors_list, sensor) {
|
||||||
// we will wait on the sensor that's marked as primary( that means the sensor with higher sample rate)
|
// we will wait on the sensor that's marked as primary( that means the sensor with higher sample rate)
|
||||||
bool is_primary = (sensor->type & PIOS_SENSORS_TYPE_3AXIS_ACCEL);
|
bool is_primary = (sensor->type & PIOS_SENSORS_TYPE_3AXIS_ACCEL);
|
||||||
|
|
||||||
if (!sensor->driver->is_polled) {
|
if (!sensor->driver->is_polled) {
|
||||||
const QueueHandle_t queue = PIOS_SENSORS_GetQueue(sensor);
|
const QueueHandle_t queue = PIOS_SENSORS_GetQueue(sensor);
|
||||||
while (xQueueReceive(queue,
|
while (xQueueReceive(queue,
|
||||||
@ -378,10 +379,12 @@ static void processSamples3d(sensor_fetch_context *sensor_context, const PIOS_SE
|
|||||||
handleMag(samples, temperature);
|
handleMag(samples, temperature);
|
||||||
PERF_MEASURE_PERIOD(counterMagPeriod);
|
PERF_MEASURE_PERIOD(counterMagPeriod);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case PIOS_SENSORS_TYPE_3AXIS_AUXMAG:
|
case PIOS_SENSORS_TYPE_3AXIS_AUXMAG:
|
||||||
handleAuxMag(samples);
|
handleAuxMag(samples);
|
||||||
PERF_MEASURE_PERIOD(counterMagPeriod);
|
PERF_MEASURE_PERIOD(counterMagPeriod);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PERF_TRACK_VALUE(counterAccelSamples, sensor_context->count);
|
PERF_TRACK_VALUE(counterAccelSamples, sensor_context->count);
|
||||||
PERF_MEASURE_PERIOD(counterAccelPeriod);
|
PERF_MEASURE_PERIOD(counterAccelPeriod);
|
||||||
@ -584,7 +587,7 @@ static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *objEv)
|
|||||||
float sumQuat[4];
|
float sumQuat[4];
|
||||||
const float trimRpy[3] = { attitudeSettings.BoardLevelTrim.Roll, attitudeSettings.BoardLevelTrim.Pitch, 0.0f };
|
const float trimRpy[3] = { attitudeSettings.BoardLevelTrim.Roll, attitudeSettings.BoardLevelTrim.Pitch, 0.0f };
|
||||||
// do we actually want to include BoardLevelTrim in the mag rotation? BoardRotation yes, but BoardLevelTrim?
|
// do we actually want to include BoardLevelTrim in the mag rotation? BoardRotation yes, but BoardLevelTrim?
|
||||||
// and is BoardLevelTrim done at the correct point in the sequence of rotations?
|
// and is BoardLevelTrim done at the correct point in the sequence of rotations?
|
||||||
RPY2Quaternion(trimRpy, trimQuat);
|
RPY2Quaternion(trimRpy, trimQuat);
|
||||||
|
|
||||||
// add the boardrotation and boardtrim rotations and put them into a rotation matrix
|
// add the boardrotation and boardtrim rotations and put them into a rotation matrix
|
||||||
|
@ -158,11 +158,11 @@ pios_hmc5x83_dev_t PIOS_HMC5x83_Init(const struct pios_hmc5x83_cfg *cfg, uint32_
|
|||||||
dev->magCountMax = 1;
|
dev->magCountMax = 1;
|
||||||
#endif /* PIOS_SENSOR_RATE */
|
#endif /* PIOS_SENSOR_RATE */
|
||||||
// with this counter
|
// with this counter
|
||||||
dev->magCount = 0;
|
dev->magCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PIOS_HMC5x83_Config(dev) != 0) {
|
if (PIOS_HMC5x83_Config(dev) != 0) {
|
||||||
return ((pios_hmc5x83_dev_t) NULL);
|
return (pios_hmc5x83_dev_t)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->data_ready = false;
|
dev->data_ready = false;
|
||||||
@ -405,12 +405,11 @@ bool PIOS_HMC5x83_NewDataAvailable(__attribute__((unused)) pios_hmc5x83_dev_t ha
|
|||||||
pios_hmc5x83_dev_data_t *dev = dev_validate(handler);
|
pios_hmc5x83_dev_data_t *dev = dev_validate(handler);
|
||||||
|
|
||||||
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
||||||
if (dev->cfg->exti_cfg) { // if this device has an interrupt line attached, then wait for interrupt to say data is ready
|
if (dev->cfg->exti_cfg) { // if this device has an interrupt line attached, then wait for interrupt to say data is ready
|
||||||
return dev->data_ready;
|
return dev->data_ready;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
#endif /* PIOS_HMC5X83_HAS_GPIOS */
|
#endif /* PIOS_HMC5X83_HAS_GPIOS */
|
||||||
{ // else poll to see if data is ready or just say "true" and set polling interval elsewhere
|
{ // else poll to see if data is ready or just say "true" and set polling interval elsewhere
|
||||||
if (++(dev->magCount) >= dev->magCountMax) {
|
if (++(dev->magCount) >= dev->magCountMax) {
|
||||||
dev->magCount = 0;
|
dev->magCount = 0;
|
||||||
return true;
|
return true;
|
||||||
@ -521,6 +520,7 @@ int32_t PIOS_HMC5x83_Test(pios_hmc5x83_dev_t handler)
|
|||||||
bool PIOS_HMC5x83_IRQHandler(pios_hmc5x83_dev_t handler)
|
bool PIOS_HMC5x83_IRQHandler(pios_hmc5x83_dev_t handler)
|
||||||
{
|
{
|
||||||
pios_hmc5x83_dev_data_t *dev = dev_validate(handler);
|
pios_hmc5x83_dev_data_t *dev = dev_validate(handler);
|
||||||
|
|
||||||
dev->data_ready = true;
|
dev->data_ready = true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -106,7 +106,8 @@ extern void StartModules();
|
|||||||
(fn->fn_tinit)(); \
|
(fn->fn_tinit)(); \
|
||||||
PIOS_WDG_Clear(); \
|
PIOS_WDG_Clear(); \
|
||||||
} \
|
} \
|
||||||
} }
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* USE_SIM_POSIX */
|
#endif /* USE_SIM_POSIX */
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ void PIOS_ADC_DMC_irq_handler(void)
|
|||||||
|
|
||||||
#if defined(PIOS_INCLUDE_HMC5X83)
|
#if defined(PIOS_INCLUDE_HMC5X83)
|
||||||
#include "pios_hmc5x83.h"
|
#include "pios_hmc5x83.h"
|
||||||
pios_hmc5x83_dev_t onboard_mag = 0;
|
pios_hmc5x83_dev_t onboard_mag = 0;
|
||||||
pios_hmc5x83_dev_t external_mag = 0;
|
pios_hmc5x83_dev_t external_mag = 0;
|
||||||
|
|
||||||
bool pios_board_internal_mag_handler()
|
bool pios_board_internal_mag_handler()
|
||||||
@ -134,28 +134,28 @@ static const struct pios_exti_cfg pios_exti_hmc5x83_cfg __exti_config = {
|
|||||||
|
|
||||||
static const struct pios_hmc5x83_cfg pios_hmc5x83_internal_cfg = {
|
static const struct pios_hmc5x83_cfg pios_hmc5x83_internal_cfg = {
|
||||||
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
||||||
.exti_cfg = &pios_exti_hmc5x83_cfg,
|
.exti_cfg = &pios_exti_hmc5x83_cfg,
|
||||||
#endif
|
#endif
|
||||||
.M_ODR = PIOS_HMC5x83_ODR_75,
|
.M_ODR = PIOS_HMC5x83_ODR_75,
|
||||||
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
||||||
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
||||||
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
||||||
.TempCompensation = false,
|
.TempCompensation = false,
|
||||||
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
||||||
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP,
|
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct pios_hmc5x83_cfg pios_hmc5x83_external_cfg = {
|
static const struct pios_hmc5x83_cfg pios_hmc5x83_external_cfg = {
|
||||||
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
||||||
.exti_cfg = NULL,
|
.exti_cfg = NULL,
|
||||||
#endif
|
#endif
|
||||||
.M_ODR = PIOS_HMC5x83_ODR_75, // if you change this for auxmag, change AUX_MAG_SKIP in sensors.c
|
.M_ODR = PIOS_HMC5x83_ODR_75, // if you change this for auxmag, change AUX_MAG_SKIP in sensors.c
|
||||||
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
||||||
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
||||||
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
||||||
.TempCompensation = false,
|
.TempCompensation = false,
|
||||||
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
||||||
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP, // ENU for GPSV9, WND for typical I2C mag
|
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP, // ENU for GPSV9, WND for typical I2C mag
|
||||||
};
|
};
|
||||||
#endif /* PIOS_INCLUDE_HMC5X83 */
|
#endif /* PIOS_INCLUDE_HMC5X83 */
|
||||||
|
|
||||||
@ -682,7 +682,7 @@ void PIOS_Board_Init(void)
|
|||||||
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
}
|
}
|
||||||
PIOS_DELAY_WaitmS(50); // this was after the other PIOS_I2C_Init(), so I copied it here too
|
PIOS_DELAY_WaitmS(50); // this was after the other PIOS_I2C_Init(), so I copied it here too
|
||||||
#ifdef PIOS_INCLUDE_WDG
|
#ifdef PIOS_INCLUDE_WDG
|
||||||
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
||||||
// this is not in a loop, so it is safe
|
// this is not in a loop, so it is safe
|
||||||
@ -710,7 +710,7 @@ void PIOS_Board_Init(void)
|
|||||||
// as that would cause delay and time jitter for the second fast sensor
|
// as that would cause delay and time jitter for the second fast sensor
|
||||||
PIOS_HMC5x83_Register(external_mag, PIOS_SENSORS_TYPE_3AXIS_AUXMAG);
|
PIOS_HMC5x83_Register(external_mag, PIOS_SENSORS_TYPE_3AXIS_AUXMAG);
|
||||||
// mag alarm is cleared later, so use I2C
|
// mag alarm is cleared later, so use I2C
|
||||||
AlarmsSet(SYSTEMALARMS_ALARM_I2C, (external_mag)?SYSTEMALARMS_ALARM_OK:SYSTEMALARMS_ALARM_WARNING);
|
AlarmsSet(SYSTEMALARMS_ALARM_I2C, (external_mag) ? SYSTEMALARMS_ALARM_OK : SYSTEMALARMS_ALARM_WARNING);
|
||||||
}
|
}
|
||||||
#endif /* PIOS_INCLUDE_HMC5X83 */
|
#endif /* PIOS_INCLUDE_HMC5X83 */
|
||||||
#endif /* PIOS_INCLUDE_I2C */
|
#endif /* PIOS_INCLUDE_I2C */
|
||||||
|
@ -93,7 +93,7 @@ void PIOS_ADC_DMC_irq_handler(void)
|
|||||||
|
|
||||||
#if defined(PIOS_INCLUDE_HMC5X83)
|
#if defined(PIOS_INCLUDE_HMC5X83)
|
||||||
#include "pios_hmc5x83.h"
|
#include "pios_hmc5x83.h"
|
||||||
pios_hmc5x83_dev_t onboard_mag = 0;
|
pios_hmc5x83_dev_t onboard_mag = 0;
|
||||||
pios_hmc5x83_dev_t external_mag = 0;
|
pios_hmc5x83_dev_t external_mag = 0;
|
||||||
|
|
||||||
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
||||||
@ -136,28 +136,28 @@ static const struct pios_exti_cfg pios_exti_hmc5x83_cfg __exti_config = {
|
|||||||
|
|
||||||
static const struct pios_hmc5x83_cfg pios_hmc5x83_internal_cfg = {
|
static const struct pios_hmc5x83_cfg pios_hmc5x83_internal_cfg = {
|
||||||
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
||||||
.exti_cfg = &pios_exti_hmc5x83_cfg,
|
.exti_cfg = &pios_exti_hmc5x83_cfg,
|
||||||
#endif
|
#endif
|
||||||
.M_ODR = PIOS_HMC5x83_ODR_75,
|
.M_ODR = PIOS_HMC5x83_ODR_75,
|
||||||
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
||||||
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
||||||
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
||||||
.TempCompensation = false,
|
.TempCompensation = false,
|
||||||
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
||||||
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP,
|
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct pios_hmc5x83_cfg pios_hmc5x83_external_cfg = {
|
static const struct pios_hmc5x83_cfg pios_hmc5x83_external_cfg = {
|
||||||
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
||||||
.exti_cfg = NULL,
|
.exti_cfg = NULL,
|
||||||
#endif
|
#endif
|
||||||
.M_ODR = PIOS_HMC5x83_ODR_75, // if you change this for auxmag, change AUX_MAG_SKIP in sensors.c
|
.M_ODR = PIOS_HMC5x83_ODR_75, // if you change this for auxmag, change AUX_MAG_SKIP in sensors.c
|
||||||
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
||||||
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
||||||
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
||||||
.TempCompensation = false,
|
.TempCompensation = false,
|
||||||
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
||||||
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP, // ENU for GPSV9, WND for typical I2C mag
|
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP, // ENU for GPSV9, WND for typical I2C mag
|
||||||
};
|
};
|
||||||
#endif /* PIOS_INCLUDE_HMC5X83 */
|
#endif /* PIOS_INCLUDE_HMC5X83 */
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ void PIOS_Board_Init(void)
|
|||||||
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
}
|
}
|
||||||
PIOS_DELAY_WaitmS(50); // this was after the other PIOS_I2C_Init(), so I copied it here too
|
PIOS_DELAY_WaitmS(50); // this was after the other PIOS_I2C_Init(), so I copied it here too
|
||||||
#ifdef PIOS_INCLUDE_WDG
|
#ifdef PIOS_INCLUDE_WDG
|
||||||
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
||||||
// this is not in a loop, so it is safe
|
// this is not in a loop, so it is safe
|
||||||
@ -521,7 +521,7 @@ void PIOS_Board_Init(void)
|
|||||||
// as that would cause delay and time jitter for the second fast sensor
|
// as that would cause delay and time jitter for the second fast sensor
|
||||||
PIOS_HMC5x83_Register(external_mag, PIOS_SENSORS_TYPE_3AXIS_AUXMAG);
|
PIOS_HMC5x83_Register(external_mag, PIOS_SENSORS_TYPE_3AXIS_AUXMAG);
|
||||||
// mag alarm is cleared later, so use I2C
|
// mag alarm is cleared later, so use I2C
|
||||||
AlarmsSet(SYSTEMALARMS_ALARM_I2C, (external_mag)?SYSTEMALARMS_ALARM_OK:SYSTEMALARMS_ALARM_WARNING);
|
AlarmsSet(SYSTEMALARMS_ALARM_I2C, (external_mag) ? SYSTEMALARMS_ALARM_OK : SYSTEMALARMS_ALARM_WARNING);
|
||||||
}
|
}
|
||||||
#endif /* PIOS_INCLUDE_HMC5X83 */
|
#endif /* PIOS_INCLUDE_HMC5X83 */
|
||||||
#endif /* PIOS_INCLUDE_I2C */
|
#endif /* PIOS_INCLUDE_I2C */
|
||||||
|
@ -101,15 +101,15 @@ pios_hmc5x83_dev_t external_mag = 0;
|
|||||||
|
|
||||||
static const struct pios_hmc5x83_cfg pios_hmc5x83_external_cfg = {
|
static const struct pios_hmc5x83_cfg pios_hmc5x83_external_cfg = {
|
||||||
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
||||||
.exti_cfg = NULL,
|
.exti_cfg = NULL,
|
||||||
#endif
|
#endif
|
||||||
.M_ODR = PIOS_HMC5x83_ODR_75, // if you change this for auxmag, change AUX_MAG_SKIP in sensors.c
|
.M_ODR = PIOS_HMC5x83_ODR_75, // if you change this for auxmag, change AUX_MAG_SKIP in sensors.c
|
||||||
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
||||||
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
||||||
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
||||||
.TempCompensation = false,
|
.TempCompensation = false,
|
||||||
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
||||||
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP, // ENU for GPSV9, WND for typical I2C mag
|
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP, // ENU for GPSV9, WND for typical I2C mag
|
||||||
};
|
};
|
||||||
#endif /* PIOS_INCLUDE_HMC5X83 */
|
#endif /* PIOS_INCLUDE_HMC5X83 */
|
||||||
|
|
||||||
@ -639,7 +639,7 @@ void PIOS_Board_Init(void)
|
|||||||
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
}
|
}
|
||||||
PIOS_DELAY_WaitmS(50); // this was after the other PIOS_I2C_Init(), so I copied it here too
|
PIOS_DELAY_WaitmS(50); // this was after the other PIOS_I2C_Init(), so I copied it here too
|
||||||
#ifdef PIOS_INCLUDE_WDG
|
#ifdef PIOS_INCLUDE_WDG
|
||||||
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
||||||
// this is not in a loop, so it is safe
|
// this is not in a loop, so it is safe
|
||||||
@ -667,7 +667,7 @@ void PIOS_Board_Init(void)
|
|||||||
// as that would cause delay and time jitter for the second fast sensor
|
// as that would cause delay and time jitter for the second fast sensor
|
||||||
PIOS_HMC5x83_Register(external_mag, PIOS_SENSORS_TYPE_3AXIS_AUXMAG);
|
PIOS_HMC5x83_Register(external_mag, PIOS_SENSORS_TYPE_3AXIS_AUXMAG);
|
||||||
// mag alarm is cleared later, so use I2C
|
// mag alarm is cleared later, so use I2C
|
||||||
AlarmsSet(SYSTEMALARMS_ALARM_I2C, (external_mag)?SYSTEMALARMS_ALARM_OK:SYSTEMALARMS_ALARM_WARNING);
|
AlarmsSet(SYSTEMALARMS_ALARM_I2C, (external_mag) ? SYSTEMALARMS_ALARM_OK : SYSTEMALARMS_ALARM_WARNING);
|
||||||
}
|
}
|
||||||
#endif /* PIOS_INCLUDE_HMC5X83 */
|
#endif /* PIOS_INCLUDE_HMC5X83 */
|
||||||
#endif /* PIOS_INCLUDE_I2C */
|
#endif /* PIOS_INCLUDE_I2C */
|
||||||
|
@ -85,7 +85,7 @@ void PIOS_ADC_DMC_irq_handler(void)
|
|||||||
#if defined(PIOS_INCLUDE_HMC5X83)
|
#if defined(PIOS_INCLUDE_HMC5X83)
|
||||||
#include "pios_hmc5x83.h"
|
#include "pios_hmc5x83.h"
|
||||||
|
|
||||||
pios_hmc5x83_dev_t onboard_mag = 0;
|
pios_hmc5x83_dev_t onboard_mag = 0;
|
||||||
pios_hmc5x83_dev_t external_mag = 0;
|
pios_hmc5x83_dev_t external_mag = 0;
|
||||||
|
|
||||||
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
||||||
@ -127,28 +127,28 @@ static const struct pios_exti_cfg pios_exti_hmc5x83_cfg __exti_config = {
|
|||||||
|
|
||||||
static const struct pios_hmc5x83_cfg pios_hmc5x83_internal_cfg = {
|
static const struct pios_hmc5x83_cfg pios_hmc5x83_internal_cfg = {
|
||||||
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
||||||
.exti_cfg = &pios_exti_hmc5x83_cfg,
|
.exti_cfg = &pios_exti_hmc5x83_cfg,
|
||||||
#endif
|
#endif
|
||||||
.M_ODR = PIOS_HMC5x83_ODR_75,
|
.M_ODR = PIOS_HMC5x83_ODR_75,
|
||||||
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
||||||
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
||||||
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
||||||
.TempCompensation = false,
|
.TempCompensation = false,
|
||||||
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
||||||
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP,
|
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct pios_hmc5x83_cfg pios_hmc5x83_external_cfg = {
|
static const struct pios_hmc5x83_cfg pios_hmc5x83_external_cfg = {
|
||||||
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
#ifdef PIOS_HMC5X83_HAS_GPIOS
|
||||||
.exti_cfg = NULL,
|
.exti_cfg = NULL,
|
||||||
#endif
|
#endif
|
||||||
.M_ODR = PIOS_HMC5x83_ODR_75, // if you change this for auxmag, change AUX_MAG_SKIP in sensors.c
|
.M_ODR = PIOS_HMC5x83_ODR_75, // if you change this for auxmag, change AUX_MAG_SKIP in sensors.c
|
||||||
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
.Meas_Conf = PIOS_HMC5x83_MEASCONF_NORMAL,
|
||||||
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
.Gain = PIOS_HMC5x83_GAIN_1_9,
|
||||||
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
.Mode = PIOS_HMC5x83_MODE_CONTINUOUS,
|
||||||
.TempCompensation = false,
|
.TempCompensation = false,
|
||||||
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
.Driver = &PIOS_HMC5x83_I2C_DRIVER,
|
||||||
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP,
|
.Orientation = PIOS_HMC5X83_ORIENTATION_EAST_NORTH_UP,
|
||||||
};
|
};
|
||||||
#endif /* PIOS_INCLUDE_HMC5X83 */
|
#endif /* PIOS_INCLUDE_HMC5X83 */
|
||||||
|
|
||||||
@ -776,7 +776,7 @@ void PIOS_Board_Init(void)
|
|||||||
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
if (PIOS_I2C_Init(&pios_i2c_flexiport_adapter_id, &pios_i2c_flexiport_adapter_cfg)) {
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
}
|
}
|
||||||
PIOS_DELAY_WaitmS(50); // this was after the other PIOS_I2C_Init(), so I copied it here too
|
PIOS_DELAY_WaitmS(50); // this was after the other PIOS_I2C_Init(), so I copied it here too
|
||||||
#ifdef PIOS_INCLUDE_WDG
|
#ifdef PIOS_INCLUDE_WDG
|
||||||
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
// give HMC5x83 on I2C some extra time to allow for reset, etc. if needed
|
||||||
// this is not in a loop, so it is safe
|
// this is not in a loop, so it is safe
|
||||||
@ -801,7 +801,7 @@ void PIOS_Board_Init(void)
|
|||||||
// add this sensor to the sensor task's list
|
// add this sensor to the sensor task's list
|
||||||
PIOS_HMC5x83_Register(external_mag, PIOS_SENSORS_TYPE_3AXIS_AUXMAG);
|
PIOS_HMC5x83_Register(external_mag, PIOS_SENSORS_TYPE_3AXIS_AUXMAG);
|
||||||
// mag alarm is cleared later, so use I2C
|
// mag alarm is cleared later, so use I2C
|
||||||
AlarmsSet(SYSTEMALARMS_ALARM_I2C, (external_mag)?SYSTEMALARMS_ALARM_OK:SYSTEMALARMS_ALARM_WARNING);
|
AlarmsSet(SYSTEMALARMS_ALARM_I2C, (external_mag) ? SYSTEMALARMS_ALARM_OK : SYSTEMALARMS_ALARM_WARNING);
|
||||||
}
|
}
|
||||||
#endif /* PIOS_INCLUDE_HMC5X83 */
|
#endif /* PIOS_INCLUDE_HMC5X83 */
|
||||||
#endif /* PIOS_INCLUDE_I2C */
|
#endif /* PIOS_INCLUDE_I2C */
|
||||||
|
@ -245,7 +245,7 @@ void ConfigRevoWidget::storeAndClearBoardRotation()
|
|||||||
// Store current aux mag board rotation
|
// Store current aux mag board rotation
|
||||||
AuxMagSettings *auxMagSettings = AuxMagSettings::GetInstance(getObjectManager());
|
AuxMagSettings *auxMagSettings = AuxMagSettings::GetInstance(getObjectManager());
|
||||||
Q_ASSERT(auxMagSettings);
|
Q_ASSERT(auxMagSettings);
|
||||||
AuxMagSettings::DataFields auxMagData = auxMagSettings->getData();
|
AuxMagSettings::DataFields auxMagData = auxMagSettings->getData();
|
||||||
auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_YAW] = auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_YAW];
|
auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_YAW] = auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_YAW];
|
||||||
auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_ROLL] = auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_ROLL];
|
auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_ROLL] = auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_ROLL];
|
||||||
auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_PITCH] = auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_PITCH];
|
auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_PITCH] = auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_PITCH];
|
||||||
@ -276,7 +276,7 @@ void ConfigRevoWidget::recallBoardRotation()
|
|||||||
// Restore the aux mag board rotation
|
// Restore the aux mag board rotation
|
||||||
AuxMagSettings *auxMagSettings = AuxMagSettings::GetInstance(getObjectManager());
|
AuxMagSettings *auxMagSettings = AuxMagSettings::GetInstance(getObjectManager());
|
||||||
Q_ASSERT(auxMagSettings);
|
Q_ASSERT(auxMagSettings);
|
||||||
AuxMagSettings::DataFields auxMagData = auxMagSettings->getData();
|
AuxMagSettings::DataFields auxMagData = auxMagSettings->getData();
|
||||||
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_YAW] = auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_YAW];
|
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_YAW] = auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_YAW];
|
||||||
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_ROLL] = auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_ROLL];
|
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_ROLL] = auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_ROLL];
|
||||||
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_PITCH] = auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_PITCH];
|
auxMagData.BoardRotation[AuxMagSettings::BOARDROTATION_PITCH] = auxMagStoredBoardRotation[AuxMagSettings::BOARDROTATION_PITCH];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user