From 8877bb59389aaedbe98ce53aa7d2770d5f49035f Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 23 Apr 2024 23:07:49 +0200 Subject: [PATCH 01/16] Panel UHD/FHD mode switch #2485 --- app/AsusACPI.cs | 1 + app/Display/ScreenControl.cs | 25 ++++++++++++++++++-- app/Settings.Designer.cs | 46 +++++++++++++++++++++++++++--------- app/Settings.cs | 14 ++++++++++- 4 files changed, 72 insertions(+), 14 deletions(-) diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index 32207182..18cafb84 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -79,6 +79,7 @@ public class AsusACPI public const uint ScreenOverdrive = 0x00050019; public const uint ScreenMiniled1 = 0x0005001E; public const uint ScreenMiniled2 = 0x0005002E; + public const uint ScreenFHD = 0x0005001C; public const uint DevsCPUFan = 0x00110022; public const uint DevsGPUFan = 0x00110023; diff --git a/app/Display/ScreenControl.cs b/app/Display/ScreenControl.cs index dc0f6ceb..b48552f6 100644 --- a/app/Display/ScreenControl.cs +++ b/app/Display/ScreenControl.cs @@ -1,4 +1,6 @@ -namespace GHelper.Display +using System.Diagnostics; + +namespace GHelper.Display { public class ScreenControl { @@ -69,6 +71,18 @@ InitScreen(); } + public void ToogleFHD() + { + int fhd = Program.acpi.DeviceGet(AsusACPI.ScreenFHD); + Logger.WriteLine($"FHD Toggle: {fhd}"); + + DialogResult dialogResult = MessageBox.Show("Changing display mode requires reboot", Properties.Strings.AlertUltimateTitle, MessageBoxButtons.YesNo); + if (dialogResult == DialogResult.Yes) + { + Program.acpi.DeviceSet(AsusACPI.ScreenFHD, (fhd == 1) ? 0 : 1, "FHD"); + Process.Start("shutdown", "/r /t 1"); + } + } public int ToogleMiniled() { @@ -125,6 +139,12 @@ bool screenEnabled = (frequency >= 0); + int fhd = -1; + if (AppConfig.IsDUO()) + { + fhd = Program.acpi.DeviceGet(AsusACPI.ScreenFHD); + } + AppConfig.Set("frequency", frequency); AppConfig.Set("overdrive", overdrive); @@ -139,7 +159,8 @@ overdriveSetting: overdriveSetting, miniled1: miniled1, miniled2: miniled2, - hdr: hdr + hdr: hdr, + fhd: fhd ); }); diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 157ec42b..3b8116e2 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -134,6 +134,7 @@ namespace GHelper labelGamma = new Label(); pictureGamma = new PictureBox(); labelGammaTitle = new Label(); + buttonFHD = new RButton(); panelMatrix.SuspendLayout(); panelMatrixAuto.SuspendLayout(); tableLayoutMatrix.SuspendLayout(); @@ -188,7 +189,7 @@ namespace GHelper panelMatrix.Controls.Add(tableLayoutMatrix); panelMatrix.Controls.Add(panelMatrixTitle); panelMatrix.Dock = DockStyle.Top; - panelMatrix.Location = new Point(11, 1051); + panelMatrix.Location = new Point(11, 1071); panelMatrix.Margin = new Padding(0); panelMatrix.Name = "panelMatrix"; panelMatrix.Padding = new Padding(20, 20, 20, 11); @@ -368,7 +369,7 @@ namespace GHelper panelBattery.Controls.Add(sliderBattery); panelBattery.Controls.Add(panelBatteryTitle); panelBattery.Dock = DockStyle.Top; - panelBattery.Location = new Point(11, 1705); + panelBattery.Location = new Point(11, 1725); panelBattery.Margin = new Padding(0); panelBattery.Name = "panelBattery"; panelBattery.Padding = new Padding(20, 20, 20, 11); @@ -460,7 +461,7 @@ namespace GHelper panelFooter.AutoSizeMode = AutoSizeMode.GrowAndShrink; panelFooter.Controls.Add(tableButtons); panelFooter.Dock = DockStyle.Top; - panelFooter.Location = new Point(11, 1881); + panelFooter.Location = new Point(11, 1901); panelFooter.Margin = new Padding(0); panelFooter.Name = "panelFooter"; panelFooter.Padding = new Padding(20); @@ -1040,7 +1041,7 @@ namespace GHelper panelScreen.Margin = new Padding(0); panelScreen.Name = "panelScreen"; panelScreen.Padding = new Padding(20, 11, 20, 0); - panelScreen.Size = new Size(827, 167); + panelScreen.Size = new Size(827, 187); panelScreen.TabIndex = 2; panelScreen.TabStop = true; // @@ -1048,7 +1049,7 @@ namespace GHelper // labelTipScreen.Dock = DockStyle.Top; labelTipScreen.ForeColor = SystemColors.GrayText; - labelTipScreen.Location = new Point(20, 131); + labelTipScreen.Location = new Point(20, 151); labelTipScreen.Margin = new Padding(4, 0, 4, 0); labelTipScreen.Name = "labelTipScreen"; labelTipScreen.Size = new Size(787, 36); @@ -1067,13 +1068,14 @@ namespace GHelper tableScreen.Controls.Add(button60Hz, 1, 0); tableScreen.Controls.Add(button120Hz, 2, 0); tableScreen.Controls.Add(buttonMiniled, 3, 0); + tableScreen.Controls.Add(buttonFHD, 3, 0); tableScreen.Dock = DockStyle.Top; tableScreen.Location = new Point(20, 51); tableScreen.Margin = new Padding(8, 4, 8, 4); tableScreen.Name = "tableScreen"; tableScreen.RowCount = 1; tableScreen.RowStyles.Add(new RowStyle(SizeType.Absolute, 80F)); - tableScreen.Size = new Size(787, 80); + tableScreen.Size = new Size(787, 100); tableScreen.TabIndex = 23; // // buttonScreenAuto @@ -1207,7 +1209,7 @@ namespace GHelper panelKeyboard.Controls.Add(tableLayoutKeyboard); panelKeyboard.Controls.Add(panelKeyboardTitle); panelKeyboard.Dock = DockStyle.Top; - panelKeyboard.Location = new Point(11, 1374); + panelKeyboard.Location = new Point(11, 1394); panelKeyboard.Margin = new Padding(0); panelKeyboard.Name = "panelKeyboard"; panelKeyboard.Padding = new Padding(20); @@ -1391,7 +1393,7 @@ namespace GHelper panelVersion.Controls.Add(labelCharge); panelVersion.Controls.Add(checkStartup); panelVersion.Dock = DockStyle.Top; - panelVersion.Location = new Point(11, 1825); + panelVersion.Location = new Point(11, 1845); panelVersion.Margin = new Padding(4); panelVersion.Name = "panelVersion"; panelVersion.Size = new Size(827, 56); @@ -1417,7 +1419,7 @@ namespace GHelper panelPeripherals.Controls.Add(tableLayoutPeripherals); panelPeripherals.Controls.Add(panelPeripheralsTile); panelPeripherals.Dock = DockStyle.Top; - panelPeripherals.Location = new Point(11, 1506); + panelPeripherals.Location = new Point(11, 1526); panelPeripherals.Margin = new Padding(0); panelPeripherals.Name = "panelPeripherals"; panelPeripherals.Padding = new Padding(20, 20, 20, 11); @@ -1559,7 +1561,7 @@ namespace GHelper panelAlly.Controls.Add(tableLayoutAlly); panelAlly.Controls.Add(panelAllyTitle); panelAlly.Dock = DockStyle.Top; - panelAlly.Location = new Point(11, 1234); + panelAlly.Location = new Point(11, 1254); panelAlly.Margin = new Padding(0); panelAlly.Name = "panelAlly"; panelAlly.Padding = new Padding(20, 20, 20, 0); @@ -1696,7 +1698,7 @@ namespace GHelper panelGamma.Controls.Add(sliderGamma); panelGamma.Controls.Add(panelGammaTitle); panelGamma.Dock = DockStyle.Top; - panelGamma.Location = new Point(11, 818); + panelGamma.Location = new Point(11, 838); panelGamma.Margin = new Padding(0); panelGamma.Name = "panelGamma"; panelGamma.Padding = new Padding(20, 11, 20, 11); @@ -1870,6 +1872,27 @@ namespace GHelper labelGammaTitle.TabIndex = 37; labelGammaTitle.Text = "Flicker-free Dimming"; // + // buttonFHD + // + buttonFHD.Activated = false; + buttonFHD.BackColor = SystemColors.ControlLightLight; + buttonFHD.BorderColor = Color.Transparent; + buttonFHD.BorderRadius = 5; + buttonFHD.CausesValidation = false; + buttonFHD.Dock = DockStyle.Fill; + buttonFHD.FlatAppearance.BorderSize = 0; + buttonFHD.FlatStyle = FlatStyle.Flat; + buttonFHD.ForeColor = SystemColors.ControlText; + buttonFHD.Location = new Point(4, 84); + buttonFHD.Margin = new Padding(4); + buttonFHD.Name = "buttonFHD"; + buttonFHD.Secondary = false; + buttonFHD.Size = new Size(188, 12); + buttonFHD.TabIndex = 13; + buttonFHD.Text = "FHD"; + buttonFHD.UseVisualStyleBackColor = false; + buttonFHD.Visible = false; + // // SettingsForm // AutoScaleDimensions = new SizeF(192F, 192F); @@ -2071,5 +2094,6 @@ namespace GHelper private RComboBox comboColorTemp; private RButton buttonInstallColor; private Label labelVisual; + private RButton buttonFHD; } } diff --git a/app/Settings.cs b/app/Settings.cs index 0e442ad5..8a47f84a 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -159,6 +159,7 @@ namespace GHelper button120Hz.Click += Button120Hz_Click; buttonScreenAuto.Click += ButtonScreenAuto_Click; buttonMiniled.Click += ButtonMiniled_Click; + buttonFHD.Click += ButtonFHD_Click; buttonQuit.Click += ButtonQuit_Click; @@ -263,6 +264,11 @@ namespace GHelper InitVisual(); } + private void ButtonFHD_Click(object? sender, EventArgs e) + { + screenControl.ToogleFHD(); + } + private void LabelCharge_Click(object? sender, EventArgs e) { BatteryControl.BatteryReport(); @@ -1143,7 +1149,7 @@ namespace GHelper - public void VisualiseScreen(bool screenEnabled, bool screenAuto, int frequency, int maxFrequency, int overdrive, bool overdriveSetting, int miniled1, int miniled2, bool hdr) + public void VisualiseScreen(bool screenEnabled, bool screenAuto, int frequency, int maxFrequency, int overdrive, bool overdriveSetting, int miniled1, int miniled2, bool hdr, int fhd) { ButtonEnabled(button60Hz, screenEnabled); @@ -1182,6 +1188,12 @@ namespace GHelper panelScreen.Visible = false; } + if (fhd >= 0) + { + buttonFHD.Visible = true; + buttonFHD.Text = fhd > 0 ? "FHD" : "UHD"; + } + if (miniled1 >= 0) { buttonMiniled.Enabled = !hdr; From a5a34df13915238e33984a8dc69d851b9e2afd5c Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 23 Apr 2024 23:21:07 +0200 Subject: [PATCH 02/16] UI Tweaks --- app/Settings.Designer.cs | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 3b8116e2..130b0ce1 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -88,6 +88,7 @@ namespace GHelper button60Hz = new RButton(); button120Hz = new RButton(); buttonMiniled = new RButton(); + buttonFHD = new RButton(); panelScreenTitle = new Panel(); labelMidFan = new Label(); pictureScreen = new PictureBox(); @@ -134,7 +135,6 @@ namespace GHelper labelGamma = new Label(); pictureGamma = new PictureBox(); labelGammaTitle = new Label(); - buttonFHD = new RButton(); panelMatrix.SuspendLayout(); panelMatrixAuto.SuspendLayout(); tableLayoutMatrix.SuspendLayout(); @@ -1147,15 +1147,36 @@ namespace GHelper buttonMiniled.FlatAppearance.BorderSize = 0; buttonMiniled.FlatStyle = FlatStyle.Flat; buttonMiniled.ForeColor = SystemColors.ControlText; - buttonMiniled.Location = new Point(592, 4); + buttonMiniled.Location = new Point(4, 84); buttonMiniled.Margin = new Padding(4); buttonMiniled.Name = "buttonMiniled"; buttonMiniled.Secondary = false; - buttonMiniled.Size = new Size(191, 72); + buttonMiniled.Size = new Size(188, 12); buttonMiniled.TabIndex = 12; buttonMiniled.Text = Properties.Strings.Multizone; buttonMiniled.UseVisualStyleBackColor = false; // + // buttonFHD + // + buttonFHD.Activated = false; + buttonFHD.BackColor = SystemColors.ControlLightLight; + buttonFHD.BorderColor = Color.Transparent; + buttonFHD.BorderRadius = 5; + buttonFHD.CausesValidation = false; + buttonFHD.Dock = DockStyle.Fill; + buttonFHD.FlatAppearance.BorderSize = 0; + buttonFHD.FlatStyle = FlatStyle.Flat; + buttonFHD.ForeColor = SystemColors.ControlText; + buttonFHD.Location = new Point(592, 4); + buttonFHD.Margin = new Padding(4); + buttonFHD.Name = "buttonFHD"; + buttonFHD.Secondary = false; + buttonFHD.Size = new Size(191, 72); + buttonFHD.TabIndex = 13; + buttonFHD.Text = "FHD"; + buttonFHD.UseVisualStyleBackColor = false; + buttonFHD.Visible = false; + // // panelScreenTitle // panelScreenTitle.Controls.Add(labelMidFan); @@ -1872,27 +1893,6 @@ namespace GHelper labelGammaTitle.TabIndex = 37; labelGammaTitle.Text = "Flicker-free Dimming"; // - // buttonFHD - // - buttonFHD.Activated = false; - buttonFHD.BackColor = SystemColors.ControlLightLight; - buttonFHD.BorderColor = Color.Transparent; - buttonFHD.BorderRadius = 5; - buttonFHD.CausesValidation = false; - buttonFHD.Dock = DockStyle.Fill; - buttonFHD.FlatAppearance.BorderSize = 0; - buttonFHD.FlatStyle = FlatStyle.Flat; - buttonFHD.ForeColor = SystemColors.ControlText; - buttonFHD.Location = new Point(4, 84); - buttonFHD.Margin = new Padding(4); - buttonFHD.Name = "buttonFHD"; - buttonFHD.Secondary = false; - buttonFHD.Size = new Size(188, 12); - buttonFHD.TabIndex = 13; - buttonFHD.Text = "FHD"; - buttonFHD.UseVisualStyleBackColor = false; - buttonFHD.Visible = false; - // // SettingsForm // AutoScaleDimensions = new SizeF(192F, 192F); From b03453d7211529964bba0ce68e1936a00bfa6492 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 23 Apr 2024 23:33:41 +0200 Subject: [PATCH 03/16] Hotkey actions url update --- app/Extra.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Extra.cs b/app/Extra.cs index 431f0d5d..63f38115 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -716,7 +716,7 @@ namespace GHelper private void PictureHelp_Click(object? sender, EventArgs e) { - Process.Start(new ProcessStartInfo("https://github.com/seerge/g-helper#custom-hotkey-actions") { UseShellExecute = true }); + Process.Start(new ProcessStartInfo("https://github.com/seerge/g-helper/wiki/Power-user-settings#custom-hotkey-actions") { UseShellExecute = true }); } private void CheckNoOverdrive_CheckedChanged(object? sender, EventArgs e) From 3981d2e028ab9966d832fd14d60f7e15c10450a2 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 23 Apr 2024 23:43:12 +0200 Subject: [PATCH 04/16] FHD toggle tweaks https://github.com/seerge/g-helper/discussions/2485 --- app/Settings.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Settings.cs b/app/Settings.cs index 8a47f84a..1faaf88a 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -217,6 +217,9 @@ namespace GHelper button120Hz.MouseMove += Button120Hz_MouseHover; button120Hz.MouseLeave += ButtonScreen_MouseLeave; + buttonFHD.MouseMove += ButtonFHD_MouseHover; + buttonFHD.MouseLeave += ButtonScreen_MouseLeave; + buttonUpdates.Click += ButtonUpdates_Click; sliderBattery.ValueChanged += SliderBattery_ValueChanged; @@ -771,6 +774,11 @@ namespace GHelper Program.settingsForm.RefreshSensors(); } + private void ButtonFHD_MouseHover(object? sender, EventArgs e) + { + labelTipScreen.Text = "Switch to "+ ((buttonFHD.Text == "FHD") ? "UHD" : "FHD") + " Mode"; + } + private void Button120Hz_MouseHover(object? sender, EventArgs e) { labelTipScreen.Text = Properties.Strings.MaxRefreshTooltip; From 009c947d306b98fe07bf156f3a4fa0c4615e85b3 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 24 Apr 2024 17:32:20 +0200 Subject: [PATCH 05/16] Update README.md --- docs/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/README.md b/docs/README.md index aa8eccf8..b1ddefd3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -22,6 +22,10 @@ Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13 | ----------------- | ---------------- | | [Josh Cravey](https://www.youtube.com/watch?v=hqe-PjuE-K8) | [cbutters Tech](https://www.youtube.com/watch?v=6aVdwJKZSSc) | +## 📰 Articles +1. https://binaryfork.com/ghelper-armoury-crate-alternative-10216/ +2. https://www.digitaltrends.com/computing/g-helper-armoury-crate-alternative/ + ## :gift: Advantages 1. Seamless and automatic GPU switching From c69b3ffab21401d9218fe4379b0ee2828c7d2b4e Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 24 Apr 2024 20:18:05 +0200 Subject: [PATCH 06/16] New Crowdin updates (#2490) * New translations strings.resx (Danish) * New translations strings.resx (Danish) --- app/Properties/Strings.da.resx | 797 +++++++++++++++++++++++++++++++++ 1 file changed, 797 insertions(+) create mode 100644 app/Properties/Strings.da.resx diff --git a/app/Properties/Strings.da.resx b/app/Properties/Strings.da.resx new file mode 100644 index 00000000..ff94cbf0 --- /dev/null +++ b/app/Properties/Strings.da.resx @@ -0,0 +1,797 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Acceleration + + + Kan ikke oprette forbindelse til ASUS ACPI. Applikationen kan ikke fungere uden. Prøv at installere Asus System Control Interface + + + Genstart din enhed for at anvende ændringerne + + + Genstart nu? + + + Ser ud til at GPU er i kraftig brug, vil du deaktivere den? + + + Øko-tilstand + + + Slukning af Ultimativ tilstand kræver genstart + + + Ultimativ tilstand kræver genstart + + + Genstart nu? + + + Ally Controller + + + Animationshastighed + + + Anime Matrix + + + Appen kører allerede + + + G-Helper kører allerede. Tjek systembakken for et ikon. + + + Anvend + + + Anvend brugerdefineret blæserkurve + + + Anvend strømgrænser + + + Automatisk justering af Windows strømtilstande + + + Hukommelse tildelt til GPU + + + Kørende Asus-tjenester + + + Batteritilstand + + + Vejrtrækning + + + Med uret + + + Farvecyklus + + + Komet + + + Mod uret + + + Hurtig + + + Lystilstand + + + Normal + + + Regnbue + + + Tilfældig + + + Reager + + + Langsom + + + Statisk + + + Strobelys + + + Alle + + + Dock + + + Logo + + + Scroll-hjul + + + Underglød + + + Anvend automatisk + + + Automatisk + + + Sætter 60 Hz for at spare på batteri, og tilbage når tilsluttet + + + Vågen + + + Lav + + + Maksimal + + + Mellem + + + Slukket + + + Timeout tilsluttet / på batteri (0 - TIL) + + + Baggrundslys timeout på batteri + + + Timeout for baggrundslys når tilsluttet + + + Balanceret + + + Opladning + + + Batteriopladningsgrænse + + + Batteritilstand + + + Engangsopladning til 100% + + + Binding + + + Primær + + + Sekundær + + + BIOS og driveropdateringer + + + Boot + + + Boot-lyd + + + Lysstyrke + + + Lysstyrke ned + + + Lysstyrke op + + + Sort og hvid bakkeikon + + + Kalibrer + + + Oplader + + + Farve + + + Kontrast + + + Controller + + + CPU Boost + + + Brugerdefineret + + + Deceleration + + + Standard + + + Deaktiver Controller + + + Deaktiver ved lukning af låg + + + Deaktiver overdrive på skærmen + + + Aflader + + + Hent farveprofiler + + + Hent + + + Drivere og software + + + Deaktiverer dGPU for at spare på batteriet + + + Øko + + + Aktiver GPU ved nedlukning (forhindrer problemer med Øko-tilstand) + + + Deaktivering af dGPU ved at gå i Øko-tilstand, mens visningstilstand i NVIDIA Kontrolpanel ikke er indstillet til Optimus kan forårsage problemer med lysstyrkekontrol indtil efter næste genstart. + +Vil du stadig fortsætte? + + + NVIDIA Visningstilstand er ikke indstillet til Optimus + + + Energiindstillinger + + + Eksporter profil + + + Ekstra + + + Ekstra indstillinger + + + Standard fabriksindstillinger + + + Blæserkurver + + + CPU blæserkurveprofil + + + GPU blæserkurveprofil + + + Midt blæserprofil + + + Blæserprofiler + + + Blæsere og kraft + + + Blæser + + + Blæser + Kraft + + + Flimmerfri dæmpning + + + Aktiver Fn + F genvejstaster uden Fn + + + FN-lås fra + + + FN-lås til + + + Dynamisk boost + + + Skifter + + + Core Clock forskydning + + + Memory Clock forskydning + + + GPU- tilstand + + + Kun iGPU + + + iGPU + dGPU + + + dGPU eksklusivt + + + GPU- strøm + + + GPU-indstillinger + + + Temperaturmål + + + Minutter til dvale i standby på batteriet (0 - OFF) + + + Høj + + + Billedrotation + + + Importer profil + + + Tastebindinger + + + Tastatur + + + Stop alle apps der bruger GPU når du skifter til Øko + + + Bærbar baggrundsbelysning + + + Bærbar tastatur + + + Bærbar skærm + + + LED statusindikatorer + + + Låg + + + Lightbar + + + Belysning + + + Låseskærm + + + Logo + + + Lav + + + Venstre stick dødzoner + + + Venstre udløser dødzoner + + + Lydvisualisering + + + Binær banner + + + Kraftigt + + + Ur + + + Dæmpet + + + ROG logo + + + Middel + + + Slukket + + + Billede + + + Maks. opdateringshastighed for lavere latenstid + + + 60Hz opdateringshastighed for at spare på batteriet + + + minut + + + minutter + + + Vinkel snapping + + + Automatisk slukning efter + + + Knaprespons + + + Import mislykkedes. Den valgte fil er ikke en gyldig museprofil eller den er korrupteret. + + + Løfteafstand + + + Lav batteriadvarsel ved + + + Ydelse + + + Synkroniser med mus + + + Multizone + + + Multizone stærk + + + Lydløs + + + Lydløs mikrofon + + + Aldrig + + + Nye opdateringer + + + Ingen nye opdateringer + + + Ikke tilsluttet + + + Fra + + + Til + + + En zone + + + Åbn G-Helper vindue + + + Optimeret + + + Skift til Øko på batteri og til Standard, når tilsluttet strøm + + + Hold GPU deaktiveret på USB-C-oplader i optimeret tilstand + + + Andet + + + Overdrive + + + Tilstand + + + Tilbehør + + + Billede / Gif + + + Afspil / Pause + + + Polling Rate + + + Kraftgrænser + + + Kraftgrænser er en eksperimentel funktion. Brug omhyggeligt og på egen risiko! + + + PrintScreen + + + Profil + + + Afslut + + + Nulstil + + + Noget bruger dGPU og forhindrer Øko-tilstand. Lad G-Helper forsøge at genstarte dGPU i enhedshåndtering? (fortsæt på egen risiko) + + + RPM + + + Højre stick dødzoner + + + Højre udløser dødzoner + + + Kør ved opstart + + + Skaleringskvalitet + + + Screenpad lysstyrke ned + + + Skærmtastatur lysstyrke op + + + Luk ned + + + Lydløs + + + Standby + + + Aktiverer dGPU til standardbrug + + + Standard + + + Start + + + Starter tjenester + + + Startfejl + + + Stop + + + Stop GPU-programmer + + + Stopper tjenester + + + Slå Aura til/fra + + + Automatisk slå Clamshell tilstand til/fra + + + Slå Fn-Lock til/fra + + + Slå MiniLED til/fra (hvis understøttet) + + + Slå skærmen til/fra + + + Turbo + + + Slukket + + + Deaktiver på batteri + + + Kobler bærbar skærm direkte til dGPU, hvilket maksimerer FPS + + + Ultimativ + + + Undervolting er en eksperimentel og risikabel funktion. Hvis de anvendte værdier er for lave for din hardware, kan det blive ustabilt, lukke ned eller forårsage datakorruption. Hvis du ønsker at prøve - start fra små værdier først, klik på Anvend og test hvad der virker for dig. + + + Ikke muted + + + Opdateringer + + + Version + + + Vibrationsstyrke + + + Visuel tilstand + + + Visuelle tilstande er ikke tilgængelige, når HDR er aktiv + + + Visuelle tilstande er ikke tilgængelige, når laptopskærmen er slukket + + + Lydstyrke ned + + + Lydløs + + + Lydstyrke op + + + Hold altid appvinduet øverst + + + Zoom + + \ No newline at end of file From 660e15667a8325769c190ec3fd1c482cd4c2b730 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 25 Apr 2024 11:26:48 +0200 Subject: [PATCH 07/16] Update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index b1ddefd3..f51115df 100644 --- a/docs/README.md +++ b/docs/README.md @@ -158,7 +158,7 @@ If you use equivalent mode/settings as in Armoury Crate - the performance or the The role of G-Helper for your laptop is similar to the role of a remote control for your TV. ### Libraries and projects used -- [Linux Kernel](https://github.com/torvalds/linux/blob/master/drivers/platform/x86/asus-wmi.c) for some basic endpoints in ASUS ACPI/WMI interface +- [Linux Kernel](https://github.com/torvalds/linux/blob/master/include/linux/platform_data/x86/asus-wmi.h) for some basic endpoints in ASUS ACPI/WMI interface - [NvAPIWrapper](https://github.com/falahati/NvAPIWrapper) for accessing Nvidia API - [Starlight](https://github.com/vddCore/Starlight) for anime matrix communication protocol - [UXTU](https://github.com/JamesCJ60/Universal-x86-Tuning-Utility) for undervolting using Ryzen System Management Unit From 950c1802e8a18600a29762c5ed233f35a95e15b7 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:00:21 +0200 Subject: [PATCH 08/16] Version bump --- app/GHelper.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/GHelper.csproj b/app/GHelper.csproj index 0208481f..44c1a7c9 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.167 + 0.168 From d634bdb26cf93c6e2606c252cd6016ba26e0bbe2 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:09:38 +0200 Subject: [PATCH 09/16] UI Tweaks --- app/Updates.Designer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Updates.Designer.cs b/app/Updates.Designer.cs index 80291320..9728a777 100644 --- a/app/Updates.Designer.cs +++ b/app/Updates.Designer.cs @@ -112,9 +112,9 @@ namespace GHelper // labelUpdates.Anchor = AnchorStyles.Top | AnchorStyles.Right; labelUpdates.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelUpdates.Location = new Point(919, 19); + labelUpdates.Location = new Point(864, 19); labelUpdates.Name = "labelUpdates"; - labelUpdates.Size = new Size(245, 32); + labelUpdates.Size = new Size(302, 32); labelUpdates.TabIndex = 4; labelUpdates.Text = "Updates Available"; // From f1286af4b7067e6c8513c522bd34086cac1bd5e0 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 25 Apr 2024 21:04:42 +0200 Subject: [PATCH 10/16] UI Fix https://github.com/seerge/g-helper/issues/2492 --- app/Mode/ModeControl.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Mode/ModeControl.cs b/app/Mode/ModeControl.cs index 92c74954..858a6dc2 100644 --- a/app/Mode/ModeControl.cs +++ b/app/Mode/ModeControl.cs @@ -285,6 +285,7 @@ namespace GHelper.Mode { bool allAMD = Program.acpi.IsAllAmdPPT(); + bool isAMD = RyzenControl.IsAMD(); int limit_total = AppConfig.GetMode("limit_total"); int limit_cpu = AppConfig.GetMode("limit_cpu"); @@ -312,7 +313,7 @@ namespace GHelper.Mode Program.acpi.DeviceSet(AsusACPI.PPT_APUA0, limit_slow, "PowerLimit A0"); customPower = limit_total; } - else if (RyzenControl.IsAMD()) + else if (isAMD) { if (ProcessHelper.IsUserAdministrator()) @@ -331,10 +332,9 @@ namespace GHelper.Mode Program.acpi.DeviceSet(AsusACPI.PPT_CPUB0, limit_cpu, "PowerLimit B0"); customPower = limit_cpu; } - else if (Program.acpi.DeviceGet(AsusACPI.PPT_APUC1) >= 0) // FPPT boost for non all-amd models + else if (isAMD && Program.acpi.DeviceGet(AsusACPI.PPT_APUC1) >= 0) // FPPT boost for non all-amd models { Program.acpi.DeviceSet(AsusACPI.PPT_APUC1, limit_fast, "PowerLimit C1"); - customPower = limit_fast; } From 1b371b6e38a919d220a6b971205831bdee0a1b08 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 25 Apr 2024 21:05:17 +0200 Subject: [PATCH 11/16] New translations strings.resx (Danish) (#2494) --- app/Properties/Strings.da.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Properties/Strings.da.resx b/app/Properties/Strings.da.resx index ff94cbf0..6be752fe 100644 --- a/app/Properties/Strings.da.resx +++ b/app/Properties/Strings.da.resx @@ -163,7 +163,7 @@ Anvend - Anvend brugerdefineret blæserkurve + Anvend blæserkurve Anvend strømgrænser From 0a2e755b7223f2883f57af7adba53d7c81cdcf53 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 25 Apr 2024 23:36:42 +0200 Subject: [PATCH 12/16] Update README.md --- docs/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index f51115df..9ce23037 100644 --- a/docs/README.md +++ b/docs/README.md @@ -61,8 +61,6 @@ Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13 - Auto Screen refresh rate (60Hz on battery and max Hz when plugged) - Keyboard backlight timeout on battery or when plugged in -_To keep auto switching and hotkeys working the app needs to stay running in the tray. It doesn't consume any resources._ - ### :rocket: Performance Modes From 15da5f64e5af70385bc2d095c3adb1385e9759f4 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:53:33 +0200 Subject: [PATCH 13/16] Anime Matrix Brightness https://github.com/seerge/g-helper/issues/2486 --- app/AnimeMatrix/AniMatrixControl.cs | 9 ++-- app/AnimeMatrix/AnimeMatrixDevice.cs | 16 +++---- app/Matrix.Designer.cs | 70 ++++++++++++++++++++++++++-- app/Matrix.cs | 18 +++++-- 4 files changed, 93 insertions(+), 20 deletions(-) diff --git a/app/AnimeMatrix/AniMatrixControl.cs b/app/AnimeMatrix/AniMatrixControl.cs index 7c826411..e19efa5b 100644 --- a/app/AnimeMatrix/AniMatrixControl.cs +++ b/app/AnimeMatrix/AniMatrixControl.cs @@ -465,6 +465,7 @@ namespace GHelper.AnimeMatrix int matrixZoom = AppConfig.Get("matrix_zoom", 100); int matrixContrast = AppConfig.Get("matrix_contrast", 100); + int matrixBrightness = AppConfig.Get("matrix_brightness", 0); int matrixSpeed = AppConfig.Get("matrix_speed", 50); @@ -486,9 +487,9 @@ namespace GHelper.AnimeMatrix image.SelectActiveFrame(dimension, i); if (rotation == MatrixRotation.Planar) - deviceMatrix.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast); + deviceMatrix.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixBrightness); else - deviceMatrix.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast); + deviceMatrix.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixBrightness); deviceMatrix.AddFrame(); } @@ -503,9 +504,9 @@ namespace GHelper.AnimeMatrix else { if (rotation == MatrixRotation.Planar) - deviceMatrix.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast); + deviceMatrix.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixBrightness); else - deviceMatrix.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast); + deviceMatrix.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixBrightness); deviceMatrix.Present(); } diff --git a/app/AnimeMatrix/AnimeMatrixDevice.cs b/app/AnimeMatrix/AnimeMatrixDevice.cs index 5e5c5c47..ac5ea43c 100644 --- a/app/AnimeMatrix/AnimeMatrixDevice.cs +++ b/app/AnimeMatrix/AnimeMatrixDevice.cs @@ -344,21 +344,21 @@ namespace GHelper.AnimeMatrix if (present) Present(); } - private void SetBitmapDiagonal(Bitmap bmp, int deltaX = 0, int deltaY = 0, int contrast = 100) + private void SetBitmapDiagonal(Bitmap bmp, int deltaX = 0, int deltaY = 0, int contrast = 100, int brightness = 0) { for (int y = 0; y < bmp.Height; y++) { for (int x = 0; x < bmp.Width; x++) { var pixel = bmp.GetPixel(x, y); - var color = Math.Min((pixel.R + pixel.G + pixel.B) * contrast / 300, 255); + var color = Math.Min((pixel.R + pixel.G + pixel.B + brightness) * contrast / 300, 255); if (color > 20) SetLedDiagonal(x, y, (byte)color, deltaX, deltaY - (FullRows / 2) - 1); } } } - private void SetBitmapLinear(Bitmap bmp, int contrast = 100) + private void SetBitmapLinear(Bitmap bmp, int contrast = 100, int brightness = 0) { for (int y = 0; y < bmp.Height; y++) { @@ -366,7 +366,7 @@ namespace GHelper.AnimeMatrix if (x % 2 == y % 2) { var pixel = bmp.GetPixel(x, y); - var color = Math.Min((pixel.R + pixel.G + pixel.B) * contrast / 300, 255); + var color = Math.Min((pixel.R + pixel.G + pixel.B + brightness) * contrast / 300, 255); if (color > 20) SetLedPlanar(x / 2, y, (byte)color); } @@ -413,7 +413,7 @@ namespace GHelper.AnimeMatrix Present(); } - public void GenerateFrame(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default, int contrast = 100) + public void GenerateFrame(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default, int contrast = 100, int brightness = 0) { int width = MaxColumns / 2 * 6; int height = MaxRows; @@ -440,11 +440,11 @@ namespace GHelper.AnimeMatrix } Clear(); - SetBitmapLinear(bmp, contrast); + SetBitmapLinear(bmp, contrast, brightness); } } - public void GenerateFrameDiagonal(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default, int contrast = 100) + public void GenerateFrameDiagonal(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default, int contrast = 100, int brightness = 0) { int width = MaxRows + FullRows; int height = MaxColumns + FullRows; @@ -471,7 +471,7 @@ namespace GHelper.AnimeMatrix } Clear(); - SetBitmapDiagonal(bmp, -panX, height + panY, contrast); + SetBitmapDiagonal(bmp, -panX, height + panY, contrast, brightness); } } diff --git a/app/Matrix.Designer.cs b/app/Matrix.Designer.cs index 62443eb0..a84e7018 100644 --- a/app/Matrix.Designer.cs +++ b/app/Matrix.Designer.cs @@ -35,6 +35,10 @@ panelMain = new Panel(); panelButtons = new Panel(); buttonReset = new UI.RButton(); + panelBrightness = new Panel(); + labelBrightness = new Label(); + labelBrightnessTitle = new Label(); + trackBrightness = new TrackBar(); panelContrast = new Panel(); labelContrast = new Label(); labelContrastTitle = new Label(); @@ -53,6 +57,8 @@ panelPicture.SuspendLayout(); panelMain.SuspendLayout(); panelButtons.SuspendLayout(); + panelBrightness.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)trackBrightness).BeginInit(); panelContrast.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)trackContrast).BeginInit(); panelRotation.SuspendLayout(); @@ -117,6 +123,7 @@ // panelMain.AutoSize = true; panelMain.Controls.Add(panelButtons); + panelMain.Controls.Add(panelBrightness); panelMain.Controls.Add(panelContrast); panelMain.Controls.Add(panelRotation); panelMain.Controls.Add(panelScaling); @@ -125,7 +132,7 @@ panelMain.Dock = DockStyle.Top; panelMain.Location = new Point(20, 20); panelMain.Name = "panelMain"; - panelMain.Size = new Size(834, 959); + panelMain.Size = new Size(834, 1104); panelMain.TabIndex = 5; // // panelButtons @@ -133,7 +140,7 @@ panelButtons.Controls.Add(buttonReset); panelButtons.Controls.Add(buttonPicture); panelButtons.Dock = DockStyle.Top; - panelButtons.Location = new Point(0, 865); + panelButtons.Location = new Point(0, 1010); panelButtons.Name = "panelButtons"; panelButtons.Size = new Size(834, 94); panelButtons.TabIndex = 6; @@ -157,6 +164,52 @@ buttonReset.TextImageRelation = TextImageRelation.ImageBeforeText; buttonReset.UseVisualStyleBackColor = false; // + // panelBrightness + // + panelBrightness.AutoSize = true; + panelBrightness.Controls.Add(labelBrightness); + panelBrightness.Controls.Add(labelBrightnessTitle); + panelBrightness.Controls.Add(trackBrightness); + panelBrightness.Dock = DockStyle.Top; + panelBrightness.Location = new Point(0, 865); + panelBrightness.Name = "panelBrightness"; + panelBrightness.Size = new Size(834, 145); + panelBrightness.TabIndex = 7; + // + // labelBrightness + // + labelBrightness.Anchor = AnchorStyles.Top | AnchorStyles.Right; + labelBrightness.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); + labelBrightness.Location = new Point(673, 17); + labelBrightness.Name = "labelBrightness"; + labelBrightness.Size = new Size(125, 32); + labelBrightness.TabIndex = 4; + labelBrightness.Text = "Brightness"; + labelBrightness.TextAlign = ContentAlignment.TopRight; + // + // labelBrightnessTitle + // + labelBrightnessTitle.AutoSize = true; + labelBrightnessTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelBrightnessTitle.Location = new Point(16, 17); + labelBrightnessTitle.Name = "labelBrightnessTitle"; + labelBrightnessTitle.Size = new Size(134, 32); + labelBrightnessTitle.TabIndex = 3; + labelBrightnessTitle.Text = "Brightness"; + // + // trackBrightness + // + trackBrightness.LargeChange = 50; + trackBrightness.Location = new Point(16, 52); + trackBrightness.Maximum = 100; + trackBrightness.Minimum = -100; + trackBrightness.Name = "trackBrightness"; + trackBrightness.Size = new Size(782, 90); + trackBrightness.SmallChange = 10; + trackBrightness.TabIndex = 2; + trackBrightness.TickFrequency = 20; + trackBrightness.TickStyle = TickStyle.TopLeft; + // // panelContrast // panelContrast.AutoSize = true; @@ -172,13 +225,13 @@ // labelContrast // labelContrast.Anchor = AnchorStyles.Top | AnchorStyles.Right; - labelContrast.AutoSize = true; labelContrast.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); - labelContrast.Location = new Point(705, 17); + labelContrast.Location = new Point(701, 17); labelContrast.Name = "labelContrast"; labelContrast.Size = new Size(103, 32); labelContrast.TabIndex = 4; labelContrast.Text = "Contrast"; + labelContrast.TextAlign = ContentAlignment.TopRight; // // labelContrastTitle // @@ -310,7 +363,7 @@ AutoScaleDimensions = new SizeF(192F, 192F); AutoScaleMode = AutoScaleMode.Dpi; AutoSize = true; - ClientSize = new Size(874, 1006); + ClientSize = new Size(874, 1142); Controls.Add(panelMain); MaximizeBox = false; MinimizeBox = false; @@ -326,6 +379,9 @@ panelMain.ResumeLayout(false); panelMain.PerformLayout(); panelButtons.ResumeLayout(false); + panelBrightness.ResumeLayout(false); + panelBrightness.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)trackBrightness).EndInit(); panelContrast.ResumeLayout(false); panelContrast.PerformLayout(); ((System.ComponentModel.ISupportInitialize)trackContrast).EndInit(); @@ -361,5 +417,9 @@ private Label labelContrast; private Label labelContrastTitle; private TrackBar trackContrast; + private Panel panelBrightness; + private Label labelBrightness; + private Label labelBrightnessTitle; + private TrackBar trackBrightness; } } \ No newline at end of file diff --git a/app/Matrix.cs b/app/Matrix.cs index 78c2a4a5..f9bfaac8 100644 --- a/app/Matrix.cs +++ b/app/Matrix.cs @@ -47,10 +47,14 @@ namespace GHelper trackZoom.ValueChanged += TrackZoom_Changed; trackZoom.Value = Math.Min(trackZoom.Maximum, AppConfig.Get("matrix_zoom", 100)); - trackContrast.MouseUp += TrackContrast_MouseUp; ; - trackContrast.ValueChanged += TrackContrast_ValueChanged; ; + trackContrast.MouseUp += TrackContrast_MouseUp; + trackContrast.ValueChanged += TrackMatrix_ValueChanged; trackContrast.Value = Math.Min(trackContrast.Maximum, AppConfig.Get("matrix_contrast", 100)); + trackBrightness.MouseUp += TrackBrightness_MouseUp; + trackBrightness.ValueChanged += TrackMatrix_ValueChanged; + trackBrightness.Value = Math.Min(trackBrightness.Maximum, AppConfig.Get("matrix_brightness", 0)); + VisualiseMatrix(); comboScaling.DropDownStyle = ComboBoxStyle.DropDownList; @@ -67,7 +71,7 @@ namespace GHelper } - private void TrackContrast_ValueChanged(object? sender, EventArgs e) + private void TrackMatrix_ValueChanged(object? sender, EventArgs e) { VisualiseMatrix(); } @@ -78,6 +82,13 @@ namespace GHelper SetMatrixPicture(); } + private void TrackBrightness_MouseUp(object? sender, MouseEventArgs e) + { + AppConfig.Set("matrix_brightness", trackBrightness.Value); + SetMatrixPicture(); + } + + private void ComboRotation_SelectedValueChanged(object? sender, EventArgs e) { AppConfig.Set("matrix_rotation", comboRotation.SelectedIndex); @@ -104,6 +115,7 @@ namespace GHelper { labelZoom.Text = trackZoom.Value + "%"; labelContrast.Text = trackContrast.Value + "%"; + labelBrightness.Text = trackBrightness.Value + "%"; } private void ButtonReset_Click(object? sender, EventArgs e) From 6d36794f5e04443a62ef141fbee844f4d8cdd8bd Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Apr 2024 12:07:49 +0200 Subject: [PATCH 14/16] Matrix Brightness reset --- app/Matrix.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Matrix.cs b/app/Matrix.cs index f9bfaac8..f46a06b8 100644 --- a/app/Matrix.cs +++ b/app/Matrix.cs @@ -120,6 +120,7 @@ namespace GHelper private void ButtonReset_Click(object? sender, EventArgs e) { + AppConfig.Set("matrix_brightness", 0); AppConfig.Set("matrix_contrast", 100); AppConfig.Set("matrix_zoom", 100); AppConfig.Set("matrix_x", 0); @@ -127,6 +128,7 @@ namespace GHelper trackZoom.Value = 100; trackContrast.Value = 100; + trackBrightness.Value = 0; SetMatrixPicture(); From 7e523d02c08789ef0f202cf8d337ee92a56e97d6 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Apr 2024 12:19:39 +0200 Subject: [PATCH 15/16] Renamed matrix brightness to gamma --- app/AnimeMatrix/AniMatrixControl.cs | 10 +-- app/AnimeMatrix/AnimeMatrixDevice.cs | 16 ++--- app/Matrix.Designer.cs | 104 +++++++++++++-------------- app/Matrix.cs | 23 +++--- app/Settings.cs | 2 +- 5 files changed, 75 insertions(+), 80 deletions(-) diff --git a/app/AnimeMatrix/AniMatrixControl.cs b/app/AnimeMatrix/AniMatrixControl.cs index e19efa5b..5e87933d 100644 --- a/app/AnimeMatrix/AniMatrixControl.cs +++ b/app/AnimeMatrix/AniMatrixControl.cs @@ -465,7 +465,7 @@ namespace GHelper.AnimeMatrix int matrixZoom = AppConfig.Get("matrix_zoom", 100); int matrixContrast = AppConfig.Get("matrix_contrast", 100); - int matrixBrightness = AppConfig.Get("matrix_brightness", 0); + int matrixGamma = AppConfig.Get("matrix_gamma", 0); int matrixSpeed = AppConfig.Get("matrix_speed", 50); @@ -487,9 +487,9 @@ namespace GHelper.AnimeMatrix image.SelectActiveFrame(dimension, i); if (rotation == MatrixRotation.Planar) - deviceMatrix.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixBrightness); + deviceMatrix.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixGamma); else - deviceMatrix.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixBrightness); + deviceMatrix.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixGamma); deviceMatrix.AddFrame(); } @@ -504,9 +504,9 @@ namespace GHelper.AnimeMatrix else { if (rotation == MatrixRotation.Planar) - deviceMatrix.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixBrightness); + deviceMatrix.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixGamma); else - deviceMatrix.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixBrightness); + deviceMatrix.GenerateFrameDiagonal(image, matrixZoom, matrixX, matrixY, matrixQuality, matrixContrast, matrixGamma); deviceMatrix.Present(); } diff --git a/app/AnimeMatrix/AnimeMatrixDevice.cs b/app/AnimeMatrix/AnimeMatrixDevice.cs index ac5ea43c..01c91d3a 100644 --- a/app/AnimeMatrix/AnimeMatrixDevice.cs +++ b/app/AnimeMatrix/AnimeMatrixDevice.cs @@ -344,21 +344,21 @@ namespace GHelper.AnimeMatrix if (present) Present(); } - private void SetBitmapDiagonal(Bitmap bmp, int deltaX = 0, int deltaY = 0, int contrast = 100, int brightness = 0) + private void SetBitmapDiagonal(Bitmap bmp, int deltaX = 0, int deltaY = 0, int contrast = 100, int gamma = 0) { for (int y = 0; y < bmp.Height; y++) { for (int x = 0; x < bmp.Width; x++) { var pixel = bmp.GetPixel(x, y); - var color = Math.Min((pixel.R + pixel.G + pixel.B + brightness) * contrast / 300, 255); + var color = Math.Min((pixel.R + pixel.G + pixel.B + gamma) * contrast / 300, 255); if (color > 20) SetLedDiagonal(x, y, (byte)color, deltaX, deltaY - (FullRows / 2) - 1); } } } - private void SetBitmapLinear(Bitmap bmp, int contrast = 100, int brightness = 0) + private void SetBitmapLinear(Bitmap bmp, int contrast = 100, int gamma = 0) { for (int y = 0; y < bmp.Height; y++) { @@ -366,7 +366,7 @@ namespace GHelper.AnimeMatrix if (x % 2 == y % 2) { var pixel = bmp.GetPixel(x, y); - var color = Math.Min((pixel.R + pixel.G + pixel.B + brightness) * contrast / 300, 255); + var color = Math.Min((pixel.R + pixel.G + pixel.B + gamma) * contrast / 300, 255); if (color > 20) SetLedPlanar(x / 2, y, (byte)color); } @@ -413,7 +413,7 @@ namespace GHelper.AnimeMatrix Present(); } - public void GenerateFrame(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default, int contrast = 100, int brightness = 0) + public void GenerateFrame(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default, int contrast = 100, int gamma = 0) { int width = MaxColumns / 2 * 6; int height = MaxRows; @@ -440,11 +440,11 @@ namespace GHelper.AnimeMatrix } Clear(); - SetBitmapLinear(bmp, contrast, brightness); + SetBitmapLinear(bmp, contrast, gamma); } } - public void GenerateFrameDiagonal(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default, int contrast = 100, int brightness = 0) + public void GenerateFrameDiagonal(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default, int contrast = 100, int gamma = 0) { int width = MaxRows + FullRows; int height = MaxColumns + FullRows; @@ -471,7 +471,7 @@ namespace GHelper.AnimeMatrix } Clear(); - SetBitmapDiagonal(bmp, -panX, height + panY, contrast, brightness); + SetBitmapDiagonal(bmp, -panX, height + panY, contrast, gamma); } } diff --git a/app/Matrix.Designer.cs b/app/Matrix.Designer.cs index a84e7018..79a06b46 100644 --- a/app/Matrix.Designer.cs +++ b/app/Matrix.Designer.cs @@ -35,10 +35,10 @@ panelMain = new Panel(); panelButtons = new Panel(); buttonReset = new UI.RButton(); - panelBrightness = new Panel(); - labelBrightness = new Label(); - labelBrightnessTitle = new Label(); - trackBrightness = new TrackBar(); + panelGamma = new Panel(); + labelGamma = new Label(); + labelGammaTitle = new Label(); + trackGamma = new TrackBar(); panelContrast = new Panel(); labelContrast = new Label(); labelContrastTitle = new Label(); @@ -57,8 +57,8 @@ panelPicture.SuspendLayout(); panelMain.SuspendLayout(); panelButtons.SuspendLayout(); - panelBrightness.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)trackBrightness).BeginInit(); + panelGamma.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)trackGamma).BeginInit(); panelContrast.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)trackContrast).BeginInit(); panelRotation.SuspendLayout(); @@ -123,7 +123,7 @@ // panelMain.AutoSize = true; panelMain.Controls.Add(panelButtons); - panelMain.Controls.Add(panelBrightness); + panelMain.Controls.Add(panelGamma); panelMain.Controls.Add(panelContrast); panelMain.Controls.Add(panelRotation); panelMain.Controls.Add(panelScaling); @@ -164,51 +164,51 @@ buttonReset.TextImageRelation = TextImageRelation.ImageBeforeText; buttonReset.UseVisualStyleBackColor = false; // - // panelBrightness + // panelGamma // - panelBrightness.AutoSize = true; - panelBrightness.Controls.Add(labelBrightness); - panelBrightness.Controls.Add(labelBrightnessTitle); - panelBrightness.Controls.Add(trackBrightness); - panelBrightness.Dock = DockStyle.Top; - panelBrightness.Location = new Point(0, 865); - panelBrightness.Name = "panelBrightness"; - panelBrightness.Size = new Size(834, 145); - panelBrightness.TabIndex = 7; + panelGamma.AutoSize = true; + panelGamma.Controls.Add(labelGamma); + panelGamma.Controls.Add(labelGammaTitle); + panelGamma.Controls.Add(trackGamma); + panelGamma.Dock = DockStyle.Top; + panelGamma.Location = new Point(0, 865); + panelGamma.Name = "panelGamma"; + panelGamma.Size = new Size(834, 145); + panelGamma.TabIndex = 7; // - // labelBrightness + // labelGamma // - labelBrightness.Anchor = AnchorStyles.Top | AnchorStyles.Right; - labelBrightness.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); - labelBrightness.Location = new Point(673, 17); - labelBrightness.Name = "labelBrightness"; - labelBrightness.Size = new Size(125, 32); - labelBrightness.TabIndex = 4; - labelBrightness.Text = "Brightness"; - labelBrightness.TextAlign = ContentAlignment.TopRight; + labelGamma.Anchor = AnchorStyles.Top | AnchorStyles.Right; + labelGamma.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); + labelGamma.Location = new Point(673, 17); + labelGamma.Name = "labelGamma"; + labelGamma.Size = new Size(125, 32); + labelGamma.TabIndex = 4; + labelGamma.Text = "Brightness"; + labelGamma.TextAlign = ContentAlignment.TopRight; // - // labelBrightnessTitle + // labelGammaTitle // - labelBrightnessTitle.AutoSize = true; - labelBrightnessTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); - labelBrightnessTitle.Location = new Point(16, 17); - labelBrightnessTitle.Name = "labelBrightnessTitle"; - labelBrightnessTitle.Size = new Size(134, 32); - labelBrightnessTitle.TabIndex = 3; - labelBrightnessTitle.Text = "Brightness"; + labelGammaTitle.AutoSize = true; + labelGammaTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point); + labelGammaTitle.Location = new Point(16, 17); + labelGammaTitle.Name = "labelGammaTitle"; + labelGammaTitle.Size = new Size(134, 32); + labelGammaTitle.TabIndex = 3; + labelGammaTitle.Text = "Brightness"; // - // trackBrightness + // trackGamma // - trackBrightness.LargeChange = 50; - trackBrightness.Location = new Point(16, 52); - trackBrightness.Maximum = 100; - trackBrightness.Minimum = -100; - trackBrightness.Name = "trackBrightness"; - trackBrightness.Size = new Size(782, 90); - trackBrightness.SmallChange = 10; - trackBrightness.TabIndex = 2; - trackBrightness.TickFrequency = 20; - trackBrightness.TickStyle = TickStyle.TopLeft; + trackGamma.LargeChange = 50; + trackGamma.Location = new Point(16, 52); + trackGamma.Maximum = 100; + trackGamma.Minimum = -100; + trackGamma.Name = "trackGamma"; + trackGamma.Size = new Size(782, 90); + trackGamma.SmallChange = 10; + trackGamma.TabIndex = 2; + trackGamma.TickFrequency = 20; + trackGamma.TickStyle = TickStyle.TopLeft; // // panelContrast // @@ -379,9 +379,9 @@ panelMain.ResumeLayout(false); panelMain.PerformLayout(); panelButtons.ResumeLayout(false); - panelBrightness.ResumeLayout(false); - panelBrightness.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)trackBrightness).EndInit(); + panelGamma.ResumeLayout(false); + panelGamma.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)trackGamma).EndInit(); panelContrast.ResumeLayout(false); panelContrast.PerformLayout(); ((System.ComponentModel.ISupportInitialize)trackContrast).EndInit(); @@ -417,9 +417,9 @@ private Label labelContrast; private Label labelContrastTitle; private TrackBar trackContrast; - private Panel panelBrightness; - private Label labelBrightness; - private Label labelBrightnessTitle; - private TrackBar trackBrightness; + private Panel panelGamma; + private Label labelGamma; + private Label labelGammaTitle; + private TrackBar trackGamma; } } \ No newline at end of file diff --git a/app/Matrix.cs b/app/Matrix.cs index f46a06b8..0600173d 100644 --- a/app/Matrix.cs +++ b/app/Matrix.cs @@ -47,13 +47,13 @@ namespace GHelper trackZoom.ValueChanged += TrackZoom_Changed; trackZoom.Value = Math.Min(trackZoom.Maximum, AppConfig.Get("matrix_zoom", 100)); - trackContrast.MouseUp += TrackContrast_MouseUp; + trackContrast.MouseUp += TrackMatrix_MouseUp; trackContrast.ValueChanged += TrackMatrix_ValueChanged; trackContrast.Value = Math.Min(trackContrast.Maximum, AppConfig.Get("matrix_contrast", 100)); - trackBrightness.MouseUp += TrackBrightness_MouseUp; - trackBrightness.ValueChanged += TrackMatrix_ValueChanged; - trackBrightness.Value = Math.Min(trackBrightness.Maximum, AppConfig.Get("matrix_brightness", 0)); + trackGamma.MouseUp += TrackMatrix_MouseUp; + trackGamma.ValueChanged += TrackMatrix_ValueChanged; + trackGamma.Value = Math.Min(trackGamma.Maximum, AppConfig.Get("matrix_gamma", 0)); VisualiseMatrix(); @@ -76,15 +76,10 @@ namespace GHelper VisualiseMatrix(); } - private void TrackContrast_MouseUp(object? sender, MouseEventArgs e) + private void TrackMatrix_MouseUp(object? sender, MouseEventArgs e) { AppConfig.Set("matrix_contrast", trackContrast.Value); - SetMatrixPicture(); - } - - private void TrackBrightness_MouseUp(object? sender, MouseEventArgs e) - { - AppConfig.Set("matrix_brightness", trackBrightness.Value); + AppConfig.Set("matrix_gamma", trackGamma.Value); SetMatrixPicture(); } @@ -115,12 +110,12 @@ namespace GHelper { labelZoom.Text = trackZoom.Value + "%"; labelContrast.Text = trackContrast.Value + "%"; - labelBrightness.Text = trackBrightness.Value + "%"; + labelGamma.Text = trackGamma.Value + "%"; } private void ButtonReset_Click(object? sender, EventArgs e) { - AppConfig.Set("matrix_brightness", 0); + AppConfig.Set("matrix_gamma", 0); AppConfig.Set("matrix_contrast", 100); AppConfig.Set("matrix_zoom", 100); AppConfig.Set("matrix_x", 0); @@ -128,7 +123,7 @@ namespace GHelper trackZoom.Value = 100; trackContrast.Value = 100; - trackBrightness.Value = 0; + trackGamma.Value = 0; SetMatrixPicture(); diff --git a/app/Settings.cs b/app/Settings.cs index 1faaf88a..50695137 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1097,7 +1097,7 @@ namespace GHelper checkMatrixLid.Visible = true; } - comboMatrix.SelectedIndex = Math.Min(AppConfig.Get("matrix_brightness", 0), comboMatrix.Items.Count - 1); + comboMatrix.SelectedIndex = Math.Max(0, Math.Min(AppConfig.Get("matrix_brightness", 0), comboMatrix.Items.Count - 1)); comboMatrixRunning.SelectedIndex = Math.Min(AppConfig.Get("matrix_running", 0), comboMatrixRunning.Items.Count - 1); comboInterval.SelectedIndex = Math.Min(AppConfig.Get("matrix_interval", 0), comboInterval.Items.Count - 1); From e52ee2094c8a8a0b5ed0e2d7764221404bf1be07 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:46:47 +0200 Subject: [PATCH 16/16] Custom payloads for Slash Lighting --- app/AnimeMatrix/AniMatrixControl.cs | 9 ++++++++- app/AnimeMatrix/SlashDevice.cs | 9 +++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/AnimeMatrix/AniMatrixControl.cs b/app/AnimeMatrix/AniMatrixControl.cs index 5e87933d..7262f2bb 100644 --- a/app/AnimeMatrix/AniMatrixControl.cs +++ b/app/AnimeMatrix/AniMatrixControl.cs @@ -103,7 +103,14 @@ namespace GHelper.AnimeMatrix switch ((SlashMode)running) { case SlashMode.Static: - deviceSlash.SetStatic(brightness); + var custom = AppConfig.GetString("slash_custom"); + if (custom is not null && custom.Length > 0) + { + deviceSlash.SetCustom(AppConfig.StringToBytes(custom)); + } else + { + deviceSlash.SetStatic(brightness); + } break; default: deviceSlash.SetMode((SlashMode)running); diff --git a/app/AnimeMatrix/SlashDevice.cs b/app/AnimeMatrix/SlashDevice.cs index f2027260..4adb065c 100644 --- a/app/AnimeMatrix/SlashDevice.cs +++ b/app/AnimeMatrix/SlashDevice.cs @@ -119,13 +119,18 @@ namespace GHelper.AnimeMatrix public void SetStatic(int brightness = 0) { - byte brightnessByte = (byte)(brightness * 85.333); + SetCustom(Enumerable.Repeat((byte)(brightness * 85.333), 7).ToArray()); + } + + public void SetCustom(byte[] data) + { Set(Packet(0xD2, 0x02, 0x01, 0x08, 0xAC), "Static"); Set(Packet(0xD3, 0x03, 0x01, 0x08, 0xAC, 0xFF, 0xFF, 0x01, 0x05, 0xFF, 0xFF), "StaticSettings"); Set(Packet(0xD4, 0x00, 0x00, 0x01, 0xAC), "StaticSave"); - Set(Packet(0xD3, 0x00, 0x00, 0x07, brightnessByte, brightnessByte, brightnessByte, brightnessByte, brightnessByte, brightnessByte, brightnessByte), "Static White"); + byte[] payload = new byte[] { 0xD3, 0x00, 0x00, 0x07 }; + Set(Packet(payload.Concat(data.Take(7)).ToArray()), "Static Data"); } public void SetOptions(bool status, int brightness = 0, int interval = 0)