diff --git a/app/AnimeMatrix/AnimeMatrixDevice.cs b/app/AnimeMatrix/AnimeMatrixDevice.cs index 7f9e7d47..7061e712 100644 --- a/app/AnimeMatrix/AnimeMatrixDevice.cs +++ b/app/AnimeMatrix/AnimeMatrixDevice.cs @@ -74,11 +74,11 @@ namespace Starlight.AnimeMatrix byte[] _displayBuffer; List frames = new List(); - public int MaxColumns = 34; public int MaxRows = 61; public int FullRows = 11; + public int FullEvenRows = -1; - public int EmptyFirstRow = 0; + public int MaxColumns = 34; private int frameIndex = 0; @@ -88,9 +88,11 @@ namespace Starlight.AnimeMatrix string model = GetModel(); if (model.Contains("401")) { - EmptyFirstRow = 1; - FullRows = 6; MaxColumns = 33; + + FullRows = 6; + FullEvenRows = 6; + MaxRows = 55; LedCount = 1214; UpdatePageLength = 410; @@ -150,7 +152,7 @@ namespace Starlight.AnimeMatrix public int XEnd(int row) { - if (row == 0) return MaxColumns - EmptyFirstRow; + if (row <= FullEvenRows && row % 2 == 0) return MaxColumns-1; return MaxColumns; } @@ -197,7 +199,6 @@ namespace Starlight.AnimeMatrix var start = RowToLinearAddress(y) - XStart(y); if (x >= XStart(y) && x < XEnd(y)) { - //Debug.Write((start + x).ToString("D4") + ","); SetLedLinear(start + x, value); return start + x; } @@ -272,7 +273,7 @@ namespace Starlight.AnimeMatrix static int GetColor(Bitmap bmp, int x, int y) { var pixel = bmp.GetPixel(Math.Max(0, Math.Min(bmp.Width - 1, x)), Math.Max(0, Math.Min(bmp.Height - 1, y))); - return (Math.Max((pixel.R + pixel.G + pixel.B) / 3 - 10, 0)); + return (Math.Max((pixel.R + pixel.G + pixel.B) / 3, 0)); } public void GenerateFrame(Image image) { @@ -295,8 +296,6 @@ namespace Starlight.AnimeMatrix graph.DrawImage(image, ((int)width - scaleWidth), 0, scaleWidth, scaleHeight); - int addr, counter = 0; - Bitmap bmp = new Bitmap(canvas, MaxColumns * 2, MaxRows); for (int y = 0; y < bmp.Height; y++) @@ -306,13 +305,7 @@ namespace Starlight.AnimeMatrix if (x % 2 == y % 2) { var color = GetColor(bmp, x, y); - //var color2= GetColor(bmp, x+1, y); - addr = SetLedPlanar(x / 2, y, (byte)color); - if (addr != -1) { - if (addr != counter) - Debug.Write("ERROR"); - counter++; - } + SetLedPlanar(x / 2, y, (byte)color); } } } diff --git a/app/CustomControls.cs b/app/CustomControls.cs index 6bd2d876..1e344354 100644 --- a/app/CustomControls.cs +++ b/app/CustomControls.cs @@ -1,5 +1,4 @@ -using GHelper; -using Microsoft.Win32; +using Microsoft.Win32; using System.ComponentModel; using System.Drawing.Drawing2D; using System.Runtime.InteropServices; @@ -26,7 +25,7 @@ namespace CustomControls { using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"); var registryValueObject = key?.GetValue("AppsUseLightTheme"); - + if (registryValueObject == null) return false; return (int)registryValueObject <= 0; } diff --git a/app/GHelper.csproj b/app/GHelper.csproj index db50f5ff..b9f60cff 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -16,7 +16,7 @@ x64 False True - 0.36 + 0.35