mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Minor tweaks
This commit is contained in:
@@ -4,7 +4,6 @@ using Starlight.AnimeMatrix;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
|
||||||
namespace GHelper.AnimeMatrix
|
namespace GHelper.AnimeMatrix
|
||||||
@@ -69,49 +68,51 @@ namespace GHelper.AnimeMatrix
|
|||||||
StopMatrixTimer();
|
StopMatrixTimer();
|
||||||
StopMatrixAudio();
|
StopMatrixAudio();
|
||||||
|
|
||||||
try
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
device.SetProvider();
|
try
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.WriteLine(ex.Message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wakeUp && AppConfig.ContainsModel("401")) device.WakeUp();
|
|
||||||
|
|
||||||
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online))
|
|
||||||
{
|
|
||||||
device.SetDisplayState(false);
|
|
||||||
device.SetDisplayState(false); // some devices are dumb
|
|
||||||
Logger.WriteLine("Matrix Off");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
device.SetDisplayState(true);
|
|
||||||
device.SetBrightness((BrightnessMode)brightness);
|
|
||||||
|
|
||||||
switch (running)
|
|
||||||
{
|
{
|
||||||
case 2:
|
device.SetProvider();
|
||||||
SetMatrixPicture(AppConfig.GetString("matrix_picture"));
|
}
|
||||||
break;
|
catch (Exception ex)
|
||||||
case 3:
|
{
|
||||||
SetMatrixClock();
|
Logger.WriteLine(ex.Message);
|
||||||
break;
|
return;
|
||||||
case 4:
|
|
||||||
SetMatrixAudio();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
device.SetBuiltInAnimation(true, animation);
|
|
||||||
Logger.WriteLine("Matrix builtin " + animation.AsByte);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mat.SetBrightness((BrightnessMode)brightness);
|
if (wakeUp && AppConfig.ContainsModel("401")) device.WakeUp();
|
||||||
}
|
|
||||||
|
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online))
|
||||||
|
{
|
||||||
|
device.SetDisplayState(false);
|
||||||
|
device.SetDisplayState(false); // some devices are dumb
|
||||||
|
Logger.WriteLine("Matrix Off");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
device.SetDisplayState(true);
|
||||||
|
device.SetBrightness((BrightnessMode)brightness);
|
||||||
|
|
||||||
|
switch (running)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
SetMatrixPicture(AppConfig.GetString("matrix_picture"));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
SetMatrixClock();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
SetMatrixAudio();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
device.SetBuiltInAnimation(true, animation);
|
||||||
|
Logger.WriteLine("Matrix builtin " + animation.AsByte);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void StartMatrixTimer(int interval = 100)
|
private void StartMatrixTimer(int interval = 100)
|
||||||
@@ -358,10 +359,10 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
int matrixZoom = AppConfig.Get("matrix_zoom", 100);
|
int matrixZoom = AppConfig.Get("matrix_zoom", 100);
|
||||||
int matrixContrast = AppConfig.Get("matrix_contrast", 100);
|
int matrixContrast = AppConfig.Get("matrix_contrast", 100);
|
||||||
|
|
||||||
int matrixSpeed = AppConfig.Get("matrix_speed", 50);
|
int matrixSpeed = AppConfig.Get("matrix_speed", 50);
|
||||||
|
|
||||||
MatrixRotation rotation = (MatrixRotation)AppConfig.Get("matrix_rotation", 0);
|
MatrixRotation rotation = (MatrixRotation)AppConfig.Get("matrix_rotation", 0);
|
||||||
|
|
||||||
InterpolationMode matrixQuality = (InterpolationMode)AppConfig.Get("matrix_quality", 0);
|
InterpolationMode matrixQuality = (InterpolationMode)AppConfig.Get("matrix_quality", 0);
|
||||||
|
|
||||||
@@ -382,7 +383,7 @@ namespace GHelper.AnimeMatrix
|
|||||||
device.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast);
|
device.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast);
|
||||||
else
|
else
|
||||||
device.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast);
|
device.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast);
|
||||||
|
|
||||||
device.AddFrame();
|
device.AddFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
using GHelper.AnimeMatrix.Communication;
|
using GHelper.AnimeMatrix.Communication;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Text;
|
using System.Drawing.Text;
|
||||||
using System.Management;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Starlight.AnimeMatrix
|
namespace Starlight.AnimeMatrix
|
||||||
@@ -107,9 +106,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
public AnimeMatrixDevice() : base(0x0B05, 0x193B, 640)
|
public AnimeMatrixDevice() : base(0x0B05, 0x193B, 640)
|
||||||
{
|
{
|
||||||
string model = GetModel();
|
if (AppConfig.ContainsModel("401"))
|
||||||
|
|
||||||
if (model.Contains("401"))
|
|
||||||
{
|
{
|
||||||
_model = AnimeType.GA401;
|
_model = AnimeType.GA401;
|
||||||
|
|
||||||
@@ -124,7 +121,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
LedStart = 1;
|
LedStart = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.Contains("GU604"))
|
if (AppConfig.ContainsModel("GU604"))
|
||||||
{
|
{
|
||||||
_model = AnimeType.GU604;
|
_model = AnimeType.GU604;
|
||||||
|
|
||||||
@@ -154,18 +151,6 @@ namespace Starlight.AnimeMatrix
|
|||||||
System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr);
|
System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetModel()
|
|
||||||
{
|
|
||||||
using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_ComputerSystem"))
|
|
||||||
{
|
|
||||||
foreach (var process in searcher.Get())
|
|
||||||
return process["Model"].ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] GetBuffer()
|
public byte[] GetBuffer()
|
||||||
{
|
{
|
||||||
return _displayBuffer;
|
return _displayBuffer;
|
||||||
@@ -452,7 +437,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetBitmapDiagonal(bmp, 5 , height);
|
SetBitmapDiagonal(bmp, 5, height);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,13 +101,12 @@ namespace GHelper.Display
|
|||||||
int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1);
|
int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1);
|
||||||
int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2);
|
int miniled2 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled2);
|
||||||
|
|
||||||
Logger.WriteLine($"Miniled: {miniled1} {miniled2}");
|
|
||||||
|
|
||||||
int miniled = (miniled1 >= 0) ? miniled1 : miniled2;
|
int miniled = (miniled1 >= 0) ? miniled1 : miniled2;
|
||||||
bool hdr = false;
|
bool hdr = false;
|
||||||
|
|
||||||
if (miniled >= 0)
|
if (miniled >= 0)
|
||||||
{
|
{
|
||||||
|
Logger.WriteLine($"Miniled: {miniled1} {miniled2}");
|
||||||
AppConfig.Set("miniled", miniled);
|
AppConfig.Set("miniled", miniled);
|
||||||
hdr = ScreenCCD.GetHDRStatus();
|
hdr = ScreenCCD.GetHDRStatus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,12 +69,14 @@ namespace GHelper.Helpers
|
|||||||
}
|
}
|
||||||
public static void DisableClamshellMode()
|
public static void DisableClamshellMode()
|
||||||
{
|
{
|
||||||
|
if (PowerNative.GetLidAction(true) == GetDefaultLidAction()) return;
|
||||||
PowerNative.SetLidAction(GetDefaultLidAction(), true);
|
PowerNative.SetLidAction(GetDefaultLidAction(), true);
|
||||||
Logger.WriteLine("Disengaging Clamshell Mode");
|
Logger.WriteLine("Disengaging Clamshell Mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EnableClamshellMode()
|
public static void EnableClamshellMode()
|
||||||
{
|
{
|
||||||
|
if (PowerNative.GetLidAction(true) == 0) return;
|
||||||
PowerNative.SetLidAction(0, true);
|
PowerNative.SetLidAction(0, true);
|
||||||
Logger.WriteLine("Engaging Clamshell Mode");
|
Logger.WriteLine("Engaging Clamshell Mode");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user