GCC <= 4 need a builtin function for constant sqrt expressions

This commit is contained in:
Nico Tonnhofer 2017-12-08 18:36:59 +01:00
parent 99d5a3fbeb
commit 3f52d75cf7
1 changed files with 13 additions and 0 deletions

View File

@ -125,3 +125,16 @@
#define TEMP_EWMA 1000 #define TEMP_EWMA 1000
#warning TEMP_EWMA scaling changed! Take a look in your printer.xxx.h. #warning TEMP_EWMA scaling changed! Take a look in your printer.xxx.h.
#endif #endif
/**
* With GCC major >= 5 we can calculate constant sqrt expressions
* lower versions, e.g. in the Arduino IDE, need for this a
* __builtin_ function.
*
* "warning: initializer element is not a constant expression"
*
* Someone may extend this later also for sin/cos.
*/
#if (__GNUC__ <= 4)
#define sqrt __builtin_sqrt
#endif