From 39cd83b171a40a80e86fdac9d38da82679620b97 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Sun, 23 May 2021 15:51:53 +0200 Subject: [PATCH] Temporary fix for inappropriate atan_t(). --- wled00/ntp.cpp | 13 ++++++++++++- wled00/wled_math.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/wled00/ntp.cpp b/wled00/ntp.cpp index 449ad044b..c236810a9 100644 --- a/wled00/ntp.cpp +++ b/wled00/ntp.cpp @@ -1,6 +1,17 @@ #include "src/dependencies/timezone/Timezone.h" #include "wled.h" -#include "wled_math.h" +#ifndef WLED_USE_REAL_MATH + #include "wled_math.h" +#else + #define sin_t sin + #define cos_t cos + #define tan_t tan + #define asin_t asin + #define acos_t acos + #define atan_t atan + #define fmod_t fmod + #define floor_t floor +#endif /* * Acquires time from NTP server diff --git a/wled00/wled_math.h b/wled00/wled_math.h index cbb508c1d..bafbd6de9 100644 --- a/wled00/wled_math.h +++ b/wled00/wled_math.h @@ -64,6 +64,7 @@ float asin_t(float x) { #define C ((HALF_PI/2) - A - B) float atan_t(float x) { + if (x>1) return atan(x); float xx = x * x; return ((A*xx + B)*xx + C)*x; }