mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
px4_main_t: fix method declaration throughout the code base
px4_main_t is defined as: typedef int (*px4_main_t)(int argc, char *argv[]); which matches with the definition in NuttX, given to task_create
This commit is contained in:
parent
9772380779
commit
13ab5ed0d0
@ -122,7 +122,7 @@ private:
|
||||
unsigned _tail;
|
||||
uint8_t _buf[BUF_LEN];
|
||||
|
||||
static void task_main_trampoline(int argc, char *argv[]);
|
||||
static int task_main_trampoline(int argc, char *argv[]);
|
||||
void task_main();
|
||||
|
||||
bool read_and_parse(uint8_t *buf, int len, float *range);
|
||||
@ -299,10 +299,11 @@ Radar::init()
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
Radar::task_main_trampoline(int argc, char *argv[])
|
||||
{
|
||||
radar::g_dev->task_main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@ -134,7 +134,7 @@ public:
|
||||
/**
|
||||
* task spawn trampoline for the secondary GPS
|
||||
*/
|
||||
static void run_trampoline_secondary(int argc, char *argv[]);
|
||||
static int run_trampoline_secondary(int argc, char *argv[]);
|
||||
|
||||
/** @see ModuleBase::run() */
|
||||
void run() override;
|
||||
@ -997,7 +997,7 @@ int GPS::task_spawn(int argc, char *argv[], Instance instance)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GPS::run_trampoline_secondary(int argc, char *argv[])
|
||||
int GPS::run_trampoline_secondary(int argc, char *argv[])
|
||||
{
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
@ -1014,6 +1014,7 @@ void GPS::run_trampoline_secondary(int argc, char *argv[])
|
||||
_secondary_instance = nullptr;
|
||||
delete gps;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
GPS *GPS::instantiate(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@ -158,7 +158,7 @@ private:
|
||||
/**
|
||||
* Shim for calling task_main from task_create.
|
||||
*/
|
||||
static void task_main_trampoline(int argc, char *argv[]);
|
||||
static int task_main_trampoline(int argc, char *argv[]);
|
||||
};
|
||||
|
||||
namespace bottle_drop
|
||||
@ -868,10 +868,11 @@ BottleDrop::answer_command(struct vehicle_command_s *cmd, unsigned result)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
BottleDrop::task_main_trampoline(int argc, char *argv[])
|
||||
{
|
||||
bottle_drop::g_bottle_drop->task_main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void usage()
|
||||
|
||||
@ -91,7 +91,7 @@ public:
|
||||
*/
|
||||
int start();
|
||||
|
||||
static void task_main_trampoline(int argc, char *argv[]);
|
||||
static int task_main_trampoline(int argc, char *argv[]);
|
||||
|
||||
void task_main();
|
||||
|
||||
@ -243,9 +243,10 @@ int AttitudeEstimatorQ::start()
|
||||
return OK;
|
||||
}
|
||||
|
||||
void AttitudeEstimatorQ::task_main_trampoline(int argc, char *argv[])
|
||||
int AttitudeEstimatorQ::task_main_trampoline(int argc, char *argv[])
|
||||
{
|
||||
attitude_estimator_q::instance->task_main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AttitudeEstimatorQ::task_main()
|
||||
|
||||
@ -83,7 +83,7 @@ public:
|
||||
*/
|
||||
int start();
|
||||
|
||||
static void do_temperature_calibration(int argc, char *argv[]);
|
||||
static int do_temperature_calibration(int argc, char *argv[]);
|
||||
|
||||
void task_main();
|
||||
|
||||
@ -320,9 +320,10 @@ void TemperatureCalibration::task_main()
|
||||
PX4_INFO("Exiting temperature calibration task");
|
||||
}
|
||||
|
||||
void TemperatureCalibration::do_temperature_calibration(int argc, char *argv[])
|
||||
int TemperatureCalibration::do_temperature_calibration(int argc, char *argv[])
|
||||
{
|
||||
temperature_calibration::instance->task_main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TemperatureCalibration::start()
|
||||
|
||||
@ -174,10 +174,11 @@ GroundRoverAttitudeControl::battery_status_poll()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
GroundRoverAttitudeControl::task_main_trampoline(int argc, char *argv[])
|
||||
{
|
||||
att_gnd_control::g_control->task_main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@ -136,7 +136,7 @@ private:
|
||||
void vehicle_attitude_setpoint_poll();
|
||||
void battery_status_poll();
|
||||
|
||||
static void task_main_trampoline(int argc, char *argv[]);
|
||||
static int task_main_trampoline(int argc, char *argv[]);
|
||||
void task_main();
|
||||
|
||||
};
|
||||
|
||||
@ -479,27 +479,27 @@ GroundRoverPositionControl::task_main()
|
||||
_control_task = -1;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
GroundRoverPositionControl::task_main_trampoline(int argc, char *argv[])
|
||||
{
|
||||
gnd_control::g_control = new GroundRoverPositionControl();
|
||||
|
||||
if (gnd_control::g_control == nullptr) {
|
||||
warnx("OUT OF MEM");
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* only returns on exit */
|
||||
gnd_control::g_control->task_main();
|
||||
delete gnd_control::g_control;
|
||||
gnd_control::g_control = nullptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
GroundRoverPositionControl::start()
|
||||
{
|
||||
ASSERT(_control_task == -1);
|
||||
warn("Starting by marco");
|
||||
|
||||
/* start the task */
|
||||
_control_task = px4_task_spawn_cmd("gnd_pos_ctrl",
|
||||
@ -508,7 +508,6 @@ GroundRoverPositionControl::start()
|
||||
1700,
|
||||
(px4_main_t)&GroundRoverPositionControl::task_main_trampoline,
|
||||
nullptr);
|
||||
warn("done");
|
||||
|
||||
if (_control_task < 0) {
|
||||
warn("task start failed");
|
||||
|
||||
@ -202,7 +202,7 @@ private:
|
||||
/**
|
||||
* Shim for calling task_main from task_create.
|
||||
*/
|
||||
static void task_main_trampoline(int argc, char *argv[]);
|
||||
static int task_main_trampoline(int argc, char *argv[]);
|
||||
|
||||
/**
|
||||
* Main sensor collection task.
|
||||
|
||||
@ -412,7 +412,7 @@ private:
|
||||
/**
|
||||
* Shim for calling task_main from task_create.
|
||||
*/
|
||||
static void task_main_trampoline(int argc, char *argv[]);
|
||||
static int task_main_trampoline(int argc, char *argv[]);
|
||||
|
||||
/**
|
||||
* Main sensor collection task.
|
||||
@ -768,10 +768,11 @@ MulticopterPositionControl::throttle_curve(float ctl, float ctr)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
MulticopterPositionControl::task_main_trampoline(int argc, char *argv[])
|
||||
{
|
||||
pos_control::g_control->task_main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@ -136,7 +136,7 @@ private:
|
||||
/**
|
||||
* Trampoline to the worker task
|
||||
*/
|
||||
static void task_main_trampoline(void *arg);
|
||||
static int task_main_trampoline(int argc, char *argv[]);
|
||||
|
||||
|
||||
/**
|
||||
@ -273,10 +273,11 @@ GPSSIM::devIOCTL(unsigned long cmd, unsigned long arg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
GPSSIM::task_main_trampoline(void *arg)
|
||||
int
|
||||
GPSSIM::task_main_trampoline(int argc, char *argv[])
|
||||
{
|
||||
g_dev->task_main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@ -401,7 +401,7 @@ int uORBTest::UnitTest::test_multi()
|
||||
|
||||
|
||||
|
||||
int uORBTest::UnitTest::pub_test_multi2_entry(char *const argv[])
|
||||
int uORBTest::UnitTest::pub_test_multi2_entry(int argc, char *argv[])
|
||||
{
|
||||
uORBTest::UnitTest &t = uORBTest::UnitTest::instance();
|
||||
return t.pub_test_multi2_main();
|
||||
@ -707,7 +707,7 @@ int uORBTest::UnitTest::test_queue()
|
||||
}
|
||||
|
||||
|
||||
int uORBTest::UnitTest::pub_test_queue_entry(char *const argv[])
|
||||
int uORBTest::UnitTest::pub_test_queue_entry(int argc, char *argv[])
|
||||
{
|
||||
uORBTest::UnitTest &t = uORBTest::UnitTest::instance();
|
||||
return t.pub_test_queue_main();
|
||||
@ -842,7 +842,7 @@ int uORBTest::UnitTest::test_note(const char *fmt, ...)
|
||||
return OK;
|
||||
}
|
||||
|
||||
int uORBTest::UnitTest::pubsubtest_threadEntry(char *const argv[])
|
||||
int uORBTest::UnitTest::pubsubtest_threadEntry(int argc, char *argv[])
|
||||
{
|
||||
uORBTest::UnitTest &t = uORBTest::UnitTest::instance();
|
||||
return t.pubsublatency_main();
|
||||
|
||||
@ -86,10 +86,10 @@ private:
|
||||
// Disallow copy
|
||||
UnitTest(const uORBTest::UnitTest & /*unused*/) = delete;
|
||||
|
||||
static int pubsubtest_threadEntry(char *const argv[]);
|
||||
static int pubsubtest_threadEntry(int argc, char *argv[]);
|
||||
int pubsublatency_main();
|
||||
|
||||
static int pub_test_multi2_entry(char *const argv[]);
|
||||
static int pub_test_multi2_entry(int argc, char *argv[]);
|
||||
int pub_test_multi2_main();
|
||||
|
||||
volatile bool _thread_should_exit;
|
||||
@ -111,7 +111,7 @@ private:
|
||||
|
||||
/* queuing tests */
|
||||
int test_queue();
|
||||
static int pub_test_queue_entry(char *const argv[]);
|
||||
static int pub_test_queue_entry(int argc, char *argv[]);
|
||||
int pub_test_queue_main();
|
||||
int test_queue_poll_notify();
|
||||
volatile int _num_messages_sent = 0;
|
||||
|
||||
@ -572,10 +572,11 @@ void VtolAttitudeControl::fill_fw_att_rates_sp()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
VtolAttitudeControl::task_main_trampoline(int argc, char *argv[])
|
||||
{
|
||||
VTOL_att_control::g_control->task_main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void VtolAttitudeControl::task_main()
|
||||
|
||||
@ -214,7 +214,7 @@ private:
|
||||
//*****************Member functions***********************************************************************
|
||||
|
||||
void task_main(); //main task
|
||||
static void task_main_trampoline(int argc, char *argv[]); //Shim for calling task_main from task_create.
|
||||
static int task_main_trampoline(int argc, char *argv[]); //Shim for calling task_main from task_create.
|
||||
|
||||
void land_detected_poll();
|
||||
void tecs_status_poll();
|
||||
|
||||
@ -149,8 +149,9 @@ public:
|
||||
* @param argc start argument(s)
|
||||
* @param argv start argument(s)
|
||||
*/
|
||||
static void run_trampoline(int argc, char *argv[])
|
||||
static int run_trampoline(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
// on NuttX task_create() adds the task name as first argument
|
||||
@ -166,9 +167,12 @@ public:
|
||||
|
||||
} else {
|
||||
PX4_ERR("failed to instantiate object");
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
exit_and_cleanup();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user