Gradually reset maximum/minimum brightness

This commit is contained in:
fruchti 2020-07-17 23:31:57 +02:00
parent 53aa19d91f
commit 5d1ef2263a
3 changed files with 16 additions and 1 deletions

View file

@ -99,6 +99,17 @@ void LightSensor_Poll(void)
{
LightSensor_RelativeBrightness = LIGHTSENSOR_MAX;
}
// Slowly reset limit values
static int decay_counter = 0;
decay_counter++;
if(decay_counter == LIGHTSENSOR_LIMIT_RESET_TIME * 1000
/ LIGHTSENSOR_INTERVAL / LIGHTSENSOR_MAX)
{
decay_counter = 0;
LightSensor_MaximumBrightness -= 1;
LightSensor_MinimumBrightness += 1;
}
}
}