piet-v / HueLightPlus

Ambilight-clone for NZXT HUE+ LED-Controller
MIT License
17 stars 5 forks source link

Many exceptions #8

Open ImNotSatan opened 6 years ago

ImNotSatan commented 6 years ago

I have 2 channels 1: 4 strips 2: 2 strips

It looks like the Ambilight is working fine but it keeps spamming at: if (huePorts.huePorts[currentLed.device].isEnabled) + Exception Exception thrown: 'System.IndexOutOfRangeException' in HueLight+.exe ("De index ligt buiten de matrixgrenzen.") System.IndexOutOfRangeException

After startup: Randomly blinks lights and then they go black again and does absolutely nothing besides that

When i turn on multithreading: Still randomly blinks lights but amblight does work

Sorry if this was a bad description im quite new to C#.

One ting i noticed

The config.json did not load properly at first untill i changed it to this: (i use vistual studio 2017 with the newest windows 10).

`        private void SetupAmbiLight()
        {
            dynamic config = JsonConvert.DeserializeObject(File.ReadAllText("config.json"));

            bool formIsHidden = config["startsHidden"];
            double gamma = config["gamma"];

            AmbiLight.multiThreading = config["multiThreading"];
            AmbiLight.scanDepth = config["scanDepth"];
            AmbiLight.pixelsToSkipPerCoordinate = config["pixelsToSkipPerCoordinate"];
            AmbiLight.delay = config["delay"];
            AmbiLight.frameTimeout = config["frameTimeout"];
            AmbiLight.previewMode = config["preview"];

            HuePorts huePorts = new HuePorts(config["devices"].ToObject<Device[]>(), gamma);
            ScreenSide right = new ScreenSide(config["ambiLight"]["right"]["screenRegions"].ToObject<ScreenRegion[]>(), Direction.Right);
            ScreenSide left = new ScreenSide(config["ambiLight"]["left"]["screenRegions"].ToObject<ScreenRegion[]>(), Direction.Left);
            ScreenSide top = new ScreenSide(config["ambiLight"]["top"]["screenRegions"].ToObject<ScreenRegion[]>(), Direction.Top);
            ScreenSide bottom = new ScreenSide(config["ambiLight"]["bottom"]["screenRegions"].ToObject<ScreenRegion[]>(), Direction.Bottom);
            ScreenSide[] screenSides = new ScreenSide[] { top, right, bottom, left };

            ambiLight = new AmbiLight(screenSides, formIsHidden, huePorts, previewImage);
            Logger.Add("Loaded AmbiLight from config.json");
            Logger.Add("----------------------------");
        }`

Tings as config.startsHidden did not work for me but config["startsHidden"] did work.