adafruit / Adafruit_TSL2591_Library

This is an Arduino library for the TSL2591 digital luminosity (light) sensors.
58 stars 48 forks source link

Auto sensitivity #35

Open s-light opened 4 years ago

s-light commented 4 years ago

This Pull-Request adds a new way of configuration management to the Adafruit_TSL2561 core files. they enable a advanced & fast configuration setting.

this functionality is used in the slight_TSL2591AutoSensitivity class. (currently located in the example tsl2591_auto_sensitivity) This class implements a automatic switching of the configuration to get the full range of light sensitivity the sensor offers. i think this class gives a big useful addition for the sensor - as you don't have to think about the correct sensitivity range anymore.

additionally i have added a simple average filter. one more idea is a 'value has changed flag' - that is aware of the current 'range': for 0.1..2 Lux it triggers if first first decimal place changes for 2..10 lux it triggers if first integral digit changes (but does not on fractional changes) and so on... this way 'noise' does not trigger...

if Adafruit is willing to merge this, i am happy to rename this class.. if this 'auto sensitivity' is to 'advanced' / not matching for this lib i will split this functionality into my own library. and would add a advanced example explaining the use of the advanced configuration here.

please let me know what you think of this!

sunny greetings stefan