summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2017-06-16 02:02:38 +0300
committerFred Sundvik <fsundvik@gmail.com>2017-06-16 02:05:38 +0300
commitec88a0b3ccfdd22373a707e084202f1f1cf481b2 (patch)
tree82bbc8a415279f897f4d476f6281d7036a4c811c
parent7d5606085fbd775019fc514f3ffca84edfc11aa6 (diff)
Make sure that the backlight level is within the right range
-rw-r--r--tmk_core/common/backlight.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tmk_core/common/backlight.c b/tmk_core/common/backlight.c
index 0e0ad2d154..d03bfe931b 100644
--- a/tmk_core/common/backlight.c
+++ b/tmk_core/common/backlight.c
@@ -28,6 +28,9 @@ void backlight_init(void)
eeconfig_init();
}
backlight_config.raw = eeconfig_read_backlight();
+ if (backlight_config.level > BACKLIGHT_LEVELS) {
+ backlight_config.level = BACKLIGHT_LEVELS;
+ }
backlight_set(backlight_config.enable ? backlight_config.level : 0);
}