Skip to content

Commit 06d08af

Browse files
committed
HDR Color Control support #4615
1 parent 7ab74e1 commit 06d08af

File tree

4 files changed

+58
-7
lines changed

4 files changed

+58
-7
lines changed

app/AsusACPI.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public class AsusACPI
8484
public const uint ScreenMiniled1 = 0x0005001E;
8585
public const uint ScreenMiniled2 = 0x0005002E;
8686
public const uint ScreenFHD = 0x0005001C;
87+
public const uint ScreenHDRControl = 0x00050071;
8788

8889
public const uint ScreenOptimalBrightness = 0x0005002A;
8990
public const uint ScreenInit = 0x00050011; // ?

app/Display/ScreenControl.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ public static void ToogleFHD()
122122
}
123123
}
124124

125+
public static void ToogleHDRControl()
126+
{
127+
int hdrControl = Program.acpi.DeviceGet(AsusACPI.ScreenHDRControl);
128+
Logger.WriteLine($"HDR Control Toggle: {hdrControl}");
129+
Program.acpi.DeviceSet(AsusACPI.ScreenHDRControl, (hdrControl == 1) ? 0 : 1, "HDR Control");
130+
InitScreen();
131+
}
132+
125133
public static string ToogleMiniled()
126134
{
127135
int miniled1 = Program.acpi.DeviceGet(AsusACPI.ScreenMiniled1);
@@ -213,6 +221,9 @@ public static void InitScreen()
213221
fhd = Program.acpi.DeviceGet(AsusACPI.ScreenFHD);
214222
}
215223

224+
int hdrControl = Program.acpi.DeviceGet(AsusACPI.ScreenHDRControl);
225+
if (hdrControl >= 0) Logger.WriteLine($"HDR Color Control: {hdrControl}");
226+
216227
AppConfig.Set("frequency", frequency);
217228
AppConfig.Set("overdrive", overdrive);
218229

@@ -228,7 +239,8 @@ public static void InitScreen()
228239
miniled1: miniled1,
229240
miniled2: miniled2,
230241
hdr: hdr,
231-
fhd: fhd
242+
fhd: fhd,
243+
hdrControl: hdrControl
232244
);
233245
});
234246

app/Settings.Designer.cs

Lines changed: 29 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/Settings.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ public SettingsForm()
166166
buttonScreenAuto.Click += ButtonScreenAuto_Click;
167167
buttonMiniled.Click += ButtonMiniled_Click;
168168
buttonFHD.Click += ButtonFHD_Click;
169+
buttonHDRControl.Click += ButtonHDRControl_Click;
169170

170171
buttonQuit.Click += ButtonQuit_Click;
171172

@@ -319,6 +320,11 @@ private void ButtonFHD_Click(object? sender, EventArgs e)
319320
ScreenControl.ToogleFHD();
320321
}
321322

323+
private void ButtonHDRControl_Click(object? sender, EventArgs e)
324+
{
325+
ScreenControl.ToogleHDRControl();
326+
}
327+
322328
private void SliderBattery_ValueChanged(object? sender, EventArgs e)
323329
{
324330
VisualiseBatteryTitle(sliderBattery.Value);
@@ -1281,7 +1287,7 @@ private void ButtonMiniled_Click(object? sender, EventArgs e)
12811287

12821288

12831289

1284-
public void VisualiseScreen(bool screenEnabled, bool screenAuto, int frequency, int maxFrequency, int overdrive, bool overdriveSetting, int miniled1, int miniled2, bool hdr, int fhd)
1290+
public void VisualiseScreen(bool screenEnabled, bool screenAuto, int frequency, int maxFrequency, int overdrive, bool overdriveSetting, int miniled1, int miniled2, bool hdr, int fhd, int hdrControl)
12851291
{
12861292

12871293
ButtonEnabled(button60Hz, screenEnabled);
@@ -1365,6 +1371,14 @@ public void VisualiseScreen(bool screenEnabled, bool screenAuto, int frequency,
13651371
buttonMiniled.Visible = false;
13661372
}
13671373

1374+
if (hdr && hdrControl >= 0)
1375+
{
1376+
buttonMiniled.Visible = false;
1377+
buttonHDRControl.Visible = true;
1378+
buttonHDRControl.Activated = hdrControl > 0;
1379+
buttonHDRControl.BorderColor = colorTurbo;
1380+
}
1381+
13681382
if (hdr) labelVisual.Text = Properties.Strings.VisualModesHDR;
13691383
if (!screenEnabled) labelVisual.Text = Properties.Strings.VisualModesScreen;
13701384

0 commit comments

Comments
 (0)