diff --git a/app/Ally/AllyControl.cs b/app/Ally/AllyControl.cs index d2141814b..b29d26818 100644 --- a/app/Ally/AllyControl.cs +++ b/app/Ally/AllyControl.cs @@ -347,6 +347,7 @@ private void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e) if (!autoTDP && _mode != ControllerMode.Auto) return; float fps = amdControl.GetFPS(); + int? usage = 0; if (autoTDP && fpsLimit > 0 && fpsLimit <= 120) { @@ -377,7 +378,8 @@ private void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e) if (_mode == ControllerMode.Auto) { - ControllerMode newMode = (fps > 0) ? ControllerMode.Gamepad : ControllerMode.Mouse; + if (fps > 0) usage = amdControl.GetiGpuUse(); + ControllerMode newMode = (fps > 0 && usage > 15) ? ControllerMode.Gamepad : ControllerMode.Mouse; if (_applyMode != newMode) _autoCount++; else _autoCount = 0; @@ -386,7 +388,7 @@ private void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e) { _autoCount = 0; ApplyMode(newMode); - Logger.WriteLine($"Controller Mode {fps}: {newMode}"); + Logger.WriteLine($"Controller Mode (FPS={fps}, USAGE={usage}%): {newMode}"); } } diff --git a/app/AnimeMatrix/AniMatrixControl.cs b/app/AnimeMatrix/AniMatrixControl.cs index 3c897461c..eef3714ee 100644 --- a/app/AnimeMatrix/AniMatrixControl.cs +++ b/app/AnimeMatrix/AniMatrixControl.cs @@ -111,8 +111,6 @@ public void SetSlash(bool wakeUp = false) deviceSlash.SetEnabled(true); deviceSlash.Init(); - deviceSlash.SetLidMode(false); - switch ((SlashMode)running) { case SlashMode.Static: @@ -150,6 +148,11 @@ public void SetLidMode(bool force = false) { bool matrixLid = AppConfig.Is("matrix_lid"); + if (deviceSlash is not null) + { + deviceSlash.SetLidMode(!matrixLid); + } + if (matrixLid || force) { Logger.WriteLine($"Matrix LidClosed: {lidClose}"); diff --git a/app/AnimeMatrix/SlashDevice.cs b/app/AnimeMatrix/SlashDevice.cs index 936e0dbc2..0688f4f89 100644 --- a/app/AnimeMatrix/SlashDevice.cs +++ b/app/AnimeMatrix/SlashDevice.cs @@ -209,7 +209,7 @@ public void SetBatterySaver(bool status) public void SetLidMode(bool status) { - Set(CreatePacket([0xD8, 0x00, 0x00, 0x02, 0xA5, status ? (byte)0x80 : (byte)0x00]), $"DisableLidClose {status}"); + Set(CreatePacket([0xD8, 0x00, 0x00, 0x02, 0xA5, status ? (byte)0x80 : (byte)0x00]), $"SlashLidCloseAnimation {status}"); } public void SetSleepActive(bool status) diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 9023132e2..eca94356d 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -411,7 +411,7 @@ public static bool IsDUO() // G14 2020 has no aura, but media keys instead public static bool NoAura() { - return (ContainsModel("GA401I") && !ContainsModel("GA401IHR")) || ContainsModel("HN7306"); + return (ContainsModel("GA401I") && !ContainsModel("GA401IHR")) || ContainsModel("GA502IU") || ContainsModel("HN7306"); } public static bool MediaKeys() @@ -421,7 +421,7 @@ public static bool MediaKeys() public static bool IsSingleColor() { - return ContainsModel("GA401") || ContainsModel("FX517Z") || ContainsModel("FX516P") || ContainsModel("X13") || IsARCNM() || ContainsModel("GA502IU") || ContainsModel("FA617N") || ContainsModel("FA617X") || NoAura(); + return ContainsModel("GA401") || ContainsModel("FX517Z") || ContainsModel("FX516P") || ContainsModel("X13") || IsARCNM() || ContainsModel("FA617N") || ContainsModel("FA617X") || NoAura(); } public static bool IsSlash() @@ -691,4 +691,9 @@ public static bool IsForceMiniled() return ContainsModel("G834JYR") || Is("force_miniled"); } + public static bool SaveDimming() + { + return Is("save_dimming"); + } + } diff --git a/app/Battery/BatteryControl.cs b/app/Battery/BatteryControl.cs index b15498dee..152d821ea 100644 --- a/app/Battery/BatteryControl.cs +++ b/app/Battery/BatteryControl.cs @@ -38,7 +38,8 @@ public static void SetBatteryChargeLimit(int limit = -1) if (AppConfig.IsChargeLimit6080()) { - if (limit > 80) limit = 100; + if (limit > 85) limit = 100; + else if (limit >= 80) limit = 80; else if (limit < 60) limit = 60; } diff --git a/app/Display/ColorProfileHelper.cs b/app/Display/ColorProfileHelper.cs index b43d078c2..f838ac36b 100644 --- a/app/Display/ColorProfileHelper.cs +++ b/app/Display/ColorProfileHelper.cs @@ -13,19 +13,28 @@ public static class ColorProfileHelper var profiles = new Dictionary() { {"FA_Series", "2177-APOR41-de476ec68578c865e886ef6872aa56ee.zip"}, + {"FA401UI", "19767-N39QWK-05990dae2bf601e9db8b998bfad49f57.zip"}, + {"FA401UU", "19768-K9LFCV-5224d6f68051d884a3adaa588e6300c3.zip"}, + {"FA401UV", "19769-8MSQD6-d06ff0a176407b4eaeed468a3bff2bc1.zip"}, + {"FA401WI", "19937-J3GRCD-e37d8c1557b9f11d8fb493a78b50fe2d.zip"}, + {"FA401WU", "19938-5PIL7F-a3c8522c89e03fc25e2f7290ee5c5f22.zip"}, + {"FA401WV", "19939-KIX4CK-3462e49f2c6388228b427b85332538b7.zip"}, {"FA506IC", "7822-ZGQ1KC-bc80be3be7ca585bef60f526b6461c86.zip"}, {"FA506ICB", "13914-2HYCD7-95fabfe5669a204620517f0158c0cea1.zip"}, {"FA506IE", "7828-57N8GH-9fe07a7e4ebde12a8d4682d3ffa66fe4.zip"}, {"FA506IEB", "14661-ZYWH5T-3b45ebeb7fca81d98796d5960e11226c.zip"}, {"FA506IH", "3407-VZBOUN-8a12385fa46e077010677d330e9320d5.zip"}, {"FA506IHR", "7823-15HGA0-44d621a3c0f0dd2c407f67d262871be0.zip"}, + {"FA506IHRB", "19343-MBMUPH-190cdb28402ba8efd3e11561c9b2eeb9.zip"}, {"FA506II", "3410-9ZXQO2-aa08794537699c5dbfcca49b63fb7f8d.zip"}, {"FA506IM", "7824-EKKW9A-21c7e073a81fc868b78e605b17290839.zip"}, {"FA506IR", "7825-G6XND9-c16ea7e98b58e878c61d1071b100ee60.zip"}, {"FA506IU", "3413-AMCR39-2a8b889a8810da4e8692f87e1ae3ea2c.zip"}, {"FA506IV", "3415-VA0CJ6-266febe84bcecc5ed89fdc286f444ce2.zip"}, {"FA506NC", "18359-BM2XCN-3ca9de427310b05afa92dcbe1babf947.zip"}, + {"FA506NCR", "19230-KJ866Z-1980e6f6a843b6b31111e38973fa1cda.zip"}, {"FA506NF", "18361-CU7H6I-55beba8445b9aa0fe9cbeb8ec9a47ccf.zip"}, + {"FA506NFR", "19231-GARR16-f7052f6be62ddce2048ebcd6ba808563.zip"}, {"FA506QC", "7829-LBYY5U-b14343c260b738563b69ad0e4f4b88d1.zip"}, {"FA506QE", "7827-75P3DP-b664f4da04e77ed1faa722bf0c781d82.zip"}, {"FA506QM", "9440-87VQKP-48357026f1f3099cfed1161a320587f0.zip"}, @@ -33,9 +42,9 @@ public static class ColorProfileHelper {"FA507NI", "14451-N6AX9R-0bc8e15be5cf889c755aaa7052f6fee8.zip"}, {"FA507NJ", "14454-QXKHOE-d28f2eb001f9b7ce0582cbe33961a6ad.zip"}, {"FA507NU", "14452-EZXLVF-c64dd3d7efede78df653b029888d9d04.zip"}, - {"FA507NUR", "18871-WR3YMP-6cbcd0502eb9bf200465e36c4de8c9fd.zip"}, + {"FA507NUR", "19358-JYO79G-f8bc53beeadfdfef80dc6a4eb85c69e2.zip"}, {"FA507NV", "14453-VC333P-41549f64788d59c9711eccec892fa8c1.zip"}, - {"FA507NVR", "18872-HVR4UY-220dc7f3f73cf12b2af2505db6ce67ab.zip"}, + {"FA507NVR", "19359-YWEAES-37feeb146db89c3549bac528d67ae209.zip"}, {"FA507RC", "11448-0TRT8V-7712eb9302300dd82815027efbbe4787.zip"}, {"FA507RE", "11449-ONC7VG-a7ac70468292336f63532c21204d69d4.zip"}, {"FA507RF", "14311-X72FIU-66bf16069a82bdf2cc09f8b92cb25c67.zip"}, @@ -50,17 +59,24 @@ public static class ColorProfileHelper {"FA507XJ", "14820-8RT0TF-9d341fae2a290494206deb5fcf1fd427.zip"}, {"FA507XU", "14818-3PA2GD-2d1e2d035309ec7282a1c47e27f7c7fd.zip"}, {"FA507XV", "14819-ET4L73-daf905274776ae9c92a7b74e687dc63d.zip"}, - {"FA607PI", "17579-FL63B4-df08bf92fe3c156ce738e43de7824d65.zip"}, - {"FA607PU", "17580-WM413K-eff7721ca9ec5b633ef196dbfcd58ff2.zip"}, - {"FA607PV", "17581-JNXO2Q-15d026a4ae630d44b28c18aee0a99e51.zip"}, + {"FA607NU", "20567-VB45RR-ceeec88490fec992f2f8948ece38952e.zip"}, + {"FA607NUR", "20570-XEDISK-5e1220f6a19492a3e6319697497deaa3.zip"}, + {"FA607PI", "19157-PL5PW6-2fde4880a46a6b7357d96eaa7a4ec946.zip"}, + {"FA607PU", "19158-AWQ1FA-f1ed2d008bef71741a9b09b35730b9e7.zip"}, + {"FA607PV", "19159-V6UKPP-92f56a3aa89b834d1ab12f229a8ae1a7.zip"}, {"FA607RC", "10190-XHDRTQ-0e6c248e3dab6bb07e052edd963c5218.zip"}, {"FA607RE", "10194-AF495K-23a4d74be5132e4babc64bb13237a12b.zip"}, {"FA607RH", "10191-9BS333-c6deb5f9fd5a37d446d2722da54c0ec3.zip"}, {"FA607RM", "10195-4U5EEF-cf98d168cacdd5a60782e881a9c143be.zip"}, {"FA607RR", "10193-FYX2N7-730c76e49ef71a6164804eafd2621dab.zip"}, {"FA607RW", "10192-UFOOP3-f52a50dac189ffa96560f73e04c53a6c.zip"}, - {"FA617NS", "15967-YKHJ0B-89095e43578e64c160d2952bb14513f2.zip"}, - {"FA617NT", "15970-C1BW39-2ef1c5d5d9a967cf2fc1f511d3db3a43.zip"}, + {"FA608WI", "20103-UE0O65-d6707b2a2f666d671d728661c981883a.zip"}, + {"FA608WU", "20102-IQVJL2-edc900ffe25635856729d26dbeac272f.zip"}, + {"FA608WV", "20104-EE3Q5U-a7695b4d1668b1a8dda2576f64bffad2.zip"}, + {"FA617NS", "20225-0J8FEF-cb6ef3732560ed38542d5047e78596f0.zip"}, + {"FA617NSR", "20226-B5TAVP-f153443e85ccad055fa12d58eec69c5c.zip"}, + {"FA617NT", "20224-YN6NKP-1d0e927ae5c1bb7d15e36b63176460e2.zip"}, + {"FA617NTR", "20227-KL8UNI-2b4063b7a52b142fb75e9136570afbf9.zip"}, {"FA617XS", "15968-Y9NFXN-cb420fe6e177fc1cf675e9d42a6fd0ea.zip"}, {"FA617XT", "15969-UKYP5L-ad54051ebbad4b17693b65f5bceda799.zip"}, {"FA706IC", "5215-5J3H5Y-d2cdc2f5e03d68e5e5e562581a77c8e6.zip"}, @@ -72,6 +88,7 @@ public static class ColorProfileHelper {"FA706IR", "8825-63J2NY-2496ecf21b5fa71e65671531b670cdac.zip"}, {"FA706IU", "2608-EI64MF-64c35bda7789e6e71298e22d793b78d4.zip"}, {"FA706NF", "18362-1V7Z1Z-0bc79f01bdfadc5b39342fba622a5b8d.zip"}, + {"FA706NFR", "19232-FE6TXN-d062445db610ce901453145ebc518efe.zip"}, {"FA706QC", "8826-032S4E-868933565b1a7d762bda8cafc1e77458.zip"}, {"FA706QE", "8824-KZNJL9-9d827f4973d4c9787ff050dc1bf35eef.zip"}, {"FA706QM", "8830-6NX7U4-b7bbfe663aa954534d33d2f822181728.zip"}, @@ -79,7 +96,9 @@ public static class ColorProfileHelper {"FA707NI", "14455-19J6WZ-10282c6083ee018a614e75bc809ecf1f.zip"}, {"FA707NJ", "14457-BGJD0K-d963ff94009c9a2a5b99606eac711a95.zip"}, {"FA707NU", "14456-VAZ4LS-1d798d3873c55e9d10b43a3f2b12cd15.zip"}, + {"FA707NUR", "20568-IPF4CY-f7bd11b80ffa20b77b75e6a89213db48.zip"}, {"FA707NV", "14458-7G8B40-08117ddb45ed3c6978aa4ad60e3d2c96.zip"}, + {"FA707NVR", "20569-1MFNC4-e41979f29c26628eacf1e9067dd3544d.zip"}, {"FA707RC", "10196-81D3O0-94ccf4d908c9bcb44f8f9092ef9fa2e2.zip"}, {"FA707RE", "10200-AUS9AW-7f366055be2ae2b4c659aa9590bb4d5e.zip"}, {"FA707RF", "14312-6KGU80-09ba6d3e3b490c3d1dce3d16df62cd8a.zip"}, @@ -92,6 +111,9 @@ public static class ColorProfileHelper {"FA707XJ", "14823-MX6CGK-0d0862cd441f96a72b1c8baeaa8aa3b4.zip"}, {"FA707XU", "14824-O2LZZA-f0ea2bf54bbc4fd4e7391048f4a083e4.zip"}, {"FA707XV", "14825-DUSKD1-7d0a055d869a7366105380c44788724b.zip"}, + {"FA808WI", "19512-TZ3G4D-60c6849ce49cca1d2177f31ead77df5a.zip"}, + {"FA808WU", "19510-ASGCD8-0558641c1b976b901c52d1d72f0bddd7.zip"}, + {"FA808WV", "19511-QDVPAJ-f3990996e7a9c0d472b46af286d529f1.zip"}, {"FX_Series", "2174-J1XJKV-bd932ade5eebb0b2f1a36eac85bc5c7d.zip"}, {"FX505DD", "3439-CJLCNE-3df3a90619c571de2917a35a402fe6cb.zip"}, {"FX505DT", "3427-H77L9I-2f3f50fbbb1dc4ac6e703b2820acb491.zip"}, @@ -143,15 +165,18 @@ public static class ColorProfileHelper {"FX517ZM", "13759-694BOG-7b8f61a1d8a387715721fd2b8e0bd766.zip"}, {"FX517ZR", "11463-MCHEWS-7a732705aea49eb663fe1e8930c463de.zip"}, {"FX517ZW", "11464-S41ORA-d99633ecf421ba4ab73800bc9ebf2e5b.zip"}, - {"FX607JI", "17739-YJBJMA-59c984b28eeb6c02498190f768b12b52.zip"}, - {"FX607JIR", "17740-78V0QP-43bf1ea30f94d3d3a286f42dd90a1816.zip"}, - {"FX607JU", "17744-JEFX0I-f1ee2104c17a5cc511efefa3dc7b9601.zip"}, - {"FX607JUR", "17743-A2JS5H-224a1f32f7dbfecb0d6b91fdb6ffac8e.zip"}, - {"FX607JV", "17741-OWALZC-eb293a03c7b4595270939bccfe891656.zip"}, - {"FX607JVR", "17742-3OOC7N-f28635b55ce56f9e32672b2e409a075c.zip"}, + {"FX607JI", "19085-6NMHTY-9137eab4a853f284c0ac1f8890735c7b.zip"}, + {"FX607JIR", "19088-H9SUHL-c75a1547f17e7c69e0a870425d3592b8.zip"}, + {"FX607JU", "19086-N1S5J4-c4fc8458bcbefa107fc1c2e1dbe44255.zip"}, + {"FX607JUR", "19087-ZBS95F-bc3055487fdc07870c12341042a37222.zip"}, + {"FX607JV", "19089-LLP8ZE-c52cc4765390eba2eae3c798a367df25.zip"}, + {"FX607JVR", "19090-XQYJEH-a5aaa078def637077c4d1d3a619ae198.zip"}, + {"FX607VB", "20704-FGKI8R-ac8a18cb35a009bcdb6d18ec7537879a.zip"}, + {"FX607VF", "20706-OMC7L2-e66289430eb7decd16fe4c6353edb8c4.zip"}, {"FX607VI", "14072-0Z0LX5-c3145816b5c9b045a3e829e194425624.zip"}, {"FX607VJ", "14073-H1KA78-95472184994955393ebf635af4a55c71.zip"}, - {"FX607VU", "14074-RCMD10-b606bf5fd03bdf6a8aef412202de86ff.zip"}, + {"FX607VU", "20707-N1HJ0V-31f1da0a565763c625714c39b7bb5bae.zip"}, + {"FX607VUR", "20705-ON83H2-dd9e78d43fb57f06d0e8ef0d9d1e849e.zip"}, {"FX607VV", "14075-BX4NJX-a9e24be091f08e6cc3885397f143bdc5.zip"}, {"FX607ZC", "9267-SQXQMT-edf1ee77d7f276d9b2f14fbe80e86459.zip"}, {"FX607ZE", "9268-MI06A0-5f60b76f497adb2c80dc5d34e7ca00ef.zip"}, @@ -237,14 +262,14 @@ public static class ColorProfileHelper {"G533ZX", "11729-XNFMPR-e0aad4e4d4956dba8629f419b1f86026.zip"}, {"G614JF", "14496-NAATJZ-a3847e890e57aa749645b854b28ead79.zip"}, {"G614JI", "14168-4VTU0U-37decb2df809672eccf1156769eda929.zip"}, - {"G614JIR", "18120-52TT5M-28a5c8e138ed1660e9eadc81121f789a.zip"}, + {"G614JIR", "19126-IMXGO5-4cce9f45ad28fa60d016f8d212c50b10.zip"}, {"G614JJ", "14497-P0D5PL-abe178509e0316da9ee56b24e15d0384.zip"}, {"G614JU", "14498-5D71EB-2300be03087494ee34356470ca022b7c.zip"}, {"G614JV", "14500-SPJCAL-a8e2e223857c334ba4c20c8122151bb7.zip"}, - {"G614JVR", "18121-2WOF0H-4e7045c7a210693fef2b99b8e032316b.zip"}, + {"G614JVR", "19129-EA1WB4-4666564ee013c4df53be44bcdd20bec0.zip"}, {"G614JZ", "18199-P9WWOH-093d361358629a2bddd5bff7b5fb7a5f.zip"}, {"G634JY", "14163-JLRBOO-8ea519425efe56cc144e38d22cebd3f0.zip"}, - {"G634JYR", "18087-6Z1W8Q-cd92004b6b9392e2cf07317db8ca9c6d.zip"}, + {"G634JYR", "19130-MUAT65-0eced7ca55a61cc41341faa3a48d34f3.zip"}, {"G634JZ", "15827-MSW5I1-0f39e92313e54afe3e35f5636dc37fd5.zip"}, {"G634JZR", "17891-O7PAGL-5c6e6d059ff7bc1b9245fdf8a8066263.zip"}, {"G703GX", "105-NMT9XG-76a0810ddf16ee376fa049bd179377fc.zip"}, @@ -297,15 +322,15 @@ public static class ColorProfileHelper {"G733ZW", "10080-HY42QH-aa285046069cfe113953b91f1a28d101.zip"}, {"G733ZX", "10082-JS5F1Y-41bccc831aec7bf1c0a59a309bc607c7.zip"}, {"G814JI", "18243-BAU912-671afb033d3b1c44f9852ff608910f42.zip"}, - {"G814JIR", "17315-02XE3O-7a00ed5b91bc305aade5a1830691d0d6.zip"}, + {"G814JIR", "19802-1CGBPH-f1d31bab157b36d109e1e10591d49f4b.zip"}, {"G814JU", "18193-Y5GMF0-843cee9ed982a3d5aba21e99efbc396c.zip"}, {"G814JV", "18194-9Q537I-c5c2ca782d26dcd5346c110767347903.zip"}, - {"G814JVR", "17313-P6P61Y-5960dc1d0bd8ba2057bc22aaa8bf89e5.zip"}, + {"G814JVR", "19801-JK7M4V-617e0c975bf6e2a6f67802d825fa6aa4.zip"}, {"G814JZ", "18195-V98WBX-19d4c2e52916bf9c96fcaed6f1d9bdda.zip"}, {"G834JY", "15954-HAV3KR-d219c43750d485279e12cf76f5b2569b.zip"}, - {"G834JYR", "17314-YYBQF3-a65b1bc3fd1e8de145dc9d606e8c45c8.zip"}, + {"G834JYR", "19121-GX7FZU-7c449cf7db0033db75da0f4a464ee4d9.zip"}, {"G834JZ", "15953-C7XC62-a987058c0a26fa3c929b300d099296a5.zip"}, - {"G834JZR", "17316-AFT379-743360d9b36031d91a72fe03e3fafca0.zip"}, + {"G834JZR", "19122-CAYURL-f71108b839d923ae92f3f83451ddfa69.zip"}, {"GA401IC", "5864-KC8TTP-082f9a62dda322ccaed82ff3e3466bf8.zip"}, {"GA401IE", "5866-JO8504-dde5402bdecafc1cef55a7dc3d6167ec.zip"}, {"GA401IHR", "5865-7DV6TB-9833a54c7334dc3aef1b9e99f56b9e95.zip"}, @@ -333,9 +358,9 @@ public static class ColorProfileHelper {"GA402XV", "14902-EL34M9-731ba1cc0d27d2db9a79d872673e7958.zip"}, {"GA402XY", "14903-ICC56W-0456739d8ba5ee543dfba99eb6ad217a.zip"}, {"GA402XZ", "14904-B3K2NR-928b7272790e7da0079c549cd4885d5d.zip"}, - {"GA403UI", "18084-XTMSW5-6cad333378f3b1059688a419a8422fc1.zip"}, - {"GA403UU", "18086-WXV037-ad90bc3f20ff056c45dbbb848fa72a67.zip"}, - {"GA403UV", "18085-G56QVI-3f24b5bd1eaa8dd9086b86092cb62ffb.zip"}, + {"GA403UI", "19112-NB8TJ1-e1de0121e30431cc5520ea6eccb6e46f.zip"}, + {"GA403UU", "19113-C86SAH-4338dac48ad593c4079515b7599b8943.zip"}, + {"GA403UV", "19114-6KR0FP-4740ed98a2ca06bc26c363de380a037d.zip"}, {"GA502II", "3554-REAPZQ-5f94c7ecd52ae2cad50aaac4341bec7b.zip"}, {"GA502IU", "3555-15UWZ4-d1cd040265773efd61bdfd146140a990.zip"}, {"GA502IV", "3556-ULLH3K-1f56134e43e1ffa353256fbeb9840d3f.zip"}, @@ -356,6 +381,9 @@ public static class ColorProfileHelper {"GA503RS", "11745-689QTC-6c441a7161a34b871918fce5997c4e2e.zip"}, {"GA503RW", "12055-SG6VTH-91cc5782da63cf3dcc16804a47db25a2.zip"}, {"GA503RX", "12056-MR9J0D-b7dad63f751d2e53aeee479524986bdd.zip"}, + {"GA605WI", "20014-K4K912-2a2e5a66fac3cc97fb13394a189bd75e.zip"}, + {"GA605WU", "20015-HJM11B-a724c1fe216b73c0b3b24475047f4615.zip"}, + {"GA605WV", "20016-BWVQPK-01624c1cdd5a3c05252bad472fab1240.zip"}, {"GL_Series", "2167-P7ELNB-44d357ee720a0c48c2eb37eee785316c.zip"}, {"GL503GE", "57-YI7HPS-9ed36ba45ff6398f3648a44ced4e5e61.zip"}, {"GL504GM", "58-JOZ3S5-998677afd41375cb8fd60ace8d11a788.zip"}, @@ -395,11 +423,11 @@ public static class ColorProfileHelper {"GU604VI", "14284-R38BM3-e2591bfa2582ce68b2c8aba63beac5e3.zip"}, {"GU604VY", "14282-78N7V4-25e76896744c53317fa41a80788a2241.zip"}, {"GU604VZ", "14283-U4JX5C-f31dff75d52f48ceca0102fd1bc76e31.zip"}, - {"GU605MI", "17935-R3OAJH-55a4fbb2be67a37226accd279357268b.zip"}, - {"GU605MU", "17936-VBZ5PL-ad3a380f62bc87ee738c09c8e5255f91.zip"}, - {"GU605MV", "17938-7DGM0T-caed792b162e94846167888f36fc632e.zip"}, - {"GU605MY", "17937-HZWNQ4-72d9c4fed1b31f188874cd6461ffba83.zip"}, - {"GU605MZ", "17939-IEJ2X5-fe077100dc4eafbae46d7eb831a791a8.zip"}, + {"GU605MI", "19271-93QRMU-eab4115ee09fb9bbd86facec08a822a1.zip"}, + {"GU605MU", "19272-RDZDEJ-4380e52eab6a3742613c2f694a19da1e.zip"}, + {"GU605MV", "19274-1T9PKS-d05273f430d255ad1779cf6a7eb57db3.zip"}, + {"GU605MY", "19273-F4A493-2bc9083d99e7827b4580311d34f8998b.zip"}, + {"GU605MZ", "19275-52DG5X-1072d6f4fdc5b9cbb304da7146f05a79.zip"}, {"GV301QC", "5128-RN42GR-9a6049e7adabd1ff2aeed24293fe03a8.zip"}, {"GV301QCZ", "6778-152PHS-7a9ad124aef1059471542dfc8912ed7b.zip"}, {"GV301QE", "5125-PD15GR-9a7f72cbf5bd97d283464d8e407f0231.zip"}, @@ -486,6 +514,7 @@ public static class ColorProfileHelper {"NR2301L", "14736-3DM4T5-41c1b0b5c2d726da7c66e0c39ea08017.zip"}, {"RC71L", "17126-IIDPFS-718c077a118724bb0045b35e30d5ac4e.zip"}, {"RC71X", "15182-KWVC62-c754d9ea39f9160df7e21e4538ce60df.zip"}, + {"RC72LA", "19770-DOSUSI-85f700513af330af6e20fcfdabaeb87f.zip"}, }; if (profiles.ContainsKey(model)) diff --git a/app/Display/VisualControl.cs b/app/Display/VisualControl.cs index d1bb0f7fa..729a45805 100644 --- a/app/Display/VisualControl.cs +++ b/app/Display/VisualControl.cs @@ -44,6 +44,7 @@ public static class VisualControl private static int _brightness = 100; private static bool _init = true; + private static bool _download = true; private static string? _splendidPath = null; private static System.Timers.Timer brightnessTimer = new System.Timers.Timer(200); @@ -211,9 +212,19 @@ public static void SetGamut(int mode = -1) AppConfig.Set("gamut", mode); - if (RunSplendid(SplendidCommand.GamutMode, 0, mode)) return; - - if (_init) + var result = RunSplendid(SplendidCommand.GamutMode, 0, mode); + if (result == 0) return; + if (result == -1) + { + Logger.WriteLine("Gamut setting refused, reverting."); + RunSplendid(SplendidCommand.GamutMode, 0, (int)GetDefaultGamut()); + if (ProcessHelper.IsUserAdministrator() && _download) + { + _download = false; + ColorProfileHelper.InstallProfile(); + } + } + if (result == 1 && _init) { _init = false; RunSplendid(SplendidCommand.Init); @@ -253,9 +264,19 @@ public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int break; } - if (RunSplendid(mode, 0, balance)) return; - - if (_init) + var result = RunSplendid(mode, 0, balance); + if (result == 0) return; + if (result == -1) + { + Logger.WriteLine("Visual mode setting refused, reverting."); + RunSplendid(SplendidCommand.Default, 0, DefaultColorTemp); + if (ProcessHelper.IsUserAdministrator() && _download) + { + _download = false; + ColorProfileHelper.InstallProfile(); + } + } + if (result == 1 && _init) { _init = false; RunSplendid(SplendidCommand.Init); @@ -288,7 +309,7 @@ private static string GetSplendidPath() return _splendidPath; } - private static bool RunSplendid(SplendidCommand command, int? param1 = null, int? param2 = null) + private static int RunSplendid(SplendidCommand command, int? param1 = null, int? param2 = null) { var splendid = GetSplendidPath(); bool isVivo = AppConfig.IsVivoZenPro(); @@ -298,10 +319,11 @@ private static bool RunSplendid(SplendidCommand command, int? param1 = null, int { if (command == SplendidCommand.DimmingVisual && isVivo) command = SplendidCommand.DimmingVivo; var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2); - if (result.Contains("file not exist") || (result.Length == 0 && !isVivo)) return false; + if (result.Contains("file not exist") || (result.Length == 0 && !isVivo)) return 1; + if (result.Contains("return code: -1")) return -1; } - return true; + return 0; } private static void BrightnessTimerTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e) @@ -309,28 +331,46 @@ private static void BrightnessTimerTimer_Elapsed(object? sender, System.Timers.E brightnessTimer.Stop(); - if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return; + if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6)) == 0) return; if (_init) { _init = false; RunSplendid(SplendidCommand.Init); RunSplendid(SplendidCommand.Init, 4); - if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6))) return; + if (RunSplendid(SplendidCommand.DimmingVisual, 0, (int)(40 + _brightness * 0.6)) == 0) return; } // GammaRamp Fallback SetGamma(_brightness); } + public static void InitBrightness() + { + if (!AppConfig.IsOLED()) return; + if (!AppConfig.SaveDimming()) return; + + int brightness = GetBrightness(); + if (brightness >= 0) SetBrightness(brightness); + } + + private static bool IsOnBattery() + { + return AppConfig.SaveDimming() && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online; + } + + public static int GetBrightness() + { + return AppConfig.Get(IsOnBattery() ? "brightness_battery" : "brightness", 100); + } + public static int SetBrightness(int brightness = -1, int delta = 0) { if (!AppConfig.IsOLED()) return -1; - - if (brightness < 0) brightness = AppConfig.Get("brightness", 100); + if (brightness < 0) GetBrightness(); _brightness = Math.Max(0, Math.Min(100, brightness + delta)); - AppConfig.Set("brightness", _brightness); + AppConfig.Set(IsOnBattery() ? "brightness_battery" : "brightness", _brightness); brightnessTimer.Start(); diff --git a/app/Extra.cs b/app/Extra.cs index 41e985631..83f20cc3e 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -76,7 +76,8 @@ private void SetKeyCombo(ComboBox combo, TextBox txbox, string name) customActions.Remove("fnlock"); break; case "fnv": - customActions[""] = EMPTY; + customActions[""] = Properties.Strings.VisualMode; + customActions.Remove("visual"); break; case "fne": customActions[""] = "Calculator"; diff --git a/app/GHelper.csproj b/app/GHelper.csproj index 03e857d87..1a35a08f5 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.187 + 0.191 diff --git a/app/Gpu/AMD/AmdGpuControl.cs b/app/Gpu/AMD/AmdGpuControl.cs index e10bf1916..3f774203f 100644 --- a/app/Gpu/AMD/AmdGpuControl.cs +++ b/app/Gpu/AMD/AmdGpuControl.cs @@ -119,6 +119,18 @@ public AmdGpuControl() } + public int? GetiGpuUse() + { + if (_adlContextHandle == nint.Zero || _iGPU == null) return null; + if (ADL2_New_QueryPMLogData_Get(_adlContextHandle, ((ADLAdapterInfo)_iGPU).AdapterIndex, out ADLPMLogDataOutput adlpmLogDataOutput) != Adl2.ADL_SUCCESS) return null; + + ADLSingleSensorData gpuUsage = adlpmLogDataOutput.Sensors[(int)ADLSensorType.PMLOG_INFO_ACTIVITY_GFX]; + if (gpuUsage.Supported == 0) return null; + + return gpuUsage.Value; + + } + public int? GetGpuPower() { if (_adlContextHandle == nint.Zero || _iGPU == null) return null; diff --git a/app/Gpu/NVidia/NvidiaSmi.cs b/app/Gpu/NVidia/NvidiaSmi.cs index 826fd9582..b709f2009 100644 --- a/app/Gpu/NVidia/NvidiaSmi.cs +++ b/app/Gpu/NVidia/NvidiaSmi.cs @@ -41,7 +41,7 @@ public static int GetDefaultMaxGPUPower() public static int GetMaxGPUPower() { string output = RunNvidiaSmiCommand("--query-gpu=power.max_limit --format csv,noheader,nounits"); - output = output.Trim().Trim('\n', '\r'); + output = output.Trim().Trim('\n', '\r').Replace(".00","").Replace(",00", ""); if (float.TryParse(output, out float floatValue)) { diff --git a/app/Helpers/Startup.cs b/app/Helpers/Startup.cs index 41248fb91..db9ef02bb 100644 --- a/app/Helpers/Startup.cs +++ b/app/Helpers/Startup.cs @@ -1,12 +1,13 @@ using GHelper.Helpers; using Microsoft.Win32.TaskScheduler; -using System.Diagnostics; using System.Security.Principal; public class Startup { static string taskName = "GHelper"; + static string chargeTaskName = taskName + "Charge"; + static string strExeFilePath = Application.ExecutablePath.Trim(); public static bool IsScheduled() { @@ -32,7 +33,6 @@ public static void StartupCheck() { try { - string strExeFilePath = Application.ExecutablePath.Trim(); string action = task.Definition.Actions.FirstOrDefault()!.ToString().Trim(); if (!strExeFilePath.Equals(action, StringComparison.OrdinalIgnoreCase) && !File.Exists(action)) { @@ -41,41 +41,81 @@ public static void StartupCheck() UnSchedule(); Schedule(); } - } catch (Exception ex) + } + catch (Exception ex) { Logger.WriteLine($"Can't check startup task: {ex.Message}"); } + if (taskService.RootFolder.AllTasks.FirstOrDefault(t => t.Name == chargeTaskName) == null) ScheduleCharge(); + } } } - public static void Schedule() + public static void UnscheduleCharge() { + using (TaskService taskService = new TaskService()) + { + try + { + taskService.RootFolder.DeleteTask(chargeTaskName); + } + catch (Exception e) + { + Logger.WriteLine("Can't remove charge limit task: " + e.Message); + } + } + } - string strExeFilePath = Application.ExecutablePath; + public static void ScheduleCharge() + { if (strExeFilePath is null) return; - var userId = WindowsIdentity.GetCurrent().Name; + using (TaskDefinition td = TaskService.Instance.NewTask()) + { + td.RegistrationInfo.Description = "G-Helper Charge Limit"; + td.Triggers.Add(new BootTrigger()); + td.Actions.Add(strExeFilePath, "charge"); + + td.Principal.RunLevel = TaskRunLevel.LUA; + td.Principal.LogonType = TaskLogonType.S4U; + td.Principal.UserId = WindowsIdentity.GetCurrent().Name; + + td.Settings.StopIfGoingOnBatteries = false; + td.Settings.DisallowStartIfOnBatteries = false; + td.Settings.ExecutionTimeLimit = TimeSpan.Zero; + + try + { + TaskService.Instance.RootFolder.RegisterTaskDefinition(chargeTaskName, td); + Logger.WriteLine("Charge limit task scheduled: " + strExeFilePath); + } + catch (Exception e) + { + Logger.WriteLine("Can't create a charge limit task: " + e.Message); + } + } + } + + public static void Schedule() + { using (TaskDefinition td = TaskService.Instance.NewTask()) { td.RegistrationInfo.Description = "G-Helper Auto Start"; - td.Triggers.Add(new LogonTrigger { UserId = userId, Delay = TimeSpan.FromSeconds(1) }); + td.Triggers.Add(new LogonTrigger { UserId = WindowsIdentity.GetCurrent().Name, Delay = TimeSpan.FromSeconds(1) }); td.Actions.Add(strExeFilePath); - if (ProcessHelper.IsUserAdministrator()) + if (ProcessHelper.IsUserAdministrator()) td.Principal.RunLevel = TaskRunLevel.Highest; td.Settings.StopIfGoingOnBatteries = false; td.Settings.DisallowStartIfOnBatteries = false; td.Settings.ExecutionTimeLimit = TimeSpan.Zero; - Debug.WriteLine(strExeFilePath); - Debug.WriteLine(userId); - try { TaskService.Instance.RootFolder.RegisterTaskDefinition(taskName, td); @@ -87,8 +127,12 @@ public static void Schedule() else ProcessHelper.RunAsAdmin(); } + + Logger.WriteLine("Startup task scheduled: " + strExeFilePath); } + ScheduleCharge(); + } public static void UnSchedule() @@ -107,5 +151,7 @@ public static void UnSchedule() ProcessHelper.RunAsAdmin(); } } + + UnscheduleCharge(); } } diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index d1eccca1f..5658342bd 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -228,24 +228,31 @@ static void CustomKey(string configKey = "m3") } - static void SetBrightness(int delta) + static void SetBrightness(bool up, bool hotkey = false) { int brightness = -1; if (isTUF) brightness = ScreenBrightness.Get(); - if (AppConfig.SwappedBrightness()) delta = -delta; + if (AppConfig.SwappedBrightness() && !hotkey) up = !up; - Program.acpi.DeviceSet(AsusACPI.UniversalControl, delta > 0 ? AsusACPI.Brightness_Up : AsusACPI.Brightness_Down, "Brightness"); + int step = AppConfig.Get("brightness_step", 10); + if (step != 10) + { + Program.toast.RunToast(ScreenBrightness.Adjust(up ? step : -step) + "%", up ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown); + return; + } + + Program.acpi.DeviceSet(AsusACPI.UniversalControl, up ? AsusACPI.Brightness_Up : AsusACPI.Brightness_Down, "Brightness"); if (isTUF) { if (AppConfig.SwappedBrightness()) return; - if (delta < 0 && brightness <= 0) return; - if (delta > 0 && brightness >= 100) return; + if (!up && brightness <= 0) return; + if (up && brightness >= 100) return; Thread.Sleep(100); if (brightness == ScreenBrightness.Get()) - Program.toast.RunToast(ScreenBrightness.Adjust(delta) + "%", (delta < 0) ? ToastIcon.BrightnessDown : ToastIcon.BrightnessUp); + Program.toast.RunToast(ScreenBrightness.Adjust(up ? step : -step) + "%", up ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown); } } @@ -275,7 +282,7 @@ public void KeyPressed(object sender, KeyPressedEventArgs e) KeyboardHook.KeyPress(Keys.VolumeUp); return; case Keys.F4: - KeyProcess("m3"); + ToggleMic(); return; } } @@ -294,10 +301,10 @@ public void KeyPressed(object sender, KeyPressedEventArgs e) HandleEvent(199); // Backlight cycle return; case Keys.F5: - SetBrightness(-10); + SetBrightness(false); return; case Keys.F6: - SetBrightness(+10); + SetBrightness(true); return; case Keys.F7: KeyboardHook.KeyKeyPress(Keys.LWin, Keys.P); @@ -306,7 +313,7 @@ public void KeyPressed(object sender, KeyPressedEventArgs e) HandleEvent(126); // Emojis return; case Keys.F9: - KeyProcess("m3"); // MicMute + ToggleMic(); // MicMute return; case Keys.F10: HandleEvent(133); // Camera Toggle @@ -365,10 +372,10 @@ public void KeyPressed(object sender, KeyPressedEventArgs e) KeyboardHook.KeyPress(Keys.Snapshot); break; case Keys.F7: - SetBrightness(-10); + SetBrightness(false); break; case Keys.F8: - SetBrightness(+10); + SetBrightness(true); break; case Keys.F9: KeyboardHook.KeyKeyPress(Keys.LWin, Keys.P); @@ -407,7 +414,7 @@ public void KeyPressed(object sender, KeyPressedEventArgs e) { if (e.Key == keyProfile) modeControl.CyclePerformanceMode(); if (e.Key == keyApp) Program.SettingsToggle(); - if (e.Key == Keys.F20) KeyProcess("m3"); + if (e.Key == Keys.F20) ToggleMic(); } if (e.Modifier == (ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt)) @@ -417,10 +424,10 @@ public void KeyPressed(object sender, KeyPressedEventArgs e) switch (e.Key) { case Keys.F1: - SetBrightness(-10); + SetBrightness(false); break; case Keys.F2: - SetBrightness(10); + SetBrightness(true); break; case Keys.F3: Program.settingsForm.gpuControl.ToggleXGM(true); @@ -462,11 +469,11 @@ public void KeyPressed(object sender, KeyPressedEventArgs e) { case Keys.VolumeDown: // Screen brightness down on CTRL+VolDown - SetBrightness(-10); + SetBrightness(false); break; case Keys.VolumeUp: // Screen brightness up on CTRL+VolUp - SetBrightness(+10); + SetBrightness(true); break; } } @@ -504,6 +511,8 @@ public static void KeyProcess(string name = "m3") action = "micmute"; if (name == "fnc") action = "fnlock"; + if (name == "fnv") + action = "visual"; if (name == "fne") action = "calculator"; } @@ -558,15 +567,13 @@ public static void KeyProcess(string name = "m3") ToggleFnLock(); break; case "micmute": - bool muteStatus = Audio.ToggleMute(); - Program.toast.RunToast(muteStatus ? Properties.Strings.Muted : Properties.Strings.Unmuted, muteStatus ? ToastIcon.MicrophoneMute : ToastIcon.Microphone); - if (AppConfig.IsVivoZenbook()) Program.acpi.DeviceSet(AsusACPI.MicMuteLed, muteStatus ? 1 : 0, "MicmuteLed"); + ToggleMic(); break; case "brightness_up": - SetBrightness(+10); + SetBrightness(true); break; case "brightness_down": - SetBrightness(-10); + SetBrightness(false); break; case "screenpad_up": SetScreenpad(10); @@ -593,6 +600,14 @@ public static void KeyProcess(string name = "m3") } } + + static void ToggleMic() + { + bool muteStatus = Audio.ToggleMute(); + Program.toast.RunToast(muteStatus ? Properties.Strings.Muted : Properties.Strings.Unmuted, muteStatus ? ToastIcon.MicrophoneMute : ToastIcon.Microphone); + if (AppConfig.IsVivoZenbook()) Program.acpi.DeviceSet(AsusACPI.MicMuteLed, muteStatus ? 1 : 0, "MicmuteLed"); + } + static bool GetTouchpadState() { using (var key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\PrecisionTouchPad\Status", false)) @@ -777,7 +792,7 @@ static void HandleOptimizationEvent(int EventID) } else { - Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Down, "Brightness"); + SetBrightness(false, true); } break; case 32: // FN+F8 @@ -792,7 +807,7 @@ static void HandleOptimizationEvent(int EventID) } else { - Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Up, "Brightness"); + SetBrightness(true, true); } break; case 133: // Camera Toggle @@ -936,7 +951,7 @@ public static void ToggleCamera() private static System.Threading.Timer screenpadActionTimer; private static int screenpadBrightnessToSet; - public static void ApplyScreenpadAction(int brightness, bool doToggle = false) + public static void ApplyScreenpadAction(int brightness, bool instant = true) { var delay = AppConfig.Get("screenpad_delay", 1500); @@ -944,11 +959,12 @@ public static void ApplyScreenpadAction(int brightness, bool doToggle = false) Action action = (b) => { if (b >= 0) Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, 1, "ScreenpadOn"); - Program.acpi.DeviceSet(AsusACPI.ScreenPadBrightness, Math.Max(b * 255 / 100, 0), "Screenpad"); + int[] brightnessValues = [0, 4, 9, 14, 21, 32, 48, 73, 111, 169, 255]; + Program.acpi.DeviceSet(AsusACPI.ScreenPadBrightness, brightnessValues[Math.Min(brightnessValues.Length - 1, Math.Max(0, b / 10))], "Screenpad"); if (b < 0) Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, 0, "ScreenpadOff"); }; - if(delay <= 0 || (brightness > 0 && brightness < 100 && doToggle == false)) //instant action + if(delay <= 0 || instant) //instant action { action(brightness); } @@ -974,20 +990,19 @@ public static void SetScreenpad(int delta) if (brightness < 0) brightness = 100; else if (brightness >= 100) brightness = 0; else brightness = -10; + ApplyScreenpadAction(brightness, false); } else { - brightness = Math.Max(Math.Min(100, brightness + delta), -10); + brightness = Math.Max(Math.Min(100, brightness + delta), 0); + ApplyScreenpadAction(brightness); } AppConfig.Set("screenpad", brightness); - ApplyScreenpadAction(brightness); - string toast; if (brightness < 0) toast = "Off"; - else if (brightness == 0) toast = "Hidden"; else toast = brightness.ToString() + "%"; Program.toast.RunToast($"Screen Pad {toast}", delta > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown); diff --git a/app/Program.cs b/app/Program.cs index 0db615898..d03df92f9 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -53,6 +53,13 @@ public static void Main(string[] args) string action = ""; if (args.Length > 0) action = args[0]; + if (action == "charge") + { + BatteryLimit(); + Application.Exit(); + return; + } + string language = AppConfig.GetString("language"); if (language != null && language.Length > 0) @@ -87,6 +94,8 @@ public static void Main(string[] args) return; } + ProcessHelper.KillByName("ASUSSmartDisplayControl"); + Application.EnableVisualStyles(); HardwareControl.RecreateGpuControl(); @@ -203,7 +212,7 @@ static void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChan if (settingsForm.matrixForm is not null && settingsForm.matrixForm.Text != "") settingsForm.matrixForm.InitTheme(); - if (settingsForm.handheldForm is not null && settingsForm.handheldForm.Text != "") + if (settingsForm.handheldForm is not null && settingsForm.handheldForm.Text != "") settingsForm.handheldForm.InitTheme(); break; @@ -241,11 +250,14 @@ public static bool SetAutoModes(bool powerChanged = false, bool init = false) if (AppConfig.IsAlly()) { allyControl.Init(); - } else + } + else { settingsForm.AutoKeyboard(); } + VisualControl.InitBrightness(); + return true; } @@ -286,7 +298,7 @@ public static void SettingsToggle(bool checkForFocus = true, bool trayClick = fa } else { - var screen = Screen.PrimaryScreen; + var screen = Screen.PrimaryScreen; if (screen is null) screen = Screen.FromControl(settingsForm); settingsForm.Location = screen.WorkingArea.Location; @@ -297,7 +309,7 @@ public static void SettingsToggle(bool checkForFocus = true, bool trayClick = fa settingsForm.Activate(); settingsForm.Left = screen.WorkingArea.Width - 10 - settingsForm.Width; - + if (AppConfig.IsAlly()) settingsForm.Top = Math.Max(10, screen.Bounds.Height - 110 - settingsForm.Height); else @@ -326,6 +338,23 @@ static void OnExit(object sender, EventArgs e) Application.Exit(); } + static void BatteryLimit() + { + try + { + int limit = AppConfig.Get("charge_limit"); + if (limit > 0 && limit < 100) + { + Logger.WriteLine($"------- Startup Battery Limit {limit} -------"); + acpi = new AsusACPI(); + acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "Limit"); + } + } + catch (Exception ex) + { + Logger.WriteLine("Startup Battery Limit Error: " + ex.Message); + } + } } } \ No newline at end of file diff --git a/app/Properties/Strings.pl.resx b/app/Properties/Strings.pl.resx index 6f0b6b08d..801b3df81 100644 --- a/app/Properties/Strings.pl.resx +++ b/app/Properties/Strings.pl.resx @@ -744,7 +744,7 @@ Nadal chcesz kontynuować? Włącz/wyłącz ekran dotykowy - Touchscreen + Ekran dotykowy Turbo @@ -801,21 +801,21 @@ Nadal chcesz kontynuować? Przybliżenie - Donate + Wesprzyj - Legend + Legenda - Can't check local version + Brak informacji Can't check local version - Update Available + Dostępna aktualizacja Update Available - Updated + Wersja aktualna Updated \ No newline at end of file diff --git a/app/Properties/Strings.zh-TW.resx b/app/Properties/Strings.zh-TW.resx index 2200795cb..55505e65a 100644 --- a/app/Properties/Strings.zh-TW.resx +++ b/app/Properties/Strings.zh-TW.resx @@ -744,7 +744,7 @@ 切換螢幕觸控 - Touchscreen + 觸控螢幕 極速 @@ -801,21 +801,21 @@ 縮放 - Donate + 捐贈 Legend - Can't check local version + 無法檢查本機版本 Can't check local version - Update Available + 有可用的更新 Update Available - Updated + 已更新 Updated \ No newline at end of file diff --git a/app/Settings.cs b/app/Settings.cs index ab6385fff..4a223711b 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -453,7 +453,7 @@ public void VisualiseBrightness() Invoke(delegate { sliderGammaIgnore = true; - sliderGamma.Value = AppConfig.Get("brightness", 100); + sliderGamma.Value = VisualControl.GetBrightness(); labelGamma.Text = sliderGamma.Value + "%"; sliderGammaIgnore = false; }); diff --git a/app/Updates.cs b/app/Updates.cs index bd38b71f6..3faa30fee 100644 --- a/app/Updates.cs +++ b/app/Updates.cs @@ -210,19 +210,31 @@ public void VisualiseNewDriver(int position, int newer, string tip, TableLayoutP } public void VisualiseNewCount(int updatesCount, TableLayoutPanel table) + { + if (InvokeRequired) + { + Invoke(delegate + { + _VisualiseNewCount(updatesCount, table); + }); + } + else + { + _VisualiseNewCount(updatesCount, table); + } + } + + public void _VisualiseNewCount(int updatesCount, TableLayoutPanel table) { Invoke(delegate { labelUpdates.Text = $"{Properties.Strings.NewUpdates}: {updatesCount}"; labelUpdates.ForeColor = colorTurbo; labelUpdates.Font = new Font(labelUpdates.Font, FontStyle.Bold); - panelBios.AccessibleName = labelUpdates.Text; - }); } - static string CleanupDeviceId(string input) { int index = input.IndexOf("&REV_"); diff --git a/docs/README.md b/docs/README.md index 8390ff4af..dc6291dfd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,7 +5,7 @@ Small and lightweight Armoury Crate alternative for Asus laptops offering almost same functionality without extra load and unnecessary services. -Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, Flow Z13, TUF Series, Strix or Scar Series, ProArt, Vivobook, Zenbook, ROG Ally / Ally X and many more! +Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, Flow Z13, DUO, TUF Series, Strix or Scar Series, ProArt, Vivobook, Zenbook, ROG Ally or Ally X and many more! # [:floppy_disk:Download](https://github.com/seerge/g-helper/releases/latest/download/GHelper.zip) **⭐ If you like the app - please spread the word about it online**