Skip to content

Commit

Permalink
Merge pull request #7 from xd15zhn/master
Browse files Browse the repository at this point in the history
V1.01->V1.02
  • Loading branch information
Phillweston authored Jun 1, 2020
2 parents c4b713c + 945fb3d commit 0c5a4b1
Show file tree
Hide file tree
Showing 29 changed files with 533 additions and 310 deletions.
73 changes: 14 additions & 59 deletions GroundStation/App.config
Original file line number Diff line number Diff line change
@@ -1,84 +1,39 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="GroundStation.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="GroundStation.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
<userSettings>
<GroundStation.Properties.Settings>
<setting name="tbxTx1Str" serializeAs="String">
<value />
<value/>
</setting>
<setting name="tbxTx2Str" serializeAs="String">
<value />
<value/>
</setting>
<setting name="tbxTx3Str" serializeAs="String">
<value />
<value/>
</setting>
<setting name="cbxBaudRateStr" serializeAs="String">
<value />
<value/>
</setting>
<setting name="tbxIntervalStr" serializeAs="String">
<value />
</setting>
<setting name="tbxRolCName1Str" serializeAs="String">
<value />
</setting>
<setting name="tbxRolCName2Str" serializeAs="String">
<value />
</setting>
<setting name="tbxRolCName3Str" serializeAs="String">
<value />
</setting>
<setting name="tbxRolCName4Str" serializeAs="String">
<value />
</setting>
<setting name="tbxRolSName1Str" serializeAs="String">
<value />
</setting>
<setting name="tbxRolSName2Str" serializeAs="String">
<value />
</setting>
<setting name="tbxRolSName3Str" serializeAs="String">
<value />
</setting>
<setting name="tbxRolSName4Str" serializeAs="String">
<value />
</setting>
<setting name="tbxPitCName1Str" serializeAs="String">
<value />
</setting>
<setting name="tbxPitCName2Str" serializeAs="String">
<value />
</setting>
<setting name="tbxPitCName3Str" serializeAs="String">
<value />
</setting>
<setting name="tbxPitCName4Str" serializeAs="String">
<value />
</setting>
<setting name="tbxPitSName1Str" serializeAs="String">
<value />
</setting>
<setting name="tbxPitSName2Str" serializeAs="String">
<value />
</setting>
<setting name="tbxPitSName3Str" serializeAs="String">
<value />
</setting>
<setting name="tbxPitSName4Str" serializeAs="String">
<value />
<value/>
</setting>
<setting name="TabIndexInt" serializeAs="String">
<value>0</value>
</setting>
<setting name="cbxBaudRate2Str" serializeAs="String">
<value />
<value/>
</setting>
<setting name="tbxNotepadstr" serializeAs="String">
<value/>
</setting>
</GroundStation.Properties.Settings>
</userSettings>
</configuration>
</configuration>
41 changes: 41 additions & 0 deletions GroundStation/FileWrite.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.IO;
using System.Text;
using System.Windows.Forms;

namespace GroundStation
{
class FileWrite
{
private readonly FileStream fs;
public FileWrite()
{
if (fs == null)
fs = new FileStream("data.dat", FileMode.OpenOrCreate, FileAccess.Write);
}
public void Write_Double_Pair_Data(double a, double b)
{
string stra = a.ToString("#0.0000");
string strb = b.ToString("#0.0000");
string str = stra + " " + strb + "\r\n";
byte[] data = Encoding.UTF8.GetBytes(str);
try
{
fs.Write(data, 0, data.Length);
}
catch (Exception) { }
}
public void Write_File()
{
try
{
fs.Flush();
fs.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
34 changes: 34 additions & 0 deletions GroundStation/Filter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace GroundStation
{
class Filter
{
private readonly double[] IIRdelay = new double[2];
private readonly double[] MoveSave = new double[8];
private double UnitDelay;
public double IIR_LowPassFilter(double DataIn)
{
IIRdelay[0] = DataIn + 0.76295 * IIRdelay[1] - 0.283438 * IIRdelay[2];
double DataOut = 0.129 * IIRdelay[0] + 0.258 * IIRdelay[1] + 0.129 * IIRdelay[2];
IIRdelay[2] = IIRdelay[1];
IIRdelay[1] = IIRdelay[0];
return DataOut;
}
public double Moving_Average(double DataIn)
{
double sum = DataIn;
for (int i = 0; i < 7; i++)
{
MoveSave[i] = MoveSave[i + 1];
sum += MoveSave[i];
}
MoveSave[7] = DataIn;
return sum / 8.0;
}
public double OneOrder_Filter(double DataIn)
{
double DataOut = DataIn + 0.25 * UnitDelay;
UnitDelay = DataOut;
return DataOut * 0.75;
}
}
}
Loading

0 comments on commit 0c5a4b1

Please sign in to comment.