mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 18:43:33 +08:00
px4iofirmware use std NAN instead of undefined 0.0f/0.0f
- closes #9277
This commit is contained in:
@@ -66,7 +66,6 @@ extern "C" {
|
|||||||
* Maximum interval in us before FMU signal is considered lost
|
* Maximum interval in us before FMU signal is considered lost
|
||||||
*/
|
*/
|
||||||
#define FMU_INPUT_DROP_LIMIT_US 500000
|
#define FMU_INPUT_DROP_LIMIT_US 500000
|
||||||
#define NAN_VALUE (0.0f/0.0f)
|
|
||||||
|
|
||||||
/* current servo arm/disarm state */
|
/* current servo arm/disarm state */
|
||||||
static volatile bool mixer_servos_armed = false;
|
static volatile bool mixer_servos_armed = false;
|
||||||
@@ -479,7 +478,7 @@ mixer_callback(uintptr_t handle,
|
|||||||
control_group == actuator_controls_s::GROUP_INDEX_ATTITUDE_ALTERNATE) &&
|
control_group == actuator_controls_s::GROUP_INDEX_ATTITUDE_ALTERNATE) &&
|
||||||
control_index == actuator_controls_s::INDEX_THROTTLE) {
|
control_index == actuator_controls_s::INDEX_THROTTLE) {
|
||||||
/* mark the throttle as invalid */
|
/* mark the throttle as invalid */
|
||||||
control = NAN_VALUE;
|
control = NAN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,22 +37,10 @@
|
|||||||
* Mixer load test
|
* Mixer load test
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <px4_config.h>
|
#include <limits>
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <systemlib/err.h>
|
#include <px4_config.h>
|
||||||
#include <lib/mixer/mixer.h>
|
#include <lib/mixer/mixer.h>
|
||||||
#include <systemlib/pwm_limit/pwm_limit.h>
|
#include <systemlib/pwm_limit/pwm_limit.h>
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
@@ -75,8 +63,6 @@ const unsigned output_max = 8;
|
|||||||
static float actuator_controls[output_max];
|
static float actuator_controls[output_max];
|
||||||
static bool should_prearm = false;
|
static bool should_prearm = false;
|
||||||
|
|
||||||
#define NAN_VALUE (0.0f/0.0f)
|
|
||||||
|
|
||||||
#ifdef __PX4_DARWIN
|
#ifdef __PX4_DARWIN
|
||||||
#define MIXER_DIFFERENCE_THRESHOLD 30
|
#define MIXER_DIFFERENCE_THRESHOLD 30
|
||||||
#else
|
#else
|
||||||
@@ -604,7 +590,7 @@ mixer_callback(uintptr_t handle, uint8_t control_group, uint8_t control_index, f
|
|||||||
|
|
||||||
if (should_prearm && control_group == actuator_controls_s::GROUP_INDEX_ATTITUDE &&
|
if (should_prearm && control_group == actuator_controls_s::GROUP_INDEX_ATTITUDE &&
|
||||||
control_index == actuator_controls_s::INDEX_THROTTLE) {
|
control_index == actuator_controls_s::INDEX_THROTTLE) {
|
||||||
control = NAN_VALUE;
|
control = std::numeric_limits<float>::quiet_NaN();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user