diff --git a/platformio.ini b/platformio.ini index 603fc5f3..e967276f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1428,10 +1428,14 @@ upload_speed = 460800 ;115200 board_build.f_cpu = 160000000L ;; we want 160Mhz (default = 80Mhz) build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=esp8266_2MB_S + -D WLED_USE_UNREAL_MATH ;; may cause some wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM + -D WLEDMM_SAVE_FLASH -D WLED_DISABLE_ALEXA -D WLED_DISABLE_HUESYNC -D WLED_DISABLE_ESPNOW ;; might help in case of WiFi connectivity problems -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes + -D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit + -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit ;; -D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes ;; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes ; -D WLED_DISABLE_2D @@ -1440,8 +1444,8 @@ build_flags = ${common.build_flags_esp8266} ; -D WLED_DEBUG ; monitor_filters = esp8266_exception_decoder ;; lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -; RAM: [====== ] 60.8% (used 49836 bytes from 81920 bytes) -; Flash: [======== ] 83.3% (used 869783 bytes from 1044464 bytes) +; RAM: [====== ] 61.3% (used 50224 bytes from 81920 bytes) +; Flash: [========= ] 87.6% (used 915303 bytes from 1044464 bytes) [env:esp8266_4MB_S] extends = env:d1_mini @@ -1456,13 +1460,17 @@ build_flags = ${common.build_flags_esp8266} ;; -D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes ;; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes ; -D WLED_DISABLE_2D + ;; -D WLED_DISABLE_PARTICLESYSTEM1D + -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit + -D WLEDMM_SAVE_FLASH + -D WLED_USE_UNREAL_MATH ; -UWLED_USE_MY_CONFIG ${common_mm.NetDebug_build_flags} ; -D WLED_DEBUG ; monitor_filters = esp8266_exception_decoder ;; lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -; RAM: [====== ] 60.8% (used 49824 bytes from 81920 bytes) -; Flash: [======== ] 83.3% (used 869779 bytes from 1044464 bytes) +; RAM: [====== ] 61.3% (used 50220 bytes from 81920 bytes) +; Flash: [========= ] 89.5% (used 934483 bytes from 1044464 bytes) [env:esp8266_4MB_M] extends = env:d1_mini upload_speed = 460800 ;115200 @@ -1472,6 +1480,10 @@ build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_ALEXA -D WLED_DISABLE_HUESYNC -D WLED_DISABLE_LOXONE + -D WLEDMM_SAVE_FLASH + -D WLED_USE_UNREAL_MATH + ;; -D WLED_DISABLE_PARTICLESYSTEM1D + ;; -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit ; -D USERMOD_AUDIOREACTIVE ; -UWLED_USE_MY_CONFIG ; -D USERMOD_PIRSWITCH @@ -1492,8 +1504,8 @@ lib_deps = ${esp8266.lib_deps} OneWire@~2.3.5 ; used for USERMOD_FOUR_LINE_DISPLAY and USERMOD_DALLASTEMPERATURE olikraus/U8g2 @ ^2.28.8 ; used for USERMOD_FOUR_LINE_DISPLAY ElectronicCats/MPU6050 @ 0.6.0 ; used for USERMOD_MPU6050_IMU -; RAM: [====== ] 63.0% (used 51632 bytes from 81920 bytes) -; Flash: [========= ] 88.5% (used 924179 bytes from 1044464 bytes) +; RAM: [====== ] 63.0% (used 51608 bytes from 81920 bytes) +; Flash: [========= ] 94.9% (used 991039 bytes from 1044464 bytes) ; Blaz env (for reference purposes) [env:d1_mini_temp] @@ -1503,7 +1515,6 @@ build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 -D WLED_DISABLE_ALEXA -D WLED_DISABLE_HUESYNC -D WLED_DISABLE_LOXONE - -D WLED_DISABLE_AUDIO ;WLEDMM not used anywhere -D WLED_ENABLE_SIMPLE_UI -D USERMOD_FOUR_LINE_DISPLAY -D USE_ALT_DISPlAY @@ -1540,6 +1551,10 @@ build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_ALEXA -D WLED_DISABLE_HUESYNC ; -D WLED_DEBUG ${common.debug_flags} ;; un-comment for debug messages + ;; -D WLED_DISABLE_PARTICLESYSTEM1D + ;; -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit + -D WLEDMM_SAVE_FLASH + ;; -D WLED_USE_UNREAL_MATH ${common_mm.NetDebug_build_flags} ;; -D WLED_DISABLE_ESPNOW ;; might help in case of WiFi connectivity problems ; -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes @@ -1551,8 +1566,8 @@ build_flags = ${common.build_flags_esp8266} ; -UWLED_USE_MY_CONFIG monitor_filters = esp8266_exception_decoder ; lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -; RAM: [====== ] 59.3% (used 48616 bytes from 81920 bytes) -; Flash: [======== ] 77.0% (used 804236 bytes from 1044464 bytes) +; RAM: [====== ] 61.5% (used 50400 bytes from 81920 bytes) +; Flash: [========= ] 90.1% (used 941059 bytes from 1044464 bytes) [env:esp8266pro_16MB_M] extends = env:d1_mini @@ -1572,7 +1587,11 @@ build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_LOXONE ; -D USERMOD_AUDIOREACTIVE ; -D USERMOD_ARTIFX ; to be done - ;; -D WLED_DISABLE_ESPNOW ;; might help in case of WiFi connectivity problems + -D WLED_DISABLE_ESPNOW ;; might help in case of WiFi connectivity problems + ;; -D WLED_DISABLE_PARTICLESYSTEM1D + -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit + -D WLEDMM_SAVE_FLASH + ;; -D WLED_USE_UNREAL_MATH -D USERMOD_PIRSWITCH -D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S3 (autodetect broken?) -D USERMOD_MULTI_RELAY @@ -1587,8 +1606,8 @@ lib_deps = ${esp8266.lib_deps} OneWire@~2.3.5 ; used for USERMOD_FOUR_LINE_DISPLAY and USERMOD_DALLASTEMPERATURE olikraus/U8g2 @ ^2.28.8 ; used for USERMOD_FOUR_LINE_DISPLAY ElectronicCats/MPU6050 @ 0.6.0 ; used for USERMOD_MPU6050_IMU -; RAM: [====== ] 63.8% (used 52272 bytes from 81920 bytes) -; Flash: [========= ] 90.4% (used 944487 bytes from 1044464 bytes) +; RAM: [====== ] 62.9% (used 51508 bytes from 81920 bytes) +; Flash: [==========] 96.2% (used 1005115 bytes from 1044464 bytes) [env:esp01_1MB_S] board = esp01_1m @@ -1598,17 +1617,21 @@ board_build.ldscript = ${common.ldscript_1m128k} build_unflags = ${common.build_unflags} build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA -D WLED_RELEASE_NAME=esp01_1MB_S + -D WLED_USE_UNREAL_MATH ;; may cause some wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM -D WLED_DISABLE_ALEXA -D WLED_DISABLE_HUESYNC -D WLED_DISABLE_ESPNOW ;; exceeds flash size limits -D WLED_DISABLE_INFRARED ;; exceeds flash size limits -D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit -D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit - + -D WLEDMM_SAVE_FLASH + ;; -D WLED_DISABLE_LOXONE + ;; -D WLED_DISABLE_MQTT + ;; -D WLED_DISABLE_2D ;; last resort to reduce flash size lib_deps = ${esp8266.lib_deps} lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation -; RAM: [====== ] 60.6% (used 49616 bytes from 81920 bytes) -; Flash: [==========] 99.8% (used 890835 bytes from 892912 bytes) +; RAM: [====== ] 60.3% (used 49408 bytes from 81920 bytes) +; Flash: [==========] 98.6% (used 880331 bytes from 892912 bytes) # ------------------------------------------------------------------------------ diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index 319691a4..aa47e5ac 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -484,16 +484,19 @@ uint8_t cos8_t(uint8_t theta); float sin_approx(float theta); // uses integer math (converted to float), accuracy +/-0.0015 (compared to sinf()) float cos_approx(float theta); float tan_approx(float x); -//float atan2_t(float y, float x); -//float acos_t(float x); -//float asin_t(float x); -//template T atan_t(T x); -//float floor_t(float x); -//float fmod_t(float num, float denom); +#if defined(WLED_USE_UNREAL_MATH) +float atan2_t(float y, float x); +float acos_t(float x); +float asin_t(float x); +template T atan_t(T x); +float floor_t(float x); +float fmod_t(float num, float denom); +#endif #define sin_t sin_approx #define cos_t cos_approx #define tan_t tan_approx +#if !defined(WLED_USE_UNREAL_MATH) #include // standard math functions. use a lot of flash #define atan2_t atan2f #define asin_t asinf @@ -501,6 +504,7 @@ float tan_approx(float x); #define atan_t atanf #define fmod_t fmodf #define floor_t floorf +#endif /* #define sin_t sinf #define cos_t cosf diff --git a/wled00/wled_math.cpp b/wled00/wled_math.cpp index bd542338..1a6c9609 100644 --- a/wled00/wled_math.cpp +++ b/wled00/wled_math.cpp @@ -110,7 +110,7 @@ float tan_approx(float x) { return res; } -#if 0 // WLEDMM we prefer libm functions that are accurate and fast. +#if defined(WLED_USE_UNREAL_MATH) // WLEDMM we prefer libm functions that are accurate and fast. #define ATAN2_CONST_A 0.1963f #define ATAN2_CONST_B 0.9817f