mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 18:08:53 +08:00
ASSERT: remove some inappropriate asserts
Since assertions lead to crashes, we need better failure handling. In all the cases in this patch, the assert is not required. All the ones with the task id should be replaced with the module base class. Ah yes, and this reduces flash space, since the ASSERT macro will expand to a printf that contains the source file name.
This commit is contained in:
@@ -590,8 +590,6 @@ PX4IO::init()
|
||||
param_t sys_restart_param;
|
||||
int32_t sys_restart_val = DM_INIT_REASON_VOLATILE;
|
||||
|
||||
ASSERT(_task == -1);
|
||||
|
||||
sys_restart_param = param_find("SYS_RESTART_TYPE");
|
||||
|
||||
if (sys_restart_param != PARAM_INVALID) {
|
||||
|
||||
@@ -93,8 +93,6 @@ int
|
||||
CameraFeedback::start()
|
||||
{
|
||||
|
||||
ASSERT(_main_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_main_task = px4_task_spawn_cmd("camera_feedback",
|
||||
SCHED_DEFAULT,
|
||||
|
||||
@@ -328,7 +328,6 @@ void TemperatureCalibration::do_temperature_calibration(int argc, char *argv[])
|
||||
int TemperatureCalibration::start()
|
||||
{
|
||||
|
||||
ASSERT(_control_task == -1);
|
||||
_control_task = px4_task_spawn_cmd("temperature_calib",
|
||||
SCHED_DEFAULT,
|
||||
SCHED_PRIORITY_MAX - 5,
|
||||
|
||||
@@ -3368,8 +3368,6 @@ MulticopterPositionControl::landdetection_thrust_limit(matrix::Vector3f &thrust_
|
||||
int
|
||||
MulticopterPositionControl::start()
|
||||
{
|
||||
ASSERT(_control_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_control_task = px4_task_spawn_cmd("mc_pos_control",
|
||||
SCHED_DEFAULT,
|
||||
|
||||
@@ -319,7 +319,6 @@ int uORB::Manager::orb_set_interval(int handle, unsigned interval)
|
||||
|
||||
int uORB::Manager::orb_get_interval(int handle, unsigned *interval)
|
||||
{
|
||||
ASSERT(interval);
|
||||
int ret = px4_ioctl(handle, ORBIOCGETINTERVAL, (unsigned long)interval);
|
||||
*interval /= 1000;
|
||||
return ret;
|
||||
|
||||
@@ -767,8 +767,6 @@ void VtolAttitudeControl::task_main()
|
||||
int
|
||||
VtolAttitudeControl::start()
|
||||
{
|
||||
ASSERT(_control_task == -1);
|
||||
|
||||
/* start the task */
|
||||
_control_task = px4_task_spawn_cmd("vtol_att_control",
|
||||
SCHED_DEFAULT,
|
||||
|
||||
Reference in New Issue
Block a user