X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fkaka%2Fcakelight%2FConfiguration.java;h=21c2072dee6f44a07384dd6d8f8c1e1ef25ba341;hb=aa9e49c2a448c4fa4c16d2afe373ea52eefdffd2;hp=94c5dddc4c5db5791c1ff45b8c3c3dc2957e1cf9;hpb=cc03403a7904293324578bd59fbf9eea9fd44c8d;p=kaka%2Fcakelight.git diff --git a/src/kaka/cakelight/Configuration.java b/src/kaka/cakelight/Configuration.java index 94c5ddd..21c2072 100644 --- a/src/kaka/cakelight/Configuration.java +++ b/src/kaka/cakelight/Configuration.java @@ -12,10 +12,12 @@ public class Configuration { private List> settings = new ArrayList<>(); public VideoConfiguration video; public LedConfiguration leds; + public double gamma; private Configuration(Properties prop) { video = new VideoConfiguration(prop); leds = new LedConfiguration(prop); + gamma = Double.parseDouble(get(prop,"gamma", "1")); } public static Configuration from(String propertiesFile) { @@ -70,13 +72,13 @@ public class Configuration { bpp = Integer.parseInt(get(prop, "video.bpp", "2")); switch (get(prop, "video.format", "").toUpperCase()) { case "YUYV": - format = Imgproc.COLOR_YUV2RGB_YUYV; + format = Imgproc.COLOR_YUV2BGR_YUYV; break; case "YVYU": - format = Imgproc.COLOR_YUV2RGB_YVYU; + format = Imgproc.COLOR_YUV2BGR_YVYU; break; default: - format = Imgproc.COLOR_YUV2RGB_UYVY; + format = Imgproc.COLOR_YUV2BGR_UYVY; } crop = new CropConfiguration(prop); } @@ -96,10 +98,27 @@ public class Configuration { public class LedConfiguration { public int cols; public int rows; + public LedType type; private LedConfiguration(Properties prop) { cols = Integer.parseInt(get(prop, "leds.cols")); rows = Integer.parseInt(get(prop, "leds.rows")); + switch (get(prop, "leds.type", "").toUpperCase()) { + case "WS2801": + type = LedType.WS2801; + break; + case "APA102": + default: + type = LedType.APA102; + } } + + public int getCount() { + return cols * 2 + rows * 2; + } + } + + public enum LedType { + WS2801, APA102 } }