Remove maximum/minimum brightness decay

This commit is contained in:
fruchti 2020-07-15 14:07:07 +02:00
parent 5ffaee918a
commit 75d280c8ea
3 changed files with 1 additions and 10 deletions

View file

@ -1 +1 @@
213 238

View file

@ -80,12 +80,6 @@ void LightSensor_Poll(void)
LightSensor_AbsoluteBrightness = LIGHTSENSOR_LAMBDA * LightSensor_AbsoluteBrightness LightSensor_AbsoluteBrightness = LIGHTSENSOR_LAMBDA * LightSensor_AbsoluteBrightness
+ (1.0f - LIGHTSENSOR_LAMBDA) * brightness; + (1.0f - LIGHTSENSOR_LAMBDA) * brightness;
// Slowly move maximum and minimum back to 0.0 and 1.0, respectively
LightSensor_MaximumBrightness *= LIGHTSENSOR_ALPHA;
LightSensor_MinimumBrightness = 1.0f - LightSensor_MinimumBrightness;
LightSensor_MinimumBrightness *= LIGHTSENSOR_ALPHA;
LightSensor_MinimumBrightness = 1.0f - LightSensor_MinimumBrightness;
// Scale and saturate to get relative brightness value // Scale and saturate to get relative brightness value
float range = LightSensor_MaximumBrightness float range = LightSensor_MaximumBrightness
- LightSensor_MinimumBrightness; - LightSensor_MinimumBrightness;

View file

@ -11,9 +11,6 @@
// 'Forgetting factor' of the rolling brightness average // 'Forgetting factor' of the rolling brightness average
#define LIGHTSENSOR_LAMBDA 0.95f #define LIGHTSENSOR_LAMBDA 0.95f
// 'Forgetting factor' for maximum and minimum brightness
#define LIGHTSENSOR_ALPHA 0.999f
// Bounds for converting absolute to relative brightness: Consider everything // Bounds for converting absolute to relative brightness: Consider everything
// near the minimum or maximum 0.0 or 1.0, respectively // near the minimum or maximum 0.0 or 1.0, respectively
#define LIGHTSENSOR_LOW_BOUND 0.1f #define LIGHTSENSOR_LOW_BOUND 0.1f