From b7910d9f7910faec97131084254e216b35e978f6 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 27 Jul 2023 19:46:05 +0200 Subject: [PATCH 01/15] Close updates on main window close --- app/GHelper.csproj | 2 +- app/Settings.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/GHelper.csproj b/app/GHelper.csproj index 8713f123..b8e2b4a4 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.102 + 0.103 diff --git a/app/Settings.cs b/app/Settings.cs index bf05341c..f46d6999 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -763,6 +763,7 @@ namespace GHelper this.Hide(); if (fans != null && fans.Text != "") fans.Close(); if (keyb != null && keyb.Text != "") keyb.Close(); + if (updates != null && updates.Text != "") updates.Close(); } From b304ce22b9a92354a4e1bfe6ffb8916a34b7b489 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Thu, 27 Jul 2023 23:50:31 +0200 Subject: [PATCH 02/15] MaxRPM calibration tweaks --- app/AppConfig.cs | 9 ++++++- app/AsusUSB.cs | 3 +-- app/Fans.cs | 2 +- app/HardwareControl.cs | 56 ++++++++++++++++++++++++++++++++---------- app/Settings.cs | 2 +- 5 files changed, 54 insertions(+), 18 deletions(-) diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 2f95adb4..2f33845a 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -96,8 +96,15 @@ public static class AppConfig public static int Get(string name, int empty = -1) { if (config.ContainsKey(name)) + { + //Debug.WriteLine(name); return int.Parse(config[name].ToString()); - else return empty; + } + else + { + //Debug.WriteLine(name + "E"); + return empty; + } } public static bool Is(string name) diff --git a/app/AsusUSB.cs b/app/AsusUSB.cs index 29539fd2..d1ce3155 100644 --- a/app/AsusUSB.cs +++ b/app/AsusUSB.cs @@ -1,6 +1,5 @@ using GHelper.Helpers; using HidLibrary; -using System.Drawing; using System.Text; namespace GHelper @@ -457,7 +456,7 @@ namespace GHelper } //Logger.WriteLine(BitConverter.ToString(msg)); - if (init) auraDevice.Write(new byte[] { AURA_HID_ID ,0xbc}); + if (init) auraDevice.Write(new byte[] { AURA_HID_ID, 0xbc }); auraDevice.Write(msg); } diff --git a/app/Fans.cs b/app/Fans.cs index 51ea7c30..b29c79f4 100644 --- a/app/Fans.cs +++ b/app/Fans.cs @@ -59,7 +59,7 @@ namespace GHelper InitTheme(true); MinRPM = 18; - MaxRPM = HardwareControl.GetFanMax(); + MaxRPM = HardwareControl.fanMax; labelTip.Visible = false; labelTip.BackColor = Color.Transparent; diff --git a/app/HardwareControl.cs b/app/HardwareControl.cs index 4d25b365..27bbaf0c 100644 --- a/app/HardwareControl.cs +++ b/app/HardwareControl.cs @@ -9,6 +9,10 @@ using System.Management; public static class HardwareControl { + + const int DEFAULT_FAN_MAX = 58; + const int INADEQUATE_MAX = 80; + public static IGpuControl? GpuControl; public static float? cpuTemp = -1; @@ -26,21 +30,48 @@ public static class HardwareControl static long lastUpdate; - public static int GetFanMax() - { - int max = 58; - int configMax = AppConfig.Get("fan_max"); - if (configMax > 80) configMax = 0; // skipping inadvequate settings + static int _fanMax = DEFAULT_FAN_MAX; + static bool _fanRpm = false; - if (AppConfig.ContainsModel("401")) max = 72; - else if (AppConfig.ContainsModel("503")) max = 68; - return Math.Max(max, configMax); + public static int fanMax + { + get + { + return _fanMax; + } + set + { + AppConfig.Set("fan_max", value); + _fanMax = value; + } } - public static void SetFanMax(int fan) + public static bool fanRpm { - AppConfig.Set("fan_max", fan); + get + { + return _fanRpm; + } + set + { + AppConfig.Set("fan_rpm", value ? 1 : 0); + _fanRpm = value; + } } + + static HardwareControl() + { + _fanMax = AppConfig.Get("fan_max"); + if (_fanMax > INADEQUATE_MAX) _fanMax = -1; // skipping inadvequate settings + + if (_fanMax < 0 && AppConfig.ContainsModel("401")) _fanMax = 72; + if (_fanMax < 0 && AppConfig.ContainsModel("503")) _fanMax = 68; + if (_fanMax < 0) _fanMax = DEFAULT_FAN_MAX; + + _fanRpm = AppConfig.Is("fan_rpm"); + + } + public static string FormatFan(int fan) { // fix for old models @@ -50,10 +81,9 @@ public static class HardwareControl if (fan <= 0 || fan > 100) return null; //nothing reasonable } - int fanMax = GetFanMax(); - if (fan > fanMax && fan < 80) SetFanMax(fan); + if (fan > fanMax && fan <= INADEQUATE_MAX) fanMax = fan; - if (AppConfig.Is("fan_rpm")) + if (fanRpm) return GHelper.Properties.Strings.FanSpeed + ": " + (fan * 100).ToString() + "RPM"; else return GHelper.Properties.Strings.FanSpeed + ": " + Math.Min(Math.Round((float)fan / fanMax * 100), 100).ToString() + "%"; // relatively to 6000 rpm diff --git a/app/Settings.cs b/app/Settings.cs index f46d6999..d8fd0f0e 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -525,7 +525,7 @@ namespace GHelper private void LabelCPUFan_Click(object? sender, EventArgs e) { - AppConfig.Set("fan_rpm", (AppConfig.Get("fan_rpm") == 1) ? 0 : 1); + HardwareControl.fanRpm = !HardwareControl.fanRpm; RefreshSensors(true); } From 60296608605ec35c9f9756b3f4185ec7f8b2583b Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 00:06:01 +0200 Subject: [PATCH 03/15] Added timer to prevent checking for Mice multiple times in a row --- app/Peripherals/PeripheralsProvider.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index 23b91e16..2a6a4ca4 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -12,6 +12,14 @@ namespace GHelper.Peripherals public static event EventHandler? DeviceChanged; + private static System.Timers.Timer timer = new System.Timers.Timer(1000); + + static PeripheralsProvider() + { + timer.Elapsed += DeviceTimer_Elapsed; + } + + public static bool IsMouseConnected() { lock (_LOCK) @@ -191,8 +199,14 @@ namespace GHelper.Peripherals private static void Device_Changed(object? sender, HidSharp.DeviceListChangedEventArgs e) { + timer.Start(); + } + + private static void DeviceTimer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e) + { + timer.Stop(); Logger.WriteLine("HID Device Event: Checking for new ASUS Mice"); - Task task = Task.Run((Action)DetectAllAsusMice); + DetectAllAsusMice(); } } } From b3f5a2dfa23be68bff92424cd174ceef248869b1 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 00:06:57 +0200 Subject: [PATCH 04/15] Skip Updates param --- app/AutoUpdate/AutoUpdateControl.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/AutoUpdate/AutoUpdateControl.cs b/app/AutoUpdate/AutoUpdateControl.cs index dfd10d91..e0759e38 100644 --- a/app/AutoUpdate/AutoUpdateControl.cs +++ b/app/AutoUpdate/AutoUpdateControl.cs @@ -41,6 +41,8 @@ namespace GHelper.AutoUpdate async void CheckForUpdatesAsync() { + if (AppConfig.Is("skip_updates")) return; + try { From f090b4a44ea5127d5c211a8c609baab3112dc5bd Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 00:49:52 +0200 Subject: [PATCH 05/15] New translations Strings.resx (Polish) --- app/Properties/Strings.pl.resx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Properties/Strings.pl.resx b/app/Properties/Strings.pl.resx index 5d320f72..cc213d16 100644 --- a/app/Properties/Strings.pl.resx +++ b/app/Properties/Strings.pl.resx @@ -163,7 +163,7 @@ Uruchomione usługi Asus - Battery State + Stan baterii Oddychanie @@ -175,7 +175,7 @@ Pętla kolorów - Comet + Kometa Counterclockwise @@ -190,7 +190,7 @@ Tęcza - Random + Losowo React @@ -285,7 +285,7 @@ Nadal chcesz kontynuować? Tryb wyświetlania NVIDIA nie jest ustawiony na Optimus - Energy Settings + Ustawienia zasilania Ustawienia @@ -381,7 +381,7 @@ Nadal chcesz kontynuować? Lightbar - Lighting + Oświetlenie Logo From a877904b466dd67ca825d75bad6c8af848abeeaa Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 00:49:53 +0200 Subject: [PATCH 06/15] New translations Strings.resx (Ukrainian) --- app/Properties/Strings.uk.resx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/Properties/Strings.uk.resx b/app/Properties/Strings.uk.resx index 327179e8..8b4a1921 100644 --- a/app/Properties/Strings.uk.resx +++ b/app/Properties/Strings.uk.resx @@ -426,25 +426,25 @@ Minute - Minutes + Хвилини - Angle Snapping + Привʼязка по куту - Auto Power Off After + Авто-вимикання - Lift Off Distance + Відстань підйому - Low Battery Warning at + Попередження про низький заряд Performance - Synchronize with mouse + Синхронізувати з мишею Мультизони @@ -453,7 +453,7 @@ Вимкнути мікрофон - Never + Ніколи Є оновлення @@ -462,7 +462,7 @@ Немає оновлень - Not Connected + Не під'єднано Відкрити вікно G-Helper @@ -486,7 +486,7 @@ Режим - Peripherals + Периферія Картинка / GIF @@ -495,7 +495,7 @@ Відтворення / Пауза - Polling Rate + Частота опитування Ліміти Потужності @@ -507,7 +507,7 @@ Print Screen - Profile + Профіль Вихід From af67684e91b3ae2da768de507a489eb30d77ae4a Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 01:47:09 +0200 Subject: [PATCH 07/15] New translations Strings.resx (Polish) --- app/Properties/Strings.pl.resx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/Properties/Strings.pl.resx b/app/Properties/Strings.pl.resx index cc213d16..2392e16f 100644 --- a/app/Properties/Strings.pl.resx +++ b/app/Properties/Strings.pl.resx @@ -193,7 +193,7 @@ Losowo - React + Tryb reaktywny Powolna @@ -423,28 +423,28 @@ Nadal chcesz kontynuować? Częstotliwość odświeżania 60 Hz dla oszczędzania baterii - Minute + minuta - Minutes + minuty - Angle Snapping + Korekcja kąta ruchu - Auto Power Off After + Przejście w tryb uśpienia po Lift Off Distance - Low Battery Warning at + Ostrzeżenie o niskim poziomie baterii - Performance + Wydajność - Synchronize with mouse + Synchronizuj z myszką Multizone @@ -453,7 +453,7 @@ Nadal chcesz kontynuować? Wyciszenie mikrofonu - Never + Nigdy Nowe aktualizacje @@ -462,7 +462,7 @@ Nadal chcesz kontynuować? Brak aktualizacji - Not Connected + Nie połączono Otwórz okno G-Helper @@ -495,7 +495,7 @@ Nadal chcesz kontynuować? Odtwórz / Pauza - Polling Rate + Częstotliwość raportowania Limit mocy @@ -507,7 +507,7 @@ Nadal chcesz kontynuować? Zrzut ekranu - Profile + Profil Zamknij From 3a08ee8d7ce491e5aee4af7aa997ec2b5e890f15 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 02:54:20 +0200 Subject: [PATCH 08/15] New translations Strings.resx (Polish) --- app/Properties/Strings.pl.resx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Properties/Strings.pl.resx b/app/Properties/Strings.pl.resx index 2392e16f..7be4cbd6 100644 --- a/app/Properties/Strings.pl.resx +++ b/app/Properties/Strings.pl.resx @@ -169,7 +169,7 @@ Oddychanie - Clockwise + W prawo Pętla kolorów @@ -178,7 +178,7 @@ Kometa - Counterclockwise + W lewo Szybka @@ -354,7 +354,7 @@ Nadal chcesz kontynuować? Temperatura docelowa - High + Wysoka Ustawienia klawiszy skrótów @@ -387,7 +387,7 @@ Nadal chcesz kontynuować? Logo - Low + Niska Wizualizer muzyki @@ -423,10 +423,10 @@ Nadal chcesz kontynuować? Częstotliwość odświeżania 60 Hz dla oszczędzania baterii - minuta + min. - minuty + min. Korekcja kąta ruchu @@ -435,7 +435,7 @@ Nadal chcesz kontynuować? Przejście w tryb uśpienia po - Lift Off Distance + Wysokość reakcji sensora Ostrzeżenie o niskim poziomie baterii @@ -486,7 +486,7 @@ Nadal chcesz kontynuować? Tryb zasilania - Peripherals + Urządzenia peryferyjne Obraz / GIF From 6357a22e3824e91c6f3839740fb95c9dc426b157 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 02:54:21 +0200 Subject: [PATCH 09/15] New translations Strings.resx (Ukrainian) --- app/Properties/Strings.uk.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Properties/Strings.uk.resx b/app/Properties/Strings.uk.resx index 8b4a1921..80919d35 100644 --- a/app/Properties/Strings.uk.resx +++ b/app/Properties/Strings.uk.resx @@ -163,7 +163,7 @@ Кількість запущених сервісів Asus - Battery State + Стан батареї Дихання From 73baf548a4d906a86f1282a4fd2b07d64cea36a6 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 07:51:13 +0200 Subject: [PATCH 10/15] New translations Strings.resx (Chinese Simplified) --- app/Properties/Strings.zh-CN.resx | 36 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/app/Properties/Strings.zh-CN.resx b/app/Properties/Strings.zh-CN.resx index ea7e1ff2..3d2c172f 100644 --- a/app/Properties/Strings.zh-CN.resx +++ b/app/Properties/Strings.zh-CN.resx @@ -190,7 +190,7 @@ 彩虹 - Random + 随机 React @@ -285,7 +285,7 @@ nVIDIA显示模式尚未设置至Optimus - Energy Settings + 电源设置 更多 @@ -354,7 +354,7 @@ 温度目标 - High + 按键绑定 @@ -381,13 +381,13 @@ 灯条 - Lighting + 背光 徽标 - Low + 音频可视化器 @@ -423,28 +423,28 @@ 调整刷新率为60Hz以节省电量 - Minute + 分钟 - Minutes + 分组 - Angle Snapping + 角度校正 - Auto Power Off After + 自动关闭时间 - Lift Off Distance + 静默高度 - Low Battery Warning at + 低于该电量时警告 - Performance + 性能 - Synchronize with mouse + 和鼠标同步 多区域设置 @@ -453,7 +453,7 @@ 静音麦克风 - Never + 从不 有更新 @@ -462,7 +462,7 @@ 无更新 - Not Connected + 未连接 打开G-Helper窗口 @@ -486,7 +486,7 @@ 性能模式 - Peripherals + 外设 图片/动图 @@ -495,7 +495,7 @@ 播放/暂停 - Polling Rate + 回报率 功率限制 @@ -507,7 +507,7 @@ 截图 - Profile + 配置 退出 From 1fcd0f2b970cc25b44522b2413fdab12d9e21caf Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 10:17:37 +0200 Subject: [PATCH 11/15] New translations Strings.resx (Chinese Simplified) --- app/Properties/Strings.zh-CN.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Properties/Strings.zh-CN.resx b/app/Properties/Strings.zh-CN.resx index 3d2c172f..a8469e37 100644 --- a/app/Properties/Strings.zh-CN.resx +++ b/app/Properties/Strings.zh-CN.resx @@ -564,7 +564,7 @@ 切换 Aura 模式 - 自动启用外接显示器模式 + 自动切换合盖模式 切换 Fn 锁定 From 62f1263951a214ba3113c7affb1c4a67193d64ec Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 12:21:04 +0200 Subject: [PATCH 12/15] New translations Strings.resx (Chinese Simplified) --- app/Properties/Strings.zh-CN.resx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Properties/Strings.zh-CN.resx b/app/Properties/Strings.zh-CN.resx index a8469e37..dd4b8905 100644 --- a/app/Properties/Strings.zh-CN.resx +++ b/app/Properties/Strings.zh-CN.resx @@ -163,13 +163,13 @@ 正在运行的 Asus 服务 - Battery State + 电池状态 呼吸 - Clockwise + 顺时针 彩色循环 @@ -178,7 +178,7 @@ Comet - Counterclockwise + 逆时针 快速 @@ -282,7 +282,7 @@ 确定还要继续吗? - nVIDIA显示模式尚未设置至Optimus + NVIDIA 显示模式未设置为自动切换 电源设置 @@ -318,7 +318,7 @@ 风扇 - 高级设置 + 风扇 + 电源 打开FnLock (无需按下FN使用FN+(F1-F12)热键) @@ -480,7 +480,7 @@ 其他 - OD + 超频 性能模式 From bd0f97c5d994cc505522155e4cf5f14355cc01d4 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 13:59:51 +0200 Subject: [PATCH 13/15] New translations Strings.resx (Chinese Simplified) --- app/Properties/Strings.zh-CN.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Properties/Strings.zh-CN.resx b/app/Properties/Strings.zh-CN.resx index dd4b8905..c4d88552 100644 --- a/app/Properties/Strings.zh-CN.resx +++ b/app/Properties/Strings.zh-CN.resx @@ -175,7 +175,7 @@ 彩色循环 - Comet + 彗星 逆时针 From 9ee3ae73599065d6bf02704dd57529bf53d946fd Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 28 Jul 2023 17:20:38 +0200 Subject: [PATCH 14/15] New translations Strings.resx (Chinese Simplified) --- app/Properties/Strings.zh-CN.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Properties/Strings.zh-CN.resx b/app/Properties/Strings.zh-CN.resx index c4d88552..841b0405 100644 --- a/app/Properties/Strings.zh-CN.resx +++ b/app/Properties/Strings.zh-CN.resx @@ -193,7 +193,7 @@ 随机 - React + 触发 From d19aaf804ad46c5fc1b95c98453f5f8c3554dde3 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 29 Jul 2023 18:52:53 +0200 Subject: [PATCH 15/15] Heatmap fix --- app/AsusUSB.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/AsusUSB.cs b/app/AsusUSB.cs index d1ce3155..e01b9929 100644 --- a/app/AsusUSB.cs +++ b/app/AsusUSB.cs @@ -456,7 +456,13 @@ namespace GHelper } //Logger.WriteLine(BitConverter.ToString(msg)); - if (init) auraDevice.Write(new byte[] { AURA_HID_ID, 0xbc }); + if (init) + { + auraDevice.Write(AuraMessage(0,color,color, 0xe1)); + auraDevice.WriteFeatureData(MESSAGE_APPLY); + auraDevice.WriteFeatureData(MESSAGE_SET); + auraDevice.Write(new byte[] { AURA_HID_ID, 0xbc }); + } auraDevice.Write(msg); }