From e1ea9e418c779fcbe604921a93b23e1285931fb2 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 9 Nov 2023 16:38:28 +1100 Subject: [PATCH] AP_Math: add F_TO_KELVIN and C_TO_F --- libraries/AP_Math/definitions.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Math/definitions.h b/libraries/AP_Math/definitions.h index 446c92fd78..4493d70f6c 100644 --- a/libraries/AP_Math/definitions.h +++ b/libraries/AP_Math/definitions.h @@ -74,7 +74,9 @@ static const double WGS84_E = (sqrt(2 * WGS84_F - WGS84_F * WGS84_F)); #define C_TO_KELVIN(temp) (temp + 273.15f) #define KELVIN_TO_C(temp) (temp - 273.15f) -#define F_TO_KELVIN(temp) C_TO_KELVIN(((temp - 32) * 5/9)) +#define F_TO_C(temp) ((temp - 32) * 5/9) +#define F_TO_KELVIN(temp) C_TO_KELVIN(F_TO_C(temp)) +#define C_TO_F(temp) ((temp * 9/5) + 32) #define M_PER_SEC_TO_KNOTS 1.94384449f #define KNOTS_TO_M_PER_SEC (1/M_PER_SEC_TO_KNOTS)