Skip to content

Commit

Permalink
Added setting different COM port for sending RTCM
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapvandenhandel committed Nov 24, 2021
1 parent d66e74a commit 704560f
Show file tree
Hide file tree
Showing 8 changed files with 348 additions and 25 deletions.
12 changes: 12 additions & 0 deletions SourceCode/AgIO/Source/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@
<setting name="setRadio_Channels" serializeAs="String">
<value />
</setting>
<setting name="setDifferentPort_Rtcm" serializeAs="String">
<value>False</value>
</setting>
<setting name="setPort_portNameRtcm" serializeAs="String">
<value>RTCM</value>
</setting>
<setting name="setPort_baudRateRtcm" serializeAs="String">
<value>9600</value>
</setting>
<setting name="setPort_wasRtcmConnected" serializeAs="String">
<value>False</value>
</setting>
</AgIO.Properties.Settings>
</userSettings>
</configuration>
8 changes: 8 additions & 0 deletions SourceCode/AgIO/Source/Forms/Controls.Designer.cs

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

163 changes: 140 additions & 23 deletions SourceCode/AgIO/Source/Forms/FormCommSetGPS.Designer.cs

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions SourceCode/AgIO/Source/Forms/FormCommSetGPS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,29 @@ private void FormCommSet_Load(object sender, EventArgs e)
btnOpenSerial2.Enabled = true;
}

cboxIsRTCMdifferentPort.Checked = Properties.Settings.Default.setDifferentPort_Rtcm;

if (mf.spRtcm.IsOpen || !Properties.Settings.Default.setDifferentPort_Rtcm)
{
cboxRtcmBaud.Enabled = false;
cboxRtcmPort.Enabled = false;
}
else
{
cboxRtcmBaud.Enabled = true;
cboxRtcmPort.Enabled = true;
}

//load the port box with valid port names
cboxPort.Items.Clear();
cboxPort2.Items.Clear();
cboxRtcmPort.Items.Clear();

foreach (string s in System.IO.Ports.SerialPort.GetPortNames())
{
cboxPort.Items.Add(s);
cboxPort2.Items.Add(s);
cboxRtcmPort.Items.Add(s);
}

lblCurrentBaud.Text = mf.spGPS.BaudRate.ToString();
Expand All @@ -88,6 +103,9 @@ private void FormCommSet_Load(object sender, EventArgs e)
lblCurrentBaud2.Text = mf.spGPS2.BaudRate.ToString();
lblCurrentPort2.Text = mf.spGPS2.PortName;

labelRtcmBaud.Text = mf.spRtcm.BaudRate.ToString();
labelRtcmPort.Text = mf.spRtcm.PortName.ToString();

if (mf.spIMU.IsOpen)
{
cboxIMU.Enabled = false;
Expand Down Expand Up @@ -502,5 +520,40 @@ private void btnCloseSerialModule3_Click(object sender, EventArgs e)
btnOpenSerialModule3.Enabled = true;
}
}

private void lblCurrentPort_Click(object sender, EventArgs e)
{

}

private void cboxIsRTCMdifferentPort_CheckedChanged(object sender, EventArgs e)
{
var cbox = sender as CheckBox;

if (cbox != null)
{
cboxRtcmPort.Enabled = cbox.Checked;
cboxRtcmBaud.Enabled = cbox.Checked;
Properties.Settings.Default.setDifferentPort_Rtcm = cbox.Checked;
Properties.Settings.Default.Save();

if (!cbox.Checked && mf.spRtcm.IsOpen)
{
mf.CloseRtcmPort();
}
}
}

private void cboxRtcmPort_SelectedIndexChanged(object sender, EventArgs e)
{
mf.spRtcm.PortName = cboxRtcmPort.Text;
FormLoop.portNameRtcm = cboxRtcmPort.Text;
}

private void cboxRtcmBaud_SelectedIndexChanged(object sender, EventArgs e)
{
mf.spRtcm.BaudRate = Convert.ToInt32(cboxRtcmBaud.Text);
FormLoop.baudRateRtcm = Convert.ToInt32(cboxRtcmBaud.Text);
}
} //class
} //namespace
10 changes: 10 additions & 0 deletions SourceCode/AgIO/Source/Forms/FormLoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ private void FormLoop_Load(object sender, EventArgs e)
if (spGPS.IsOpen) lblGPS1Comm.Text = portNameGPS;
}

// set baud and port for rtcm from last time run
baudRateRtcm = Settings.Default.setPort_baudRateRtcm;
portNameRtcm = Settings.Default.setPort_portNameRtcm;
wasRtcmConnectedLastRun = Settings.Default.setPort_wasRtcmConnected;

if (Settings.Default.setDifferentPort_Rtcm && wasRtcmConnectedLastRun)
{
OpenRtcmPort();
}

//Open IMU
portNameIMU = Settings.Default.setPort_portNameIMU;
wasIMUConnectedLastRun = Settings.Default.setPort_wasIMUConnected;
Expand Down
67 changes: 65 additions & 2 deletions SourceCode/AgIO/Source/Forms/SerialComm.Designer.cs

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

48 changes: 48 additions & 0 deletions SourceCode/AgIO/Source/Properties/Settings.Designer.cs

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

12 changes: 12 additions & 0 deletions SourceCode/AgIO/Source/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,17 @@
<Setting Name="setRadio_Channels" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="setDifferentPort_Rtcm" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="setPort_portNameRtcm" Type="System.String" Scope="User">
<Value Profile="(Default)">RTCM</Value>
</Setting>
<Setting Name="setPort_baudRateRtcm" Type="System.Int32" Scope="User">
<Value Profile="(Default)">9600</Value>
</Setting>
<Setting Name="setPort_wasRtcmConnected" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

0 comments on commit 704560f

Please sign in to comment.