px4fmu cleanup unnecessary Device CDev usage

This commit is contained in:
Daniel Agar
2018-08-18 15:10:22 -04:00
parent 7d57ce65dc
commit 01595947e5

View File

@@ -52,6 +52,7 @@
#include <px4_log.h>
#include <px4_module.h>
#include <circuit_breaker/circuit_breaker.h>
#include <lib/cdev/CDev.hpp>
#include <lib/mixer/mixer.h>
#include <parameters/param.h>
#include <perf/perf_counter.h>
@@ -96,7 +97,7 @@ enum PortMode {
# error "board_config.h needs to define BOARD_HAS_PWM"
#endif
class PX4FMU : public device::CDev, public ModuleBase<PX4FMU>
class PX4FMU : public cdev::CDev, public ModuleBase<PX4FMU>
{
public:
enum Mode {
@@ -297,7 +298,7 @@ actuator_armed_s PX4FMU::_armed = {};
work_s PX4FMU::_work = {};
PX4FMU::PX4FMU(bool run_as_task) :
CDev("fmu", PX4FMU_DEVICE_PATH),
CDev(PX4FMU_DEVICE_PATH),
_mode(MODE_NONE),
_pwm_default_rate(50),
_pwm_alt_rate(50),
@@ -364,9 +365,6 @@ PX4FMU::PX4FMU(bool run_as_task) :
_safety_off = true;
_safety_btn_off = true;
#endif
/* only enable this during development */
_debug_enabled = false;
}
PX4FMU::~PX4FMU()
@@ -561,13 +559,13 @@ PX4FMU::set_mode(Mode mode)
case MODE_2PWM2CAP: // v1 multi-port with flow control lines as PWM
up_input_capture_set(2, Rising, 0, NULL, NULL);
up_input_capture_set(3, Rising, 0, NULL, NULL);
DEVICE_DEBUG("MODE_2PWM2CAP");
PX4_DEBUG("MODE_2PWM2CAP");
#endif
/* FALLTHROUGH */
case MODE_2PWM: // v1 multi-port with flow control lines as PWM
DEVICE_DEBUG("MODE_2PWM");
PX4_DEBUG("MODE_2PWM");
/* default output rates */
_pwm_default_rate = 50;
@@ -582,14 +580,14 @@ PX4FMU::set_mode(Mode mode)
#if defined(BOARD_HAS_CAPTURE)
case MODE_3PWM1CAP: // v1 multi-port with flow control lines as PWM
DEVICE_DEBUG("MODE_3PWM1CAP");
PX4_DEBUG("MODE_3PWM1CAP");
up_input_capture_set(3, Rising, 0, NULL, NULL);
#endif
/* FALLTHROUGH */
case MODE_3PWM: // v1 multi-port with flow control lines as PWM
DEVICE_DEBUG("MODE_3PWM");
PX4_DEBUG("MODE_3PWM");
/* default output rates */
_pwm_default_rate = 50;
@@ -602,7 +600,7 @@ PX4FMU::set_mode(Mode mode)
break;
case MODE_4PWM: // v1 or v2 multi-port as 4 PWM outs
DEVICE_DEBUG("MODE_4PWM");
PX4_DEBUG("MODE_4PWM");
/* default output rates */
_pwm_default_rate = 50;
@@ -617,7 +615,7 @@ PX4FMU::set_mode(Mode mode)
#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 6
case MODE_6PWM:
DEVICE_DEBUG("MODE_6PWM");
PX4_DEBUG("MODE_6PWM");
/* default output rates */
_pwm_default_rate = 50;
@@ -633,7 +631,7 @@ PX4FMU::set_mode(Mode mode)
#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 8
case MODE_8PWM: // AeroCore PWMs as 8 PWM outs
DEVICE_DEBUG("MODE_8PWM");
PX4_DEBUG("MODE_8PWM");
/* default output rates */
_pwm_default_rate = 50;
_pwm_alt_rate = 50;
@@ -648,7 +646,7 @@ PX4FMU::set_mode(Mode mode)
#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 14
case MODE_14PWM:
DEVICE_DEBUG("MODE_14PWM");
PX4_DEBUG("MODE_14PWM");
/* default output rates */
_pwm_default_rate = 50;
_pwm_alt_rate = 50;
@@ -661,7 +659,7 @@ PX4FMU::set_mode(Mode mode)
#endif
case MODE_NONE:
DEVICE_DEBUG("MODE_NONE");
PX4_DEBUG("MODE_NONE");
_pwm_default_rate = 10; /* artificially reduced output rate */
_pwm_alt_rate = 10;
@@ -805,12 +803,12 @@ PX4FMU::subscribe()
for (unsigned i = 0; i < actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS; i++) {
if (sub_groups & (1 << i)) {
DEVICE_DEBUG("subscribe to actuator_controls_%d", i);
PX4_DEBUG("subscribe to actuator_controls_%d", i);
_control_subs[i] = orb_subscribe(_control_topics[i]);
}
if (unsub_groups & (1 << i)) {
DEVICE_DEBUG("unsubscribe from actuator_controls_%d", i);
PX4_DEBUG("unsubscribe from actuator_controls_%d", i);
orb_unsubscribe(_control_subs[i]);
_control_subs[i] = -1;
}
@@ -1092,7 +1090,7 @@ PX4FMU::cycle()
/* this would be bad... */
if (ret < 0) {
DEVICE_LOG("poll error %d", errno);
PX4_DEBUG("poll error %d", errno);
} else if (ret == 0) {
/* timeout: no control data, switch to failsafe values */