diff options
author | Don Gagne <don@thegagnes.com> | 2015-04-25 12:37:43 -0700 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-04-26 14:34:19 +0200 |
commit | a7f88d97b819a73ce5b0e804df21f9c9dc1ebadd (patch) | |
tree | ae7ef4f23e1785df0cea536152af941ad6f783a6 /src/modules/sensors | |
parent | ecbff2885c6af9be03c97422fa62b4bc03a772ce (diff) | |
download | px4-firmware-a7f88d97b819a73ce5b0e804df21f9c9dc1ebadd.tar.gz px4-firmware-a7f88d97b819a73ce5b0e804df21f9c9dc1ebadd.tar.bz2 px4-firmware-a7f88d97b819a73ce5b0e804df21f9c9dc1ebadd.zip |
Sensor cal reworkSensorCal
- cancel support
- versioned cal messages
- better still detection
- better messaging
Diffstat (limited to 'src/modules/sensors')
-rw-r--r-- | src/modules/sensors/sensors.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/modules/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp index 07c3f2ab7..16e766646 100644 --- a/src/modules/sensors/sensors.cpp +++ b/src/modules/sensors/sensors.cpp @@ -145,7 +145,7 @@ #endif static const int ERROR = -1; -#define CAL_FAILED_APPLY_CAL_MSG "FAILED APPLYING %s CAL #%u" +#define CAL_ERROR_APPLY_CAL_MSG "FAILED APPLYING %s CAL #%u" /** * Sensor app start / stop handling function @@ -622,6 +622,16 @@ Sensors::Sensors() : /* Barometer QNH */ _parameter_handles.baro_qnh = param_find("SENS_BARO_QNH"); + // These are parameters for which QGroundControl always expects to be returned in a list request. + // We do a param_find here to force them into the list. + param_find("RC_CHAN_CNT"); + param_find("CAL_MAG0_ID"); + param_find("CAL_MAG1_ID"); + param_find("CAL_MAG2_ID"); + param_find("CAL_MAG0_ROT"); + param_find("CAL_MAG1_ROT"); + param_find("CAL_MAG2_ROT"); + /* fetch initial parameter values */ parameters_update(); } @@ -1384,12 +1394,12 @@ Sensors::parameter_update_poll(bool forced) failed = failed || (OK != param_get(param_find(str), &gscale.z_scale)); if (failed) { - warnx(CAL_FAILED_APPLY_CAL_MSG, "gyro", i); + warnx(CAL_ERROR_APPLY_CAL_MSG, "gyro", i); } else { /* apply new scaling and offsets */ res = ioctl(fd, GYROIOCSSCALE, (long unsigned int)&gscale); if (res) { - warnx(CAL_FAILED_APPLY_CAL_MSG, "gyro", i); + warnx(CAL_ERROR_APPLY_CAL_MSG, "gyro", i); } else { config_ok = true; } @@ -1450,12 +1460,12 @@ Sensors::parameter_update_poll(bool forced) failed = failed || (OK != param_get(param_find(str), &gscale.z_scale)); if (failed) { - warnx(CAL_FAILED_APPLY_CAL_MSG, "accel", i); + warnx(CAL_ERROR_APPLY_CAL_MSG, "accel", i); } else { /* apply new scaling and offsets */ res = ioctl(fd, ACCELIOCSSCALE, (long unsigned int)&gscale); if (res) { - warnx(CAL_FAILED_APPLY_CAL_MSG, "accel", i); + warnx(CAL_ERROR_APPLY_CAL_MSG, "accel", i); } else { config_ok = true; } @@ -1573,12 +1583,12 @@ Sensors::parameter_update_poll(bool forced) } if (failed) { - warnx(CAL_FAILED_APPLY_CAL_MSG, "mag", i); + warnx(CAL_ERROR_APPLY_CAL_MSG, "mag", i); } else { /* apply new scaling and offsets */ res = ioctl(fd, MAGIOCSSCALE, (long unsigned int)&gscale); if (res) { - warnx(CAL_FAILED_APPLY_CAL_MSG, "mag", i); + warnx(CAL_ERROR_APPLY_CAL_MSG, "mag", i); } else { config_ok = true; } |