Fix light sensor underflow

This commit is contained in:
fruchti 2020-07-16 23:19:28 +02:00
parent 5a45524af3
commit ee5a5b9f6c
2 changed files with 2 additions and 2 deletions

View file

@ -1 +1 @@
373 375

View file

@ -89,7 +89,7 @@ void LightSensor_Poll(void)
+ LIGHTSENSOR_LOW_BOUND * range / LIGHTSENSOR_MAX; + LIGHTSENSOR_LOW_BOUND * range / LIGHTSENSOR_MAX;
int high = LightSensor_MinimumBrightness int high = LightSensor_MinimumBrightness
+ LIGHTSENSOR_HIGH_BOUND * range / LIGHTSENSOR_MAX; + LIGHTSENSOR_HIGH_BOUND * range / LIGHTSENSOR_MAX;
LightSensor_RelativeBrightness = (LightSensor_AbsoluteBrightness - low) LightSensor_RelativeBrightness = ((int)LightSensor_AbsoluteBrightness - low)
* LIGHTSENSOR_MAX / (high - low); * LIGHTSENSOR_MAX / (high - low);
if(LightSensor_RelativeBrightness < 0) if(LightSensor_RelativeBrightness < 0)
{ {