Add avg and similar

This commit is contained in:
Kamil Trzciński 2022-11-12 17:06:34 +01:00
parent 8e582f372e
commit adddf9feca
5 changed files with 37 additions and 22 deletions

View file

@ -172,7 +172,7 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(712, 989);
this.tableLayoutPanel1.Size = new System.Drawing.Size(712, 1045);
this.tableLayoutPanel1.TabIndex = 5;
//
// label1
@ -182,7 +182,7 @@
this.label1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.label1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
this.label1.ForeColor = System.Drawing.Color.Red;
this.label1.Location = new System.Drawing.Point(3, 893);
this.label1.Location = new System.Drawing.Point(3, 949);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(706, 64);
this.label1.TabIndex = 9;
@ -197,7 +197,7 @@
this.helpLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.helpLabel.Font = new System.Drawing.Font("Segoe UI", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point);
this.helpLabel.ForeColor = System.Drawing.SystemColors.HotTrack;
this.helpLabel.Location = new System.Drawing.Point(3, 957);
this.helpLabel.Location = new System.Drawing.Point(3, 1013);
this.helpLabel.Name = "helpLabel";
this.helpLabel.Size = new System.Drawing.Size(706, 32);
this.helpLabel.TabIndex = 8;
@ -211,7 +211,7 @@
this.sensorWarningLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.sensorWarningLabel.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
this.sensorWarningLabel.ForeColor = System.Drawing.Color.Red;
this.sensorWarningLabel.Location = new System.Drawing.Point(3, 797);
this.sensorWarningLabel.Location = new System.Drawing.Point(3, 853);
this.sensorWarningLabel.Name = "sensorWarningLabel";
this.sensorWarningLabel.Size = new System.Drawing.Size(706, 96);
this.sensorWarningLabel.TabIndex = 6;
@ -227,7 +227,7 @@
this.propertyGrid1.HelpVisible = false;
this.propertyGrid1.Location = new System.Drawing.Point(3, 3);
this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.Size = new System.Drawing.Size(706, 791);
this.propertyGrid1.Size = new System.Drawing.Size(706, 847);
this.propertyGrid1.TabIndex = 1;
this.propertyGrid1.ToolbarVisible = false;
//
@ -235,12 +235,14 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 32F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(712, 1033);
this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(712, 1089);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FanControlForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;

View file

@ -106,9 +106,7 @@ namespace FanControl
if (!Visible)
return;
var item = propertyGrid1.SelectedGridItem;
propertyGrid1.Refresh();
propertyGrid1.SelectedGridItem = item;
sensorWarningLabel.Visible = fanControl.IsAnyInvalid();
notifyIcon.Text = String.Format("Fan: {0} RPM Mode: {1}", fanControl.CurrentRPM, fanControl.Mode);
}

View file

@ -12,6 +12,7 @@ using System.Threading.Tasks;
namespace FanControl
{
[TypeConverter(typeof(ExpandableObjectConverter))]
[RefreshProperties(RefreshProperties.Repaint)]
internal partial class FanController : IDisposable
{
public enum FanMode
@ -25,9 +26,13 @@ namespace FanControl
public FanMode Mode { get; private set; }
[CategoryAttribute("Fan")]
[NotifyParentProperty(true)]
public ushort CurrentRPM { get; private set; }
[CategoryAttribute("Fan")]
[NotifyParentProperty(true)]
public ushort DesiredRPM { get; private set; }
[CategoryAttribute("Board")]

View file

@ -21,6 +21,7 @@ namespace FanControl
SensorName = "Package",
SensorType = SensorType.Power,
ValueDeadZone = 0.1f,
AvgSamples = 20,
Profiles = new Dictionary<FanMode, FanSensor.Profile>()
{
{
@ -48,6 +49,7 @@ namespace FanControl
SensorName = "Core (Tctl/Tdie)",
SensorType = SensorType.Temperature,
ValueDeadZone = 0.0f,
AvgSamples = 20,
Profiles = new Dictionary<FanMode, FanSensor.Profile>()
{
{
@ -72,6 +74,7 @@ namespace FanControl
SensorName = "GPU Core",
SensorType = SensorType.Temperature,
ValueDeadZone = 0.0f,
AvgSamples = 20,
Profiles = new Dictionary<FanMode, FanSensor.Profile>()
{
{

View file

@ -180,28 +180,35 @@ namespace FanControl
return true;
}
private String Unit()
{
switch (SensorType)
{
case SensorType.Temperature:
return "℃";
case SensorType.Power:
return "W";
default:
return "";
}
}
public String FormattedValue()
{
if (!Value.HasValue)
return "";
String value = Value.Value.ToString("F1");
String value = "";
if (AllSamples.Count > 0)
value += AllSamples.Last().ToString("F1") + Unit();
switch (SensorType)
{
case SensorType.Temperature:
value += "℃";
break;
case SensorType.Power:
value += "W";
break;
}
value += " (avg: " + Value.Value.ToString("F1") + Unit() + ")";
if (CalculatedRPM.HasValue)
{
value += " (min: " + CalculatedRPM.ToString() + "RPM)";
}
value += " (" + CalculatedRPM.ToString() + "RPM)";
return value;
}