From 3a6c0a639170d8954484dc294dceacb434f60ee9 Mon Sep 17 00:00:00 2001 From: fruchti Date: Mon, 21 Sep 2020 10:36:50 +0200 Subject: [PATCH] Fix dimming overflow --- build-number.txt | 2 +- src/light_sensor.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build-number.txt b/build-number.txt index 77afe23..31cf34b 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -509 +513 diff --git a/src/light_sensor.h b/src/light_sensor.h index da9f234..cd56d74 100644 --- a/src/light_sensor.h +++ b/src/light_sensor.h @@ -10,7 +10,7 @@ // Resolution of the brightness output #define LIGHTSENSOR_BITS 12 -#define LIGHTSENSOR_MAX (1 << LIGHTSENSOR_BITS) +#define LIGHTSENSOR_MAX ((1 << LIGHTSENSOR_BITS) - 1) // 'Forgetting factor' of the rolling brightness average #define LIGHTSENSOR_LAMBDA_BITS 2