diff --git a/lib/Adafruit_VEML7700/Adafruit_VEML7700.cpp b/lib/Adafruit_VEML7700/Adafruit_VEML7700.cpp index 27a9fc3a6..254d74788 100644 --- a/lib/Adafruit_VEML7700/Adafruit_VEML7700.cpp +++ b/lib/Adafruit_VEML7700/Adafruit_VEML7700.cpp @@ -109,7 +109,7 @@ float Adafruit_VEML7700::normalize_resolution(float value) { * @returns Floating point Lux data (ALS multiplied by 0.0576) */ float Adafruit_VEML7700::readLux() { - return ( normalize_resolution(ALS_Data->read()) * 0.0576); // see app note lux table on page 5 + return ( normalize_resolution(ALS_Data->read()) * 0.0576f); // see app note lux table on page 5 } /*! @@ -122,7 +122,7 @@ float Adafruit_VEML7700::readLuxNormalized() { // user-provided correction for non-linearities at high lux/white values: // https://forums.adafruit.com/viewtopic.php?f=19&t=152997&p=758582#p759346 if ((getGain() == VEML7700_GAIN_1_8) && (getIntegrationTime() == VEML7700_IT_25MS)){ - lux = 6.0135e-13*alternate_pow(lux,4) - 9.3924e-9*alternate_pow(lux,3) + 8.1488e-5*alternate_pow(lux,2) + 1.0023*lux; + lux = 6.0135e-13f * pow(lux,4) - 9.3924e-9f * pow(lux,3) + 8.1488e-5f * pow(lux,2) + 1.0023f * lux; } return lux; @@ -142,7 +142,7 @@ uint16_t Adafruit_VEML7700::readALS() { */ float Adafruit_VEML7700::readWhite() { // white_corrected= 2E-15*pow(VEML_white,4) + 4E-12*pow(VEML_white,3) + 9E-06*pow(VEML_white,)2 + 1.0179*VEML_white - 11.052; - return normalize_resolution(White_Data->read()) * 0.0576; // Unclear if this is the right multiplier + return normalize_resolution(White_Data->read()) * 0.0576f; // Unclear if this is the right multiplier } /*! @@ -155,7 +155,7 @@ float Adafruit_VEML7700::readWhiteNormalized() { // user-provided correction for non-linearities at high lux values: // https://forums.adafruit.com/viewtopic.php?f=19&t=152997&p=758582#p759346 if ((getGain() == VEML7700_GAIN_1_8) && (getIntegrationTime() == VEML7700_IT_25MS)){ - white = 2E-15*alternate_pow(white,4) + 4E-12*alternate_pow(white,3) + 9E-06*alternate_pow(white,2) + 1.0179*white - 11.052; + white = 2E-15f * pow(white,4) + 4E-12f * pow(white,3) + 9E-06f * pow(white,2) + 1.0179f * white - 11.052f; } return white; diff --git a/lib/Adafruit_VEML7700/Adafruit_VEML7700.h b/lib/Adafruit_VEML7700/Adafruit_VEML7700.h index 4ff8f3f78..5ae23f3b6 100644 --- a/lib/Adafruit_VEML7700/Adafruit_VEML7700.h +++ b/lib/Adafruit_VEML7700/Adafruit_VEML7700.h @@ -62,6 +62,7 @@ #define VEML7700_POWERSAVE_MODE3 0x02 ///< Power saving mode 3 #define VEML7700_POWERSAVE_MODE4 0x03 ///< Power saving mode 4 +// FastPrecisePowf from tasmota/support_float.ino extern float FastPrecisePowf(const float x, const float y); /*! @@ -111,7 +112,7 @@ private: *PowerSave_Enable, *PowerSave_Mode; float normalize_resolution(float value); - static inline float alternate_pow(float a, float b) { return FastPrecisePowf(a, b); } + static inline float pow(float a, float b) { return FastPrecisePowf(a, b); } Adafruit_I2CDevice *i2c_dev;