mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 03:20:35 +08:00
Store primary sensor ID to allow cross-check of calibration on next boot
This commit is contained in:
@@ -173,6 +173,8 @@ int do_accel_calibration(int mavlink_fd)
|
||||
{
|
||||
int fd;
|
||||
int32_t device_id[max_accel_sens];
|
||||
int device_prio_max = 0;
|
||||
int32_t device_id_primary = 0;
|
||||
|
||||
mavlink_and_console_log_info(mavlink_fd, CAL_QGC_STARTED_MSG, sensor_name);
|
||||
|
||||
@@ -259,6 +261,8 @@ int do_accel_calibration(int mavlink_fd)
|
||||
|
||||
bool failed = false;
|
||||
|
||||
failed = failed || (OK != param_set_no_notification("CAL_ACC_PRIME", &(device_id_primary)));
|
||||
|
||||
/* set parameters */
|
||||
(void)sprintf(str, "CAL_ACC%u_XOFF", i);
|
||||
failed |= (OK != param_set_no_notification(param_find(str), &(accel_scale.x_offset)));
|
||||
@@ -370,6 +374,14 @@ calibrate_return do_accel_calibration_measurements(int mavlink_fd, float (&accel
|
||||
struct accel_report arp = {};
|
||||
(void)orb_copy(ORB_ID(sensor_accel), worker_data.subs[i], &arp);
|
||||
timestamps[i] = arp.timestamp;
|
||||
|
||||
// Get priority
|
||||
int32_t prio = orb_priority(work_data.subs[i]);
|
||||
|
||||
if (prio > device_prio_max) {
|
||||
device_prio_max = prio;
|
||||
device_id_primary = device_id[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (result == calibrate_return_ok) {
|
||||
|
||||
Reference in New Issue
Block a user