Skip to content

Commit

Permalink
Improve GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Furimanejo committed May 18, 2021
1 parent 3939bf5 commit 94c68d8
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 55 deletions.
190 changes: 142 additions & 48 deletions InHeat/GUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 19 additions & 7 deletions InHeat/GUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public partial class GUI : Form
{
ClientController clientController;
OnFireTracker onFireTracker;
int trackingchartMaxPoints = 200;
int trackingchartMaxPoints = 100;

public GUI()
{
InitializeComponent();
Expand All @@ -27,7 +28,6 @@ private void trackerTimer_Tick(object sender, EventArgs e)
{
onFireTracker.Update();


//chart
trackingChart.Series[0].Points.Add(100f * onFireTracker.lastReadValue);
while (trackingChart.Series[0].Points.Count > trackingchartMaxPoints)
Expand Down Expand Up @@ -55,15 +55,27 @@ private async void connectButton_Click(object sender, EventArgs e)
{
await clientController.ConnectAsync();
}
catch
{
Console.WriteLine("ErrorConnecting");
}
catch { Console.WriteLine("Error Connecting"); }
}

private async void clientUpdateTimer_Tick(object sender, EventArgs e)
{
await clientController.UpdateValue(onFireTracker.movingAverage);
float value = 0;
if (UpdateDevicesCheckbox.Checked)
{
value = onFireTracker.movingAverage;
// interpolation
value = value * (float)(maxIntensity.Value - minIntensity.Value)/100;
value += (float) minIntensity.Value / 100;
// clamp
value = value > 0 ? value : 0;
value = value < 1 ? value : 1;
}
try
{
await clientController.UpdateValue(value);
}
catch{ Console.WriteLine("Error Update Device Value"); }
}
}
}

0 comments on commit 94c68d8

Please sign in to comment.