mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 14:23:34 +08:00
DriverFramework purge
The bulk of this change was tightly coupled and needed to be deleted in one pass. Some of the smaller changes were things that broke as a result of the initial purge and subsequently fixed by further eradicating unnecessary platform differences. Finally, I deleted any dead code I came across in the related files I touched while going through everything.
- DriverFramework (src/lib/DriverFramework submodule) completely removed
- added dspal submodule in qurt platform (was brought in via DriverFramework)
- all df wrapper drivers removed
- all boards using df wrapper drivers updated to use in tree equivalents
- unused empty arch/board.h on posix and qurt removed
- unused IOCTLs removed (pub block, priv, etc)
- Integrator delete methods only used from df wrapper drivers
- commander: sensor calibration use "NuttX version" everywhere for now
- sensors: update to px4_{open, read, close} instead of DevMgr wrapper (adc open for analog differential pressure)
- battery_status: update to px4_{open, read, close} instead of DevMgr wrapper (adc open for analog differential pressure)
- cdev cleanup conflicting typedefs and names with actual OS (pollevent_t, etc)
- load_mon and top remove from linux boards (unused)
- delete unused PX4_MAIN_FUNCTION
- delete unused getreg32 macro
- delete unused SIOCDEVPRIVATE define
- named each platform tasks consistently
- posix list_devices and list_topics removed (list_files now shows all virtual files)
This commit is contained in:
@@ -52,7 +52,6 @@ px4_add_module(
|
||||
state_machine_helper.cpp
|
||||
DEPENDS
|
||||
circuit_breaker
|
||||
df_driver_framework
|
||||
failure_detector
|
||||
git_ecl
|
||||
ecl_geo
|
||||
|
||||
@@ -132,10 +132,8 @@
|
||||
#include <px4_platform_common/time.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <poll.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <poll.h>
|
||||
#include <float.h>
|
||||
#include <mathlib/mathlib.h>
|
||||
#include <string.h>
|
||||
@@ -180,7 +178,7 @@ typedef struct {
|
||||
|
||||
int do_accel_calibration(orb_advert_t *mavlink_log_pub)
|
||||
{
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
int fd;
|
||||
#endif
|
||||
|
||||
@@ -200,7 +198,7 @@ int do_accel_calibration(orb_advert_t *mavlink_log_pub)
|
||||
|
||||
/* reset all sensors */
|
||||
for (unsigned s = 0; s < max_accel_sens; s++) {
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
sprintf(str, "%s%u", ACCEL_BASE_DEVICE_PATH, s);
|
||||
/* reset all offsets to zero and all scales to one */
|
||||
fd = px4_open(str, 0);
|
||||
@@ -422,7 +420,7 @@ int do_accel_calibration(orb_advert_t *mavlink_log_pub)
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
sprintf(str, "%s%u", ACCEL_BASE_DEVICE_PATH, uorb_index);
|
||||
fd = px4_open(str, 0);
|
||||
|
||||
@@ -525,7 +523,7 @@ calibrate_return do_accel_calibration_measurements(orb_advert_t *mavlink_log_pub
|
||||
sensor_accel_s report = {};
|
||||
orb_copy(ORB_ID(sensor_accel), worker_data.subs[cur_accel], &report);
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
|
||||
// For NuttX, we get the UNIQUE device ID from the sensor driver via an IOCTL
|
||||
// and match it up with the one from the uORB subscription, because the
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <math.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <drivers/drv_airspeed.h>
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
|
||||
#include "baro_calibration.h"
|
||||
|
||||
#include <poll.h>
|
||||
#include <math.h>
|
||||
#include <fcntl.h>
|
||||
#include <px4_platform_common/defines.h>
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <poll.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <systemlib/mavlink_log.h>
|
||||
#include <lib/ecl/geo/geo.h>
|
||||
|
||||
@@ -57,35 +57,8 @@ using namespace time_literals;
|
||||
int do_esc_calibration(orb_advert_t *mavlink_log_pub, struct actuator_armed_s *armed)
|
||||
{
|
||||
int return_code = PX4_OK;
|
||||
|
||||
#if defined(__PX4_POSIX_OCPOC) || defined(__PX4_POSIX_BBBLUE)
|
||||
hrt_abstime timeout_start = 0;
|
||||
hrt_abstime timeout_wait = 60_s;
|
||||
armed->in_esc_calibration_mode = true;
|
||||
calibration_log_info(mavlink_log_pub, CAL_QGC_DONE_MSG, "begin esc");
|
||||
timeout_start = hrt_absolute_time();
|
||||
|
||||
while (true) {
|
||||
if (hrt_absolute_time() - timeout_start > timeout_wait) {
|
||||
break;
|
||||
|
||||
} else {
|
||||
px4_usleep(50000);
|
||||
}
|
||||
}
|
||||
|
||||
armed->in_esc_calibration_mode = false;
|
||||
calibration_log_info(mavlink_log_pub, CAL_QGC_DONE_MSG, "end esc");
|
||||
|
||||
if (return_code == OK) {
|
||||
calibration_log_info(mavlink_log_pub, CAL_QGC_DONE_MSG, "esc");
|
||||
}
|
||||
|
||||
return return_code;
|
||||
|
||||
#else
|
||||
int fd = -1;
|
||||
bool batt_connected = true; // for safety resons assume battery is connected, will be cleared below if not the case
|
||||
bool batt_connected = true; // for safety reasons assume battery is connected, will be cleared below if not the case
|
||||
hrt_abstime timeout_start = 0;
|
||||
|
||||
calibration_log_info(mavlink_log_pub, CAL_QGC_STARTED_MSG, "esc");
|
||||
@@ -207,5 +180,4 @@ Out:
|
||||
}
|
||||
|
||||
return return_code;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <math.h>
|
||||
#include <mathlib/mathlib.h>
|
||||
#include <string.h>
|
||||
@@ -240,7 +239,7 @@ int do_gyro_calibration(orb_advert_t *mavlink_log_pub)
|
||||
|
||||
// Reset all offsets to 0
|
||||
(void)memcpy(&worker_data.gyro_scale[s], &gyro_scale_zero, sizeof(gyro_scale_zero));
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
sprintf(str, "%s%u", GYRO_BASE_DEVICE_PATH, s);
|
||||
int fd = px4_open(str, 0);
|
||||
|
||||
@@ -301,7 +300,7 @@ int do_gyro_calibration(orb_advert_t *mavlink_log_pub)
|
||||
sensor_gyro_s report{};
|
||||
orb_copy(ORB_ID(sensor_gyro), worker_data.gyro_sensor_sub[cur_gyro], &report);
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
|
||||
// For NuttX, we get the UNIQUE device ID from the sensor driver via an IOCTL
|
||||
// and match it up with the one from the uORB subscription, because the
|
||||
@@ -473,7 +472,7 @@ int do_gyro_calibration(orb_advert_t *mavlink_log_pub)
|
||||
(void)sprintf(str, "CAL_GYRO%u_ID", uorb_index);
|
||||
failed |= (PX4_OK != param_set_no_notification(param_find(str), &(worker_data.device_id[uorb_index])));
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
/* apply new scaling and offsets */
|
||||
(void)sprintf(str, "%s%u", GYRO_BASE_DEVICE_PATH, uorb_index);
|
||||
int fd = px4_open(str, 0);
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <poll.h>
|
||||
#include <math.h>
|
||||
#include <fcntl.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
@@ -153,7 +152,7 @@ int do_mag_calibration(orb_advert_t *mavlink_log_pub)
|
||||
(void)append_to_existing_calibration;
|
||||
|
||||
for (unsigned cur_mag = 0; cur_mag < max_mags; cur_mag++) {
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
// Reset mag id to mag not available
|
||||
(void)sprintf(str, "CAL_MAG%u_ID", cur_mag);
|
||||
result = param_set_no_notification(param_find(str), &(device_ids[cur_mag]));
|
||||
@@ -210,7 +209,7 @@ int do_mag_calibration(orb_advert_t *mavlink_log_pub)
|
||||
|
||||
param_notify_changes();
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
// Attempt to open mag
|
||||
(void)sprintf(str, "%s%u", MAG_BASE_DEVICE_PATH, cur_mag);
|
||||
int fd = px4_open(str, O_RDONLY);
|
||||
@@ -609,7 +608,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
|
||||
sensor_mag_s report{};
|
||||
orb_copy(ORB_ID(sensor_mag), worker_data.sub_mag[cur_mag], &report);
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
|
||||
// For NuttX, we get the UNIQUE device ID from the sensor driver via an IOCTL
|
||||
// and match it up with the one from the uORB subscription, because the
|
||||
@@ -804,7 +803,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
|
||||
if (device_ids[cur_mag] != 0) {
|
||||
mag_calibration_s mscale;
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
int fd_mag = -1;
|
||||
|
||||
(void)sprintf(str, "%s%u", MAG_BASE_DEVICE_PATH, cur_mag);
|
||||
@@ -819,7 +818,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
|
||||
|
||||
if (result == calibrate_return_ok) {
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
|
||||
// Read existing calibration
|
||||
if (px4_ioctl(fd_mag, MAGIOCGSCALE, (long unsigned int)&mscale) != PX4_OK) {
|
||||
@@ -852,7 +851,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#if 1 // TODO: replace all IOCTL usage
|
||||
|
||||
// Mag device no longer needed
|
||||
if (fd_mag >= 0) {
|
||||
@@ -875,15 +874,12 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
|
||||
(void)sprintf(str, "CAL_MAG%u_ZOFF", cur_mag);
|
||||
failed |= (PX4_OK != param_set_no_notification(param_find(str), &(mscale.z_offset)));
|
||||
|
||||
// FIXME: scaling is not used right now on QURT
|
||||
#ifndef __PX4_QURT
|
||||
(void)sprintf(str, "CAL_MAG%u_XSCALE", cur_mag);
|
||||
failed |= (PX4_OK != param_set_no_notification(param_find(str), &(mscale.x_scale)));
|
||||
(void)sprintf(str, "CAL_MAG%u_YSCALE", cur_mag);
|
||||
failed |= (PX4_OK != param_set_no_notification(param_find(str), &(mscale.y_scale)));
|
||||
(void)sprintf(str, "CAL_MAG%u_ZSCALE", cur_mag);
|
||||
failed |= (PX4_OK != param_set_no_notification(param_find(str), &(mscale.z_scale)));
|
||||
#endif
|
||||
|
||||
if (failed) {
|
||||
calibration_log_critical(mavlink_log_pub, CAL_ERROR_SET_PARAMS_MSG);
|
||||
@@ -892,10 +888,10 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
|
||||
} else {
|
||||
calibration_log_info(mavlink_log_pub, "[cal] mag #%u off: x:%.2f y:%.2f z:%.2f Ga",
|
||||
cur_mag, (double)mscale.x_offset, (double)mscale.y_offset, (double)mscale.z_offset);
|
||||
#ifndef __PX4_QURT
|
||||
|
||||
calibration_log_info(mavlink_log_pub, "[cal] mag #%u scale: x:%.2f y:%.2f z:%.2f",
|
||||
cur_mag, (double)mscale.x_scale, (double)mscale.y_scale, (double)mscale.z_scale);
|
||||
#endif
|
||||
|
||||
px4_usleep(200000);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user