This commit is contained in:
Serge
2024-04-20 18:57:10 +02:00
parent c65002cbae
commit bdba153ddc
3 changed files with 26 additions and 6 deletions

View File

@@ -117,7 +117,12 @@ namespace GHelper.AnimeMatrix
public void SetLidMode(bool force = false)
{
bool matrixLid = AppConfig.Is("matrix_lid");
if (deviceSlash is not null) deviceSlash.SetLidMode(matrixLid);
if (deviceSlash is not null)
{
deviceSlash.SetLidMode(matrixLid);
deviceSlash.SetSleepActive(!matrixLid);
}
if (matrixLid || force)
{

View File

@@ -137,12 +137,18 @@ namespace GHelper.AnimeMatrix
public void SetBatterySaver(bool status)
{
Set(Packet<SlashPacket>(0xD8, 0x01, 0x00, 0x01, status ? (byte)0x80 : (byte)0x00), "SlashBatterySaver");
Set(Packet<SlashPacket>(0xD8, 0x01, 0x00, 0x01, status ? (byte)0x80 : (byte)0x00), $"SlashBatterySaver {status}");
}
public void SetLidMode(bool status)
{
Set(Packet<SlashPacket>(0xD8, 0x00, 0x00, 0x02, 0xA5, status ? (byte)0x80 : (byte)0x00));
Set(Packet<SlashPacket>(0xD8, 0x00, 0x00, 0x02, 0xA5, status ? (byte)0x80 : (byte)0x00), $"DisableLidClose {status}");
}
public void SetSleepActive(bool status)
{
Set(Packet<SlashPacket>(0xD2, 0x02, 0x01, 0x08, 0xA1), "SleepInit");
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xA1, 0x00, 0xFF, status ? (byte)0x01 : (byte)0x00, 0x02, 0xFF, 0xFF), $"Sleep {status}");
}
public void Set(Packet packet, string? log = null)

View File

@@ -866,14 +866,23 @@ namespace GHelper
private void VisualizeCurrentDPIProfile()
{
if (mouse.DpiProfile > mouse.DpiSettings.Count())
if (mouse.DpiProfile > mouse.DpiSettings.Length)
{
Logger.WriteLine($"Wrong mouse DPI: {mouse.DpiProfile}");
return;
}
AsusMouseDPI dpi = mouse.DpiSettings[mouse.DpiProfile - 1];
AsusMouseDPI dpi;
try
{
dpi = mouse.DpiSettings[mouse.DpiProfile - 1];
} catch (Exception ex)
{
Logger.WriteLine($"Wrong mouse DPI: {mouse.DpiProfile} {mouse.DpiSettings.Length} {ex.Message}");
return;
}
if (dpi is null)
{
return;