Skip to content

Commit

Permalink
ModuleBase add common base type and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Aug 29, 2019
1 parent e8dcd8c commit ce71d52
Show file tree
Hide file tree
Showing 41 changed files with 546 additions and 349 deletions.
9 changes: 9 additions & 0 deletions .ci/Jenkinsfile-hardware
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ls /dev"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ls /obj"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "modules status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mtd status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param show"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param status"'
Expand Down Expand Up @@ -306,6 +307,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ls /proc"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status streams"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "modules status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mtd status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param show"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param status"'
Expand Down Expand Up @@ -373,6 +375,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ls /proc"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status streams"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "modules status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mtd status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param show"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param status"'
Expand Down Expand Up @@ -437,6 +440,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ls /proc"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status streams"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "modules status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mtd status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param show"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param status"'
Expand Down Expand Up @@ -504,6 +508,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ls /proc"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status streams"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "modules status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mtd status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param show"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param status"'
Expand Down Expand Up @@ -571,6 +576,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ls /proc"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status streams"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "modules status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mtd status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param show"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param status"'
Expand Down Expand Up @@ -644,6 +650,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ls /proc"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status streams"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "modules status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mtd status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param show"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param status"'
Expand Down Expand Up @@ -705,6 +712,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ls /obj"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status streams"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "modules status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mtd status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param show"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param status"'
Expand Down Expand Up @@ -776,6 +784,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "ls /proc"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mavlink status streams"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "modules status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "mtd status"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param show"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-FTDI_*` --cmd "param status"'
Expand Down
5 changes: 3 additions & 2 deletions boards/px4/fmu-v4/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ px4_add_board(
uavcan

MODULES
airspeed_selector
attitude_estimator_q
camera_feedback
commander
Expand All @@ -57,7 +58,6 @@ px4_add_board(
events
fw_att_control
fw_pos_control_l1
rover_pos_control
land_detector
landing_target_estimator
load_mon
Expand All @@ -67,11 +67,11 @@ px4_add_board(
mc_att_control
mc_pos_control
navigator
rover_pos_control
sensors
sih
vmount
vtol_att_control
airspeed_selector

SYSTEMCMDS
bl_update
Expand All @@ -82,6 +82,7 @@ px4_add_board(
i2cdetect
led_control
mixer
modules
motor_ramp
motor_test
mtd
Expand Down
5 changes: 3 additions & 2 deletions boards/px4/fmu-v4/stackcheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ px4_add_board(
#uavcan

MODULES
airspeed_selector
attitude_estimator_q
camera_feedback
commander
Expand All @@ -57,7 +58,6 @@ px4_add_board(
events
fw_att_control
fw_pos_control_l1
rover_pos_control
land_detector
landing_target_estimator
load_mon
Expand All @@ -67,11 +67,11 @@ px4_add_board(
mc_att_control
mc_pos_control
navigator
rover_pos_control
sensors
sih
vmount
vtol_att_control
airspeed_selector

SYSTEMCMDS
bl_update
Expand All @@ -82,6 +82,7 @@ px4_add_board(
i2cdetect
led_control
mixer
modules
motor_ramp
motor_test
mtd
Expand Down
5 changes: 3 additions & 2 deletions boards/px4/fmu-v5/critmonitor.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ px4_add_board(
uavcan

MODULES
airspeed_selector
attitude_estimator_q
camera_feedback
commander
Expand All @@ -71,7 +72,6 @@ px4_add_board(
events
fw_att_control
fw_pos_control_l1
rover_pos_control
land_detector
landing_target_estimator
load_mon
Expand All @@ -81,11 +81,11 @@ px4_add_board(
mc_att_control
mc_pos_control
navigator
rover_pos_control
sensors
sih
vmount
vtol_att_control
airspeed_selector

SYSTEMCMDS
bl_update
Expand All @@ -97,6 +97,7 @@ px4_add_board(
i2cdetect
led_control
mixer
modules
motor_ramp
motor_test
mtd
Expand Down
5 changes: 3 additions & 2 deletions boards/px4/fmu-v5/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ px4_add_board(
uavcan

MODULES
airspeed_selector
attitude_estimator_q
camera_feedback
commander
Expand All @@ -71,7 +72,6 @@ px4_add_board(
events
fw_att_control
fw_pos_control_l1
rover_pos_control
land_detector
landing_target_estimator
load_mon
Expand All @@ -81,11 +81,11 @@ px4_add_board(
mc_att_control
mc_pos_control
navigator
rover_pos_control
sensors
sih
vmount
vtol_att_control
airspeed_selector

SYSTEMCMDS
bl_update
Expand All @@ -97,6 +97,7 @@ px4_add_board(
i2cdetect
led_control
mixer
modules
motor_ramp
motor_test
mtd
Expand Down
5 changes: 3 additions & 2 deletions boards/px4/fmu-v5/irqmonitor.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ px4_add_board(
uavcan

MODULES
airspeed_selector
attitude_estimator_q
camera_feedback
commander
Expand All @@ -71,7 +72,6 @@ px4_add_board(
events
fw_att_control
fw_pos_control_l1
rover_pos_control
land_detector
landing_target_estimator
load_mon
Expand All @@ -81,11 +81,11 @@ px4_add_board(
mc_att_control
mc_pos_control
navigator
rover_pos_control
sensors
sih
vmount
vtol_att_control
airspeed_selector

SYSTEMCMDS
bl_update
Expand All @@ -97,6 +97,7 @@ px4_add_board(
i2cdetect
led_control
mixer
modules
motor_ramp
motor_test
mtd
Expand Down
1 change: 1 addition & 0 deletions boards/px4/sitl/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ px4_add_board(
#hardfault_log
led_control
mixer
modules
motor_ramp
#mtd
#nshterm
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/batt_smbus/batt_smbus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ int BATT_SMBUS::task_spawn(int argc, char *argv[])
BATT_SMBUS *dev = new BATT_SMBUS(interface, bus_options[i].devpath);

// Successful read of device type, we've found our battery
_object.store(dev);
_task_id = task_id_is_work_queue;
dev->set_task_id(task_id_is_work_queue);

int result = dev->get_startup_info();

Expand Down
3 changes: 0 additions & 3 deletions src/drivers/distance_sensor/pga460/pga460.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,12 +755,9 @@ int PGA460::task_spawn(int argc, char *argv[])
entry_point, (char *const *)argv);

if (task_id < 0) {
task_id = -1;
return -errno;
}

_task_id = task_id;

return PX4_OK;
}

Expand Down
4 changes: 0 additions & 4 deletions src/drivers/gps/gps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1076,10 +1076,6 @@ int GPS::task_spawn(int argc, char *argv[], Instance instance)
return -errno;
}

if (instance == Instance::Main) {
_task_id = task_id;
}

return 0;
}

Expand Down
3 changes: 1 addition & 2 deletions src/drivers/heater/heater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ int Heater::task_spawn(int argc, char *argv[])
return PX4_ERROR;
}

_object.store(heater);
_task_id = task_id_is_work_queue;
heater->set_task_id(task_id_is_work_queue);

heater->start();

Expand Down
3 changes: 1 addition & 2 deletions src/drivers/osd/atxxxx/atxxxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ OSDatxxxx::task_spawn(int argc, char *argv[])
return PX4_ERROR;
}

_object.store(osd);
_task_id = task_id_is_work_queue;
osd->set_task_id(task_id_is_work_queue);

osd->start();

Expand Down
3 changes: 2 additions & 1 deletion src/drivers/osd/atxxxx/atxxxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@

extern "C" __EXPORT int atxxxx_main(int argc, char *argv[]);

class OSDatxxxx : public device::SPI, public ModuleBase<OSDatxxxx>, public ModuleParams, public px4::ScheduledWorkItem
class OSDatxxxx : public device::SPI, public ModuleBase<OSDatxxxx>, public ModuleParams,
public px4::ScheduledWorkItem
{
public:
OSDatxxxx(int bus = OSD_BUS);
Expand Down
18 changes: 8 additions & 10 deletions src/drivers/pwm_out_sim/PWMSim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,21 +562,19 @@ PWMSim::ioctl(device::file_t *filp, int cmd, unsigned long arg)
int
PWMSim::task_spawn(int argc, char *argv[])
{
_task_id = px4_task_spawn_cmd("pwm_out_sim",
SCHED_DEFAULT,
SCHED_PRIORITY_ACTUATOR_OUTPUTS,
1100,
(px4_main_t)&run_trampoline,
nullptr);

if (_task_id < 0) {
_task_id = -1;
int task_id = px4_task_spawn_cmd("pwm_out_sim",
SCHED_DEFAULT,
SCHED_PRIORITY_ACTUATOR_OUTPUTS,
1100,
(px4_main_t)&run_trampoline,
nullptr);

if (task_id < 0) {
return -errno;
}

// wait until task is up & running (the mode_* commands depend on it)
if (wait_until_running() < 0) {
_task_id = -1;
return -1;
}

Expand Down
5 changes: 1 addition & 4 deletions src/drivers/px4fmu/fmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,7 @@ PX4FMU::task_spawn(int argc, char *argv[])
PX4FMU *instance = new PX4FMU();

if (instance) {
_object.store(instance);
_task_id = task_id_is_work_queue;
instance->set_task_id(task_id_is_work_queue);

if (instance->init() == PX4_OK) {
return PX4_OK;
Expand All @@ -797,8 +796,6 @@ PX4FMU::task_spawn(int argc, char *argv[])
}

delete instance;
_object.store(nullptr);
_task_id = -1;

return PX4_ERROR;
}
Expand Down
Loading

0 comments on commit ce71d52

Please sign in to comment.