Added a light level config (0-31) for APA102 only
[kaka/cakelight.git] / src / kaka / cakelight / Configuration.java
index 21c2072..4d727cc 100644 (file)
@@ -98,11 +98,13 @@ public class Configuration {
     public class LedConfiguration {
         public int cols;
         public int rows;
+        public int level;
         public LedType type;
 
         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"))));
             switch (get(prop, "leds.type", "").toUpperCase()) {
                 case "WS2801":
                     type = LedType.WS2801;