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

Added probe X Y offset #163

Merged
merged 2 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions OpenCNCPilot/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ G92Z0;</value>
<setting name="EthernetPort" serializeAs="String">
<value>34000</value>
</setting>
<setting name="ProbeOffsetX" serializeAs="String">
<value>0</value>
</setting>
<setting name="ProbeOffsetY" serializeAs="String">
<value>0</value>
</setting>
</OpenCNCPilot.Properties.Settings>
</userSettings>
<runtime>
Expand Down
3 changes: 2 additions & 1 deletion OpenCNCPilot/Communication/Machine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,8 @@ private void ParseProbe(string line)
LastProbePosMachine = ProbePos;

ProbePos -= WorkOffset;

ProbePos.X += Properties.Settings.Default.ProbeOffsetX;
ProbePos.Y += Properties.Settings.Default.ProbeOffsetY;
LastProbePosWork = ProbePos;

bool ProbeSuccess = success.Value == "1";
Expand Down
2 changes: 1 addition & 1 deletion OpenCNCPilot/MainWindow.ProbingTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private void HeightMapProbeNextPoint()

Vector2 nextPoint = Map.GetCoordinates(Map.NotProbed[0].Item1, Map.NotProbed[0].Item2);

machine.SendLine($"G0X{nextPoint.X.ToString("0.###", Constants.DecimalOutputFormat)}Y{nextPoint.Y.ToString("0.###", Constants.DecimalOutputFormat)}");
machine.SendLine($"G0X{(nextPoint.X - Properties.Settings.Default.ProbeOffsetX).ToString("0.###", Constants.DecimalOutputFormat)}Y{(nextPoint.Y - Properties.Settings.Default.ProbeOffsetY).ToString("0.###", Constants.DecimalOutputFormat)}");

machine.SendLine($"G38.3Z-{Properties.Settings.Default.ProbeMaxDepth.ToString("0.###", Constants.DecimalOutputFormat)}F{Properties.Settings.Default.ProbeFeed.ToString("0.#", Constants.DecimalOutputFormat)}");

Expand Down
26 changes: 18 additions & 8 deletions OpenCNCPilot/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@
<Label Name="LabelHeightMapProgress" Content="0/0" HorizontalAlignment="Left" Margin="55,10,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.667,0.538"/>
<Button Name="ButtonHeightMapStart" Content=" Run " Click="ButtonHeightMapStart_Click" Style="{StaticResource styleButton}" HorizontalAlignment="Right" Margin="0,10,55,0" VerticalAlignment="Top"/>
<Button Name="ButtonHeightMapPause" Content="Pause" Click="ButtonHeightMapPause_Click" Style="{StaticResource styleButton}" HorizontalAlignment="Right" Margin="0,10,10,0" VerticalAlignment="Top"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="10,32,0,0" VerticalAlignment="Top">
<Label Content="MinZ:" Width="40"/>
<Label Content="0" Width="50" Name="LabelHeightMapMinZ"/>
<Label Content="MaxZ:" Width="43"/>
<Label Content="0" Width="50" Name="LabelHeightMapMaxZ"/>
</StackPanel>
</Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="10,32,0,0" VerticalAlignment="Top">
<Label Content="MinZ:" Width="40"/>
<Label Content="0" Width="50" Name="LabelHeightMapMinZ"/>
<Label Content="MaxZ:" Width="43"/>
<Label Content="0" Width="50" Name="LabelHeightMapMaxZ"/>
</StackPanel>
</Grid>
</Grid>
</Expander>
</Border>
Expand Down Expand Up @@ -240,7 +240,17 @@
<TextBox Name="TextBoxCurrentTLO" Text="0.000" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="138,53,0,0" Width="52" Height="23" VerticalContentAlignment="Center" IsReadOnly="True" ToolTip="Current TLO (Z)"/>
</Grid>
</GroupBox>
</StackPanel>
<GroupBox Header="Probe Offset" Name="groupBoxProbeOffset">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="10,5,0,0" VerticalAlignment="Top">
<Label Content="X:" Width="25"/>
<TextBox Height="23" Width="60" VerticalContentAlignment="Center" Text="{util:SettingBinding ProbeOffsetX}"/>
<Label Content="Y:" Width="25"/>
<TextBox Height="23" Width="60" VerticalContentAlignment="Center" Text="{util:SettingBinding ProbeOffsetY}"/>
</StackPanel>
</Grid>
</GroupBox>
</StackPanel>
</Expander>
</Border>
<Border Style="{StaticResource stylePanelOut}">
Expand Down
28 changes: 26 additions & 2 deletions OpenCNCPilot/Properties/Settings.Designer.cs

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

6 changes: 6 additions & 0 deletions OpenCNCPilot/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,11 @@ G92Z0;</Value>
<Setting Name="EthernetPort" Type="System.Int32" Scope="User">
<Value Profile="(Default)">34000</Value>
</Setting>
<Setting Name="ProbeOffsetX" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="ProbeOffsetY" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>