mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 04:43:33 +08:00
delete drv_mixer.h
This commit is contained in:
@@ -41,7 +41,6 @@ char DShot::_telemetry_device[] {};
|
||||
px4::atomic_bool DShot::_request_telemetry_init{false};
|
||||
|
||||
DShot::DShot() :
|
||||
CDev("/dev/dshot"),
|
||||
OutputModuleInterface(MODULE_NAME, px4::wq_configurations::hp_default)
|
||||
{
|
||||
_mixing_output.setAllDisarmedValues(DSHOT_DISARM_VALUE);
|
||||
@@ -59,32 +58,13 @@ DShot::~DShot()
|
||||
// make sure outputs are off
|
||||
up_dshot_arm(false);
|
||||
|
||||
// clean up the alternate device node
|
||||
unregister_class_devname(PWM_OUTPUT_BASE_DEVICE_PATH, _class_instance);
|
||||
|
||||
perf_free(_cycle_perf);
|
||||
delete _telemetry;
|
||||
}
|
||||
|
||||
int DShot::init()
|
||||
{
|
||||
// do regular cdev init
|
||||
int ret = CDev::init();
|
||||
|
||||
if (ret != OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// try to claim the generic PWM output device node as well - it's OK if we fail at this
|
||||
_class_instance = register_class_devname(PWM_OUTPUT_BASE_DEVICE_PATH);
|
||||
|
||||
if (_class_instance == CLASS_DEVICE_PRIMARY) {
|
||||
// lets not be too verbose
|
||||
} else if (_class_instance < 0) {
|
||||
PX4_ERR("FAILED registering class device");
|
||||
}
|
||||
|
||||
_mixing_output.setDriverInstance(_class_instance);
|
||||
_mixing_output.setDriverInstance(0);
|
||||
|
||||
_output_mask = (1u << _num_outputs) - 1;
|
||||
|
||||
@@ -486,8 +466,6 @@ void DShot::Run()
|
||||
return;
|
||||
}
|
||||
|
||||
SmartLock lock_guard(_lock);
|
||||
|
||||
perf_begin(_cycle_perf);
|
||||
|
||||
_mixing_output.update();
|
||||
@@ -645,40 +623,6 @@ void DShot::update_params()
|
||||
}
|
||||
}
|
||||
|
||||
int DShot::ioctl(file *filp, int cmd, unsigned long arg)
|
||||
{
|
||||
SmartLock lock_guard(_lock);
|
||||
|
||||
int ret = OK;
|
||||
|
||||
PX4_DEBUG("dshot ioctl cmd: %d, arg: %ld", cmd, arg);
|
||||
|
||||
switch (cmd) {
|
||||
case MIXERIOCRESET:
|
||||
_mixing_output.resetMixer();
|
||||
break;
|
||||
|
||||
case MIXERIOCLOADBUF: {
|
||||
const char *buf = (const char *)arg;
|
||||
unsigned buflen = strlen(buf);
|
||||
ret = _mixing_output.loadMixer(buf, buflen);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
|
||||
// if nobody wants it, let CDev have it
|
||||
if (ret == -ENOTTY) {
|
||||
ret = CDev::ioctl(filp, cmd, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int DShot::custom_command(int argc, char *argv[])
|
||||
{
|
||||
const char *verb = argv[0];
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#include <drivers/device/device.h>
|
||||
#include <drivers/drv_input_capture.h>
|
||||
#include <drivers/drv_mixer.h>
|
||||
#include <lib/mixer_module/mixer_module.hpp>
|
||||
#include <px4_platform_common/getopt.h>
|
||||
#include <px4_platform_common/module.h>
|
||||
@@ -60,7 +59,7 @@ static constexpr int DSHOT_DISARM_VALUE = 0;
|
||||
static constexpr int DSHOT_MIN_THROTTLE = 1;
|
||||
static constexpr int DSHOT_MAX_THROTTLE = 1999;
|
||||
|
||||
class DShot : public cdev::CDev, public ModuleBase<DShot>, public OutputModuleInterface
|
||||
class DShot : public ModuleBase<DShot>, public OutputModuleInterface
|
||||
{
|
||||
public:
|
||||
DShot();
|
||||
@@ -71,8 +70,6 @@ public:
|
||||
|
||||
virtual int init();
|
||||
|
||||
virtual int ioctl(file *filp, int cmd, unsigned long arg);
|
||||
|
||||
void mixerChanged() override;
|
||||
|
||||
/** @see ModuleBase::print_status() */
|
||||
@@ -166,8 +163,6 @@ private:
|
||||
static constexpr unsigned _num_outputs{DIRECT_PWM_OUTPUT_CHANNELS};
|
||||
uint32_t _output_mask{0};
|
||||
|
||||
int _class_instance{-1};
|
||||
|
||||
perf_counter_t _cycle_perf{perf_alloc(PC_ELAPSED, MODULE_NAME": cycle")};
|
||||
|
||||
Command _current_command{};
|
||||
|
||||
Reference in New Issue
Block a user