Fix light sensor underflow
This commit is contained in:
parent
5a45524af3
commit
ee5a5b9f6c
|
@ -1 +1 @@
|
||||||
373
|
375
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue