This commit is contained in:
Serge
2023-10-01 10:10:13 +02:00
parent 7845f278f8
commit 4fe8953a48
3 changed files with 31 additions and 27 deletions

View File

@@ -295,6 +295,17 @@ namespace Starlight.AnimeMatrix
SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x, value);
}
public void SetLedDiagonal(int x, int y, byte color, int deltaX = 0, int deltaY = 0)
{
x += deltaX;
y -= deltaY;
int plX = (x - y) / 2;
int plY = x + y;
SetLedPlanar(plX, plY, color);
}
public void WakeUp()
{
Set(Packet<AnimeMatrixPacket>(Encoding.ASCII.GetBytes("ASUS Tech.Inc.")));
@@ -388,18 +399,6 @@ namespace Starlight.AnimeMatrix
}
public void PresentClock()
{
string second = (DateTime.Now.Second % 2 == 0) ? ":" : " ";
string time = DateTime.Now.ToString("HH" + second + "mm");
Clear();
Text(time, 15, 0, 24);
Text(DateTime.Now.ToString("yy'. 'MM'. 'dd"), 11F, 0, 14);
Present();
}
private void SetBitmapDiagonal(Bitmap bmp, int deltaX = 0, int deltaY = 0)
{
for (int y = 0; y < bmp.Height; y++)
@@ -458,7 +457,17 @@ namespace Starlight.AnimeMatrix
}
}
public void PresentClock()
{
string second = (DateTime.Now.Second % 2 == 0) ? ":" : " ";
string time = DateTime.Now.ToString("HH" + second + "mm");
Clear();
Text(time, 15, 0, 24);
Text(DateTime.Now.ToString("yy'. 'MM'. 'dd"), 11F, 0, 14);
Present();
}
public void GenerateFrame(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default)
{
int width = MaxColumns / 2 * 6;
@@ -519,18 +528,6 @@ namespace Starlight.AnimeMatrix
}
public void SetLedDiagonal(int x, int y, byte color, int deltaX = 0, int deltaY = 0)
{
x += deltaX;
y -= deltaY;
int plX = (x - y) / 2;
int plY = x + y;
SetLedPlanar(plX, plY, color);
}
private bool IsRowInRange(int row)
{
return (row >= 0 && row < MaxRows);

View File

@@ -287,7 +287,7 @@ public class AsusACPI
}
public int DeviceSet(uint DeviceID, int Status, string logName)
public int DeviceSet(uint DeviceID, int Status, string? logName)
{
byte[] args = new byte[8];
BitConverter.GetBytes((uint)DeviceID).CopyTo(args, 0);
@@ -296,7 +296,9 @@ public class AsusACPI
byte[] status = CallMethod(DEVS, args);
int result = BitConverter.ToInt32(status, 0);
if (logName is not null)
Logger.WriteLine(logName + " = " + Status + " : " + (result == 1 ? "OK" : result));
return result;
}
@@ -378,6 +380,10 @@ public class AsusACPI
public int SetFanRange(AsusFan device, byte[] curve)
{
if (curve.Length != 16) return -1;
if (curve.All(singleByte => singleByte == 0)) return -1;
byte min = (byte)(curve[8] * 255 / 100);
byte max = (byte)(curve[15] * 255 / 100);
byte[] range = { min, max};
@@ -392,6 +398,7 @@ public class AsusACPI
result = DeviceSet(DevsCPUFan, range, "FanRangeCPU");
break;
}
return result;
}

View File

@@ -15,7 +15,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.126</AssemblyVersion>
<AssemblyVersion>0.127</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">