Gradually reset maximum/minimum brightness
This commit is contained in:
parent
53aa19d91f
commit
5d1ef2263a
3 changed files with 16 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue