From: Tomas Wenström <tomas.wenstrom@gmail.com>
Date: Thu, 24 Aug 2017 20:07:18 +0000 (+0200)
Subject: Bugfix - switched min/max
X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=d2f3e87b12f1228806dacc41a3b4b2eab1c4c335;p=kaka%2Fcakelight.git

Bugfix - switched min/max
---

diff --git a/config.properties.template b/config.properties.template
index a7e6633..77f6aeb 100644
--- a/config.properties.template
+++ b/config.properties.template
@@ -14,6 +14,7 @@ video.crop.bottom=18
 
 # Supported types: apa102, ws2801
 leds.type=apa102
+# Light level: 1-31
 leds.level=31
 leds.cols=32
 leds.rows=17
diff --git a/src/kaka/cakelight/Configuration.java b/src/kaka/cakelight/Configuration.java
index 4d727cc..286da18 100644
--- a/src/kaka/cakelight/Configuration.java
+++ b/src/kaka/cakelight/Configuration.java
@@ -104,7 +104,7 @@ public class Configuration {
         private LedConfiguration(Properties prop) {
             cols = Integer.parseInt(get(prop, "leds.cols"));
             rows = Integer.parseInt(get(prop, "leds.rows"));
-            level = Math.min(0, Math.max(31, Integer.parseInt(get(prop, "leds.level", "31"))));
+            level = Math.max(1, Math.min(31, Integer.parseInt(get(prop, "leds.level", "31"))));
             switch (get(prop, "leds.type", "").toUpperCase()) {
                 case "WS2801":
                     type = LedType.WS2801;