]> www.dolda2000.com Git - kaka/cakelight.git/commitdiff
Added config for turning off lists
authorTomas Wenström <tomas.wenstrom@gmail.com>
Tue, 9 Apr 2019 17:50:17 +0000 (19:50 +0200)
committerTomas Wenström <tomas.wenstrom@gmail.com>
Tue, 9 Apr 2019 17:50:17 +0000 (19:50 +0200)
config.properties.template
src/kaka/cakelight/Configuration.java
src/kaka/cakelight/VideoFrame.java

index d7333fb8f02334d8b7c2542d75bc3ae1450d9f49..532e6a00f609fbca4c2da4f8fb316aa70dd66e92 100644 (file)
@@ -12,6 +12,11 @@ video.crop.right=29
 video.crop.top=18
 video.crop.bottom=18
 
+video.list.top=on
+video.list.bottom=on
+video.list.left=on
+video.list.right=on
+
 # Supported types: apa102, ws2801
 leds.type=apa102
 # LED brightness: 1-31
index 4f1525c9b2caf51ec2a459b629f63c040e38e075..a68bb393f9a468bc4a95d5c33b877d781e0243bd 100644 (file)
@@ -54,6 +54,7 @@ public class Configuration {
         public int bpp;
         public int format;
         public CropConfiguration crop;
+        public ListConfiguration list;
 
         private VideoConfiguration(Properties prop) {
             width = Integer.parseInt(get(prop, "video.width", "720"));
@@ -70,6 +71,7 @@ public class Configuration {
                     format = Imgproc.COLOR_YUV2BGR_UYVY;
             }
             crop = new CropConfiguration(prop);
+            list = new ListConfiguration(prop);
         }
 
         public class CropConfiguration {
@@ -82,6 +84,17 @@ public class Configuration {
                 bottom = Integer.parseInt(get(prop, "video.crop.bottom", "0"));
             }
         }
+
+        public class ListConfiguration {
+            public boolean top, bottom, left, right;
+
+            private ListConfiguration(Properties prop) {
+                top = get(prop, "video.list.top", "on").equals("on");
+                bottom = get(prop, "video.list.bottom", "on").equals("on");
+                left = get(prop, "video.list.left", "on").equals("on");
+                right = get(prop, "video.list.right", "on").equals("on");
+            }
+        }
     }
 
     public class LedConfiguration {
index 30d8593c231c042e779f43c428487844b0003646..e77dcd9a67bf807f1b77e8f7813ecd7f3b7a8b32 100644 (file)
@@ -172,10 +172,10 @@ public class VideoFrame {
     public LedFrame getLedFrame() {
         LedFrame frame = LedFrame.from(config);
         int led = 0;
-        for (int i = 0; i < config.leds.cols; i++)      frame.setLedColor(led++, wrappedGetLedColor(ListPosition.BOTTOM, i));
-        for (int i = config.leds.rows - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.RIGHT, i));
-        for (int i = config.leds.cols - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.TOP, i));
-        for (int i = 0; i < config.leds.rows; i++)      frame.setLedColor(led++, wrappedGetLedColor(ListPosition.LEFT, i));
+        if (config.video.list.bottom) for (int i = 0; i < config.leds.cols; i++)      frame.setLedColor(led++, wrappedGetLedColor(ListPosition.BOTTOM, i));
+        if (config.video.list.right)  for (int i = config.leds.rows - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.RIGHT, i));
+        if (config.video.list.top)    for (int i = config.leds.cols - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.TOP, i));
+        if (config.video.list.left)   for (int i = 0; i < config.leds.rows; i++)      frame.setLedColor(led++, wrappedGetLedColor(ListPosition.LEFT, i));
         return frame;
     }
 }