Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using UTurn allow user to enable a sound to be played when approaching headland. #101

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions SourceCode/GPS/AgOpenGPS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Windows.Presentation" />
<Reference Include="System.Xml" />
<Reference Include="Tinkerforge, Version=2.1.16.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -559,6 +560,15 @@
<Content Include="AppIcon.ico" />
<Content Include="AppIcon64.ico" />
<Content Include="aChangeLog.txt" />
<Content Include="Dependencies\Sounds\medium-beep.wav">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Dependencies\Sounds\short-beep.wav">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Dependencies\Sounds\two-short-beeps.wav">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Dependencies\YouTurnShapes\SemiCircle.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
3 changes: 3 additions & 0 deletions SourceCode/GPS/Classes/CYouTurn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public class CYouTurn
public vec4 crossingCurvePoint = new vec4();
public vec4 crossingTurnLinePoint = new vec4();

public bool isUsingHeadlandAlert = false;
public int headlandAlertDistance = 20;

//constructor
public CYouTurn(FormGPS _f)
{
Expand Down
Binary file not shown.
Binary file added SourceCode/GPS/Dependencies/Sounds/short-beep.wav
Binary file not shown.
Binary file not shown.
261 changes: 176 additions & 85 deletions SourceCode/GPS/Forms/FormYouTurn.Designer.cs

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions SourceCode/GPS/Forms/FormYouTurn.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Drawing;
using System.Media;
using System.Text;
using System.Windows.Forms;

Expand Down Expand Up @@ -193,6 +194,7 @@ private void FormYouTurn_Load(object sender, EventArgs e)
btnYouTurnWideReturn.Enabled = false;
btnYouTurnSemiCircle.Enabled = false;
}
InitializeHeadlandAlert();
}

#region Procedures
Expand Down Expand Up @@ -742,6 +744,34 @@ private void LoadEditFunctionNames()
tboxPos7.Text = mf.seq.pos7;
tboxPos8.Text = mf.seq.pos8;
}
private void InitializeHeadlandAlert()
{
if (!mf.yt.isUsingHeadlandAlert)
{
mf.yt.isUsingHeadlandAlert = false;
btnIsUsingHeadlandAlert.BackColor = Color.Salmon;
}
else
{
mf.yt.isUsingHeadlandAlert = true;
btnIsUsingHeadlandAlert.BackColor = Color.PaleGreen;
}
lblHeadlandAlertDistance.Text = $"{mf.yt.headlandAlertDistance.ToString()}";
}

private void SetHeadlandAlert()
{
if (mf.yt.isUsingHeadlandAlert)
{
mf.yt.isUsingHeadlandAlert = false;
btnIsUsingHeadlandAlert.BackColor = Color.Salmon;
}
else
{
mf.yt.isUsingHeadlandAlert = true;
btnIsUsingHeadlandAlert.BackColor = Color.PaleGreen;
}
}

#endregion Procedures

Expand Down Expand Up @@ -1298,5 +1328,22 @@ private void FunctionButtonsOnOff()
if (IsBitSet(mf.mc.machineControlData[mf.mc.cnYouTurn], 5)) btnToggle8.BackColor = Color.LightGreen;
else btnToggle8.BackColor = Color.LightSalmon;
}

private void btnIsUsingHeadlandAlert_Click(object sender, EventArgs e)
{
SetHeadlandAlert();
}

private void headlandAlertDistanceDn_MouseDown(object sender, MouseEventArgs e)
{
mf.yt.headlandAlertDistance += -1;
lblHeadlandAlertDistance.Text = $"{mf.yt.headlandAlertDistance.ToString()}";
}

private void headlandAlertDistanceUp_MouseDown(object sender, MouseEventArgs e)
{
mf.yt.headlandAlertDistance ++;
lblHeadlandAlertDistance.Text = $"{mf.yt.headlandAlertDistance.ToString()}";
}
}
}
29 changes: 27 additions & 2 deletions SourceCode/GPS/Forms/GUI.Designer.cs

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