Pre-entered max fan speeds

This commit is contained in:
Serge
2023-09-10 12:31:18 +02:00
parent eb21fb2020
commit a800eae020
2 changed files with 43 additions and 9 deletions

View File

@@ -9,21 +9,17 @@ namespace GHelper.Fan
public const int INADEQUATE_MAX = 90; public const int INADEQUATE_MAX = 90;
const int FAN_COUNT = 3;
Fans fansForm; Fans fansForm;
ModeControl modeControl = Program.modeControl; ModeControl modeControl = Program.modeControl;
static int[] measuredMax; static int[] measuredMax;
const int FAN_COUNT = 3;
static int sameCount = 0; static int sameCount = 0;
static System.Timers.Timer timer = default!; static System.Timers.Timer timer = default!;
static int[] _fanMax = new int[3] { static int[] _fanMax = InitFanMax();
AppConfig.Get("fan_max_" + (int)AsusFan.CPU, DEFAULT_FAN_MAX),
AppConfig.Get("fan_max_" + (int)AsusFan.GPU, DEFAULT_FAN_MAX),
AppConfig.Get("fan_max_" + (int)AsusFan.Mid, DEFAULT_FAN_MAX)
};
static bool _fanRpm = AppConfig.IsNotFalse("fan_rpm"); static bool _fanRpm = AppConfig.IsNotFalse("fan_rpm");
public FanSensorControl(Fans fansForm) public FanSensorControl(Fans fansForm)
@@ -33,6 +29,44 @@ namespace GHelper.Fan
timer.Elapsed += Timer_Elapsed; timer.Elapsed += Timer_Elapsed;
} }
static int[] InitFanMax()
{
int[] defaultMax = GetDefaultMax();
return new int[3] {
AppConfig.Get("fan_max_" + (int)AsusFan.CPU, defaultMax[(int)AsusFan.CPU]),
AppConfig.Get("fan_max_" + (int)AsusFan.GPU, defaultMax[(int)AsusFan.GPU]),
AppConfig.Get("fan_max_" + (int)AsusFan.Mid, defaultMax[(int)AsusFan.Mid])
};
}
static int[] GetDefaultMax()
{
if (AppConfig.ContainsModel("GA401I")) return new int[3] { 78, 76, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("GA401")) return new int[3] { 71, 73, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("GA402")) return new int[3] { 55, 56, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("G513R")) return new int[3] { 58, 60, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("G513Q")) return new int[3] { 69, 69, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("GA503")) return new int[3] { 64, 64, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("GU603")) return new int[3] { 62, 64, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("FA507R")) return new int[3] { 63, 57, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("FA507X")) return new int[3] { 63, 68, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("GX650")) return new int[3] { 62, 62, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("G732")) return new int[3] { 61, 60, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("G713")) return new int[3] { 56, 60, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("Z301")) return new int[3] { 72, 64, DEFAULT_FAN_MAX };
if (AppConfig.ContainsModel("GV601")) return new int[3] { 78, 59, 85 };
return new int[3] { DEFAULT_FAN_MAX, DEFAULT_FAN_MAX, DEFAULT_FAN_MAX };
}
public static int GetFanMax(AsusFan device) public static int GetFanMax(AsusFan device)
{ {

4
app/Fans.Designer.cs generated
View File

@@ -430,7 +430,7 @@ namespace GHelper
buttonCalibrate.BorderColor = Color.Transparent; buttonCalibrate.BorderColor = Color.Transparent;
buttonCalibrate.BorderRadius = 2; buttonCalibrate.BorderRadius = 2;
buttonCalibrate.FlatStyle = FlatStyle.Flat; buttonCalibrate.FlatStyle = FlatStyle.Flat;
buttonCalibrate.Location = new Point(239, 40); buttonCalibrate.Location = new Point(275, 40);
buttonCalibrate.Margin = new Padding(4, 2, 4, 2); buttonCalibrate.Margin = new Padding(4, 2, 4, 2);
buttonCalibrate.Name = "buttonCalibrate"; buttonCalibrate.Name = "buttonCalibrate";
buttonCalibrate.Secondary = true; buttonCalibrate.Secondary = true;
@@ -476,7 +476,7 @@ namespace GHelper
buttonReset.Margin = new Padding(4, 2, 4, 2); buttonReset.Margin = new Padding(4, 2, 4, 2);
buttonReset.Name = "buttonReset"; buttonReset.Name = "buttonReset";
buttonReset.Secondary = true; buttonReset.Secondary = true;
buttonReset.Size = new Size(216, 50); buttonReset.Size = new Size(252, 50);
buttonReset.TabIndex = 18; buttonReset.TabIndex = 18;
buttonReset.Text = Properties.Strings.FactoryDefaults; buttonReset.Text = Properties.Strings.FactoryDefaults;
buttonReset.UseVisualStyleBackColor = false; buttonReset.UseVisualStyleBackColor = false;