Revert "add boolean parameters to enable/disable each sensor"

This reverts commit 9fde19259e.
This commit is contained in:
Paul Riseborough
2017-10-30 20:49:36 +11:00
parent 3a57712d2b
commit b3d045d4d0
5 changed files with 10 additions and 110 deletions
-24
View File
@@ -45,14 +45,6 @@ PARAM_DEFINE_INT32(CAL_ACC_PRIME, 0);
*/ */
PARAM_DEFINE_INT32(CAL_ACC0_ID, 0); PARAM_DEFINE_INT32(CAL_ACC0_ID, 0);
/**
* Accelerometer 0 enabled
*
* @boolean
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_ACC0_EN, 1);
/** /**
* Accelerometer X-axis offset * Accelerometer X-axis offset
* *
@@ -102,14 +94,6 @@ PARAM_DEFINE_FLOAT(CAL_ACC0_ZSCALE, 1.0f);
*/ */
PARAM_DEFINE_INT32(CAL_ACC1_ID, 0); PARAM_DEFINE_INT32(CAL_ACC1_ID, 0);
/**
* Accelerometer 1 enabled
*
* @boolean
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_ACC1_EN, 1);
/** /**
* Accelerometer X-axis offset * Accelerometer X-axis offset
* *
@@ -159,14 +143,6 @@ PARAM_DEFINE_FLOAT(CAL_ACC1_ZSCALE, 1.0f);
*/ */
PARAM_DEFINE_INT32(CAL_ACC2_ID, 0); PARAM_DEFINE_INT32(CAL_ACC2_ID, 0);
/**
* Accelerometer 2 enabled
*
* @boolean
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_ACC2_EN, 1);
/** /**
* Accelerometer X-axis offset * Accelerometer X-axis offset
* *
-24
View File
@@ -45,14 +45,6 @@ PARAM_DEFINE_INT32(CAL_GYRO_PRIME, 0);
*/ */
PARAM_DEFINE_INT32(CAL_GYRO0_ID, 0); PARAM_DEFINE_INT32(CAL_GYRO0_ID, 0);
/**
* Gyro 0 enabled
*
* @boolean
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_GYRO0_EN, 1);
/** /**
* Gyro X-axis offset * Gyro X-axis offset
* *
@@ -102,14 +94,6 @@ PARAM_DEFINE_FLOAT(CAL_GYRO0_ZSCALE, 1.0f);
*/ */
PARAM_DEFINE_INT32(CAL_GYRO1_ID, 0); PARAM_DEFINE_INT32(CAL_GYRO1_ID, 0);
/**
* Gyro 1 enabled
*
* @boolean
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_GYRO1_EN, 1);
/** /**
* Gyro X-axis offset * Gyro X-axis offset
* *
@@ -159,14 +143,6 @@ PARAM_DEFINE_FLOAT(CAL_GYRO1_ZSCALE, 1.0f);
*/ */
PARAM_DEFINE_INT32(CAL_GYRO2_ID, 0); PARAM_DEFINE_INT32(CAL_GYRO2_ID, 0);
/**
* Gyro 2 enabled
*
* @boolean
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_GYRO2_EN, 1);
/** /**
* Gyro X-axis offset * Gyro X-axis offset
* *
-32
View File
@@ -65,14 +65,6 @@ PARAM_DEFINE_INT32(CAL_MAG_SIDES, 63);
*/ */
PARAM_DEFINE_INT32(CAL_MAG0_ID, 0); PARAM_DEFINE_INT32(CAL_MAG0_ID, 0);
/**
* Mag 0 enabled
*
* @boolean
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_MAG0_EN, 1);
/** /**
* Rotation of magnetometer 0 relative to airframe. * Rotation of magnetometer 0 relative to airframe.
* *
@@ -164,14 +156,6 @@ PARAM_DEFINE_FLOAT(CAL_MAG0_ZSCALE, 1.0f);
*/ */
PARAM_DEFINE_INT32(CAL_MAG1_ID, 0); PARAM_DEFINE_INT32(CAL_MAG1_ID, 0);
/**
* Mag 1 enabled
*
* @boolean
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_MAG1_EN, 1);
/** /**
* Rotation of magnetometer 1 relative to airframe. * Rotation of magnetometer 1 relative to airframe.
* *
@@ -263,14 +247,6 @@ PARAM_DEFINE_FLOAT(CAL_MAG1_ZSCALE, 1.0f);
*/ */
PARAM_DEFINE_INT32(CAL_MAG2_ID, 0); PARAM_DEFINE_INT32(CAL_MAG2_ID, 0);
/**
* Mag 2 enabled
*
* @boolean
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_MAG2_EN, 1);
/** /**
* Rotation of magnetometer 2 relative to airframe. * Rotation of magnetometer 2 relative to airframe.
* *
@@ -364,14 +340,6 @@ PARAM_DEFINE_FLOAT(CAL_MAG2_ZSCALE, 1.0f);
*/ */
PARAM_DEFINE_INT32(CAL_MAG3_ID, 0); PARAM_DEFINE_INT32(CAL_MAG3_ID, 0);
/**
* Mag 3 enabled
*
* @boolean
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_MAG3_EN, 1);
/** /**
* Rotation of magnetometer 2 relative to airframe. * Rotation of magnetometer 2 relative to airframe.
* *
+10 -28
View File
@@ -168,10 +168,10 @@ void VotedSensorsUpdate::parameters_update()
if (temp < 0) { if (temp < 0) {
PX4_ERR("gyro temp compensation init: failed to find device ID %u for instance %i", PX4_ERR("gyro temp compensation init: failed to find device ID %u for instance %i",
report.device_id, topic_instance); report.device_id, topic_instance);
_corrections.gyro_mapping[topic_instance] = 0; _corrections.gyro_mapping[topic_instance] = 0;
} else { } else {
_corrections.gyro_mapping[topic_instance] = temp; _corrections.gyro_mapping[topic_instance] = temp;
} }
} }
@@ -192,10 +192,10 @@ void VotedSensorsUpdate::parameters_update()
if (temp < 0) { if (temp < 0) {
PX4_ERR("accel temp compensation init: failed to find device ID %u for instance %i", PX4_ERR("accel temp compensation init: failed to find device ID %u for instance %i",
report.device_id, topic_instance); report.device_id, topic_instance);
_corrections.accel_mapping[topic_instance] = 0; _corrections.accel_mapping[topic_instance] = 0;
} else { } else {
_corrections.accel_mapping[topic_instance] = temp; _corrections.accel_mapping[topic_instance] = temp;
} }
} }
@@ -215,10 +215,10 @@ void VotedSensorsUpdate::parameters_update()
if (temp < 0) { if (temp < 0) {
PX4_ERR("baro temp compensation init: failed to find device ID %u for instance %i", PX4_ERR("baro temp compensation init: failed to find device ID %u for instance %i",
report.device_id, topic_instance); report.device_id, topic_instance);
_corrections.baro_mapping[topic_instance] = 0; _corrections.baro_mapping[topic_instance] = 0;
} else { } else {
_corrections.baro_mapping[topic_instance] = temp; _corrections.baro_mapping[topic_instance] = temp;
} }
} }
@@ -258,12 +258,6 @@ void VotedSensorsUpdate::parameters_update()
int32_t device_id; int32_t device_id;
failed = failed || (OK != param_get(param_find(str), &device_id)); failed = failed || (OK != param_get(param_find(str), &device_id));
(void)sprintf(str, "CAL_GYRO%u_EN", i);
int32_t device_enabled = 0;
failed = failed || (OK != param_get(param_find(str), &device_enabled));
_gyro.enabled[i] = (device_enabled == 1);
if (failed) { if (failed) {
continue; continue;
} }
@@ -346,12 +340,6 @@ void VotedSensorsUpdate::parameters_update()
int32_t device_id; int32_t device_id;
failed = failed || (OK != param_get(param_find(str), &device_id)); failed = failed || (OK != param_get(param_find(str), &device_id));
(void)sprintf(str, "CAL_ACC%u_EN", i);
int32_t device_enabled = 0;
failed = failed || (OK != param_get(param_find(str), &device_enabled));
_accel.enabled[i] = (device_enabled == 1);
if (failed) { if (failed) {
continue; continue;
} }
@@ -462,12 +450,6 @@ void VotedSensorsUpdate::parameters_update()
int32_t device_id; int32_t device_id;
failed = failed || (OK != param_get(param_find(str), &device_id)); failed = failed || (OK != param_get(param_find(str), &device_id));
(void)sprintf(str, "CAL_MAG%u_EN", i);
int32_t device_enabled = 0;
failed = failed || (OK != param_get(param_find(str), &device_enabled));
_mag.enabled[i] = (device_enabled == 1);
if (failed) { if (failed) {
continue; continue;
} }
@@ -549,7 +531,7 @@ void VotedSensorsUpdate::accel_poll(struct sensor_combined_s &raw)
bool accel_updated; bool accel_updated;
orb_check(_accel.subscription[uorb_index], &accel_updated); orb_check(_accel.subscription[uorb_index], &accel_updated);
if (accel_updated && _accel.enabled[uorb_index]) { if (accel_updated) {
struct accel_report accel_report; struct accel_report accel_report;
orb_copy(ORB_ID(sensor_accel), _accel.subscription[uorb_index], &accel_report); orb_copy(ORB_ID(sensor_accel), _accel.subscription[uorb_index], &accel_report);
@@ -656,7 +638,7 @@ void VotedSensorsUpdate::gyro_poll(struct sensor_combined_s &raw)
bool gyro_updated; bool gyro_updated;
orb_check(_gyro.subscription[uorb_index], &gyro_updated); orb_check(_gyro.subscription[uorb_index], &gyro_updated);
if (gyro_updated && _gyro.enabled[uorb_index]) { if (gyro_updated) {
struct gyro_report gyro_report; struct gyro_report gyro_report;
orb_copy(ORB_ID(sensor_gyro), _gyro.subscription[uorb_index], &gyro_report); orb_copy(ORB_ID(sensor_gyro), _gyro.subscription[uorb_index], &gyro_report);
@@ -761,7 +743,7 @@ void VotedSensorsUpdate::mag_poll(struct sensor_combined_s &raw)
bool mag_updated; bool mag_updated;
orb_check(_mag.subscription[uorb_index], &mag_updated); orb_check(_mag.subscription[uorb_index], &mag_updated);
if (mag_updated && _mag.enabled[uorb_index]) { if (mag_updated) {
struct mag_report mag_report; struct mag_report mag_report;
orb_copy(ORB_ID(sensor_mag), _mag.subscription[uorb_index], &mag_report); orb_copy(ORB_ID(sensor_mag), _mag.subscription[uorb_index], &mag_report);
@@ -821,7 +803,7 @@ void VotedSensorsUpdate::baro_poll(struct sensor_combined_s &raw)
bool baro_updated; bool baro_updated;
orb_check(_baro.subscription[uorb_index], &baro_updated); orb_check(_baro.subscription[uorb_index], &baro_updated);
if (baro_updated && _baro.enabled[uorb_index]) { if (baro_updated) {
struct baro_report baro_report; struct baro_report baro_report;
orb_copy(ORB_ID(sensor_baro), _baro.subscription[uorb_index], &baro_report); orb_copy(ORB_ID(sensor_baro), _baro.subscription[uorb_index], &baro_report);
@@ -164,8 +164,6 @@ private:
} }
} }
bool enabled[SENSOR_COUNT_MAX];
int subscription[SENSOR_COUNT_MAX]; /**< raw sensor data subscription */ int subscription[SENSOR_COUNT_MAX]; /**< raw sensor data subscription */
uint8_t priority[SENSOR_COUNT_MAX]; /**< sensor priority */ uint8_t priority[SENSOR_COUNT_MAX]; /**< sensor priority */
uint8_t last_best_vote; /**< index of the latest best vote */ uint8_t last_best_vote; /**< index of the latest best vote */