mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 07:23:34 +08:00
mixer: minor refactoring to reduce header include dependencies
- avoid including <px4_defines.h> from the math headers - avoid driver include <drivers/drv_mixer.h> from the mixer
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <platforms/px4_defines.h>
|
||||
#include "Limits.hpp"
|
||||
|
||||
namespace math
|
||||
{
|
||||
|
||||
@@ -39,8 +39,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <platforms/px4_defines.h>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef MATH_PI
|
||||
#define MATH_PI 3.141592653589793238462643383280
|
||||
#endif
|
||||
|
||||
//this should be defined in stdint.h, but seems to be missing in the ARM toolchain (5.2.0)
|
||||
#ifndef UINT64_C
|
||||
@@ -90,13 +95,13 @@ inline constexpr bool isInRange(const _Tp &val, const _Tp &min_val, const _Tp &m
|
||||
template<typename T>
|
||||
constexpr T radians(const T degrees)
|
||||
{
|
||||
return degrees * (static_cast<T>(M_PI) / static_cast<T>(180));
|
||||
return degrees * (static_cast<T>(MATH_PI) / static_cast<T>(180));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr T degrees(const T radians)
|
||||
{
|
||||
return radians * (static_cast<T>(180) / static_cast<T>(M_PI));
|
||||
return radians * (static_cast<T>(180) / static_cast<T>(MATH_PI));
|
||||
}
|
||||
|
||||
/** Save way to check if float is zero */
|
||||
|
||||
@@ -40,8 +40,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <platforms/px4_defines.h>
|
||||
|
||||
namespace math
|
||||
{
|
||||
static constexpr double GOLDEN_RATIO = 1.6180339887; //(sqrt(5)+1)/2
|
||||
|
||||
Reference in New Issue
Block a user