Skip to content

Commit

Permalink
Merge pull request #165 from Paciente8159/select-grbl-variation
Browse files Browse the repository at this point in the history
Select grbl variation
  • Loading branch information
martin2250 authored Apr 26, 2022
2 parents 2b27e1f + ef0b6a3 commit 02f9531
Show file tree
Hide file tree
Showing 15 changed files with 247 additions and 21 deletions.
3 changes: 3 additions & 0 deletions OpenCNCPilot/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ G92Z0;</value>
<setting name="EthernetPort" serializeAs="String">
<value>34000</value>
</setting>
<setting name="FirmwareType" serializeAs="String">
<value>Grbl</value>
</setting>
<setting name="ProbeOffsetX" serializeAs="String">
<value>0</value>
</setting>
Expand Down
8 changes: 8 additions & 0 deletions OpenCNCPilot/GrblSettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ public GrblSettingsWindow()
InitializeComponent();
}

public void ResetAll()
{
this.CurrentSettings = new Dictionary<int, double>();
this.SettingsBoxes = new Dictionary<int, TextBox>();
gridMain.Children.Clear();
gridMain.RowDefinitions.Clear();
}

static Regex settingParser = new Regex(@"\$([0-9]+)=([0-9\.]+)");
public void LineReceived(string line)
{
Expand Down
1 change: 1 addition & 0 deletions OpenCNCPilot/MainWindow.xaml.MachineTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ private void ButtonSettings_Click(object sender, RoutedEventArgs e)
return;

new SettingsWindow().ShowDialog();
this.settingsWindow.ResetAll();
}

private void ButtonConnect_Click(object sender, RoutedEventArgs e)
Expand Down
21 changes: 12 additions & 9 deletions OpenCNCPilot/OpenCNCPilot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,22 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\error_codes_en_US.csv">
<None Include="Resources\grbl_alarm_codes_en_US.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Resources\alarm_codes_en_US.csv">
<None Include="Resources\grbl_error_codes_en_US.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Resources\setting_codes_en_US.csv">
<None Include="Resources\grbl_setting_codes_en_US.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\ucnc_alarm_codes_en_US.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\ucnc_error_codes_en_US.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\ucnc_setting_codes_en_US.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Expand Down
12 changes: 12 additions & 0 deletions OpenCNCPilot/Properties/Settings.Designer.cs

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

3 changes: 3 additions & 0 deletions OpenCNCPilot/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ G92Z0;</Value>
<Setting Name="EthernetPort" Type="System.Int32" Scope="User">
<Value Profile="(Default)">34000</Value>
</Setting>
<Setting Name="FirmwareType" Type="System.String" Scope="User">
<Value Profile="(Default)">Grbl</Value>
</Setting>
<Setting Name="ProbeOffsetX" Type="System.Double" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
Expand Down
12 changes: 12 additions & 0 deletions OpenCNCPilot/Resources/ucnc_alarm_codes_en_US.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"Alarm Code in v1.1+"," Alarm Message in v1.0-"," Alarm Description"
"1","Hard limit","Hard limit has been triggered. Machine position is likely lost due to sudden halt. Re-homing is highly recommended."
"2","Soft limit","Soft limit alarm. G-code motion target exceeds machine travel. Machine position retained. Alarm may be safely unlocked."
"3","Abort during cycle","Reset while in motion. Machine position is likely lost due to sudden halt. Re-homing is highly recommended."
"4","Probe fail","Probe fail. Probe is not in the expected initial state before starting probe cycle when G38.2 and G38.3 is not triggered and G38.4 and G38.5 is triggered."
"5","Probe fail","Probe fail. Probe did not contact the workpiece within the programmed travel for G38.2 and G38.4."
"6","Homing fail","Homing fail. The active homing cycle was reset."
"7","Homing fail","Homing fail. Safety door was opened during homing cycle."
"8","Homing fail","Homing fail. Pull off travel failed to clear limit switch. Try increasing pull-off setting or check wiring."
"9","Homing fail","Homing fail. Could not find limit switch within search distances. Try increasing max travel, decreasing pull-off distance, or check wiring."
"10","Homing fail","Homing fail. Could not find limit dual switch within search distances. Try increasing max travel, decreasing pull-off distance, or check wiring."
"11","Homing fail","Homing fail. Limit switch is already active. Try reposition the machine, or check wiring."
50 changes: 50 additions & 0 deletions OpenCNCPilot/Resources/ucnc_error_codes_en_US.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"Error Code in v1.1+","Error Message in v1.0-","Error Description"
"1","Expected command letter","G-code words consist of a letter and a value. Letter was not found."
"2","Bad number format","Missing the expected G-code word value or numeric value format is not valid."
"3","Invalid statement","Grbl '$' system command was not recognized or supported."
"4","Value < 0","Negative value received for an expected positive value."
"5","Setting disabled","Homing cycle failure. Homing is not enabled via settings."
"6","Value < 3 usec","Minimum step pulse time must be greater than 3usec."
"7","EEPROM read fail. Using defaults","An EEPROM read failed. Auto-restoring affected EEPROM to default values."
"8","Not idle","Grbl '$' command cannot be used unless Grbl is IDLE. Ensures smooth operation during a job."
"9","G-code lock","G-code commands are locked out during alarm or jog state."
"10","Homing not enabled","Soft limits cannot be enabled without homing also enabled."
"11","Line overflow","Max characters per line exceeded. Received command line was not executed."
"12","Step rate > 30kHz","Grbl '$' setting value cause the step rate to exceed the maximum supported."
"13","Check Door","Safety door detected as opened and door state initiated."
"14","Line length exceeded","Build info or startup line exceeded EEPROM line length limit. Line not stored."
"15","Travel exceeded","Jog target exceeds machine travel. Jog command has been ignored."
"16","Invalid jog command","Jog command has no '=' or contains prohibited g-code."
"17","Setting disabled","Laser mode requires PWM output."
"20","Unsupported command","Unsupported or invalid g-code command found in block."
"21","Modal group violation","More than one g-code command from same modal group found in block."
"22","Undefined feed rate","Feed rate has not yet been set or is undefined."
"23","Invalid gcode ID:23","G-code command in block requires an integer value."
"24","Invalid gcode ID:24","More than one g-code command that requires axis words found in block."
"25","Invalid gcode ID:25","Repeated g-code word found in block."
"26","Invalid gcode ID:26","No axis words found in block for g-code command or current modal state which requires them."
"27","Invalid gcode ID:27","Line number value is invalid."
"28","Invalid gcode ID:28","G-code command is missing a required value word."
"29","Invalid gcode ID:29","G59.x work coordinate systems are not supported."
"30","Invalid gcode ID:30","G53 only allowed with G0 and G1 motion modes."
"31","Invalid gcode ID:31","Axis words found in block when no command or current modal state uses them."
"32","Invalid gcode ID:32","G2 and G3 arcs require at least one in-plane axis word."
"33","Invalid gcode ID:33","Motion command target is invalid."
"34","Invalid gcode ID:34","Arc radius value is invalid."
"35","Invalid gcode ID:35","G2 and G3 arcs require at least one in-plane offset word."
"36","Invalid gcode ID:36","Unused value words found in block."
"37","Invalid gcode ID:37","G43.1 dynamic tool length offset is not assigned to configured tool length axis."
"38","Invalid gcode ID:38","Tool number greater than max supported value."
"39","Invalid gcode ID:39","G-code comment block incorrect format."
"40","Invalid tool","T selected tool index is not valid."
"41","Invalid feed rate","F word feedrate is still not defined."
"42","EEPROM write fail","Setting was not save due to an EEPROM writing error."
"43","EEPROM write fail","Setting was not save due to an EEPROM write protection error."
"44","Programm ended","M2 or G30 was programmed. Unlock required."
"45","Probe OK","Probe was successful."
"46", ,"Invalid gcode ID:46","G-code canned cycle missing P word."
"47", ,"Invalid gcode ID:47","G-code canned cycle missing Q word."
"48", ,"Invalid gcode ID:48","G-code canned cycle invalid G93 inverse feedrate mode active."
"49", ,"Invalid gcode ID:49","G-code canned cycle with G41 or G42 compensation radius active."
"50", ,"Invalid gcode ID:50","G-code canned cycle with spindle stopped."
"51", ,"Invalid extended gcode ID:51","G-code TMC command is invalid."
93 changes: 93 additions & 0 deletions OpenCNCPilot/Resources/ucnc_setting_codes_en_US.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
"$-Code"," Setting"," Units"," Setting Description"
"0","Step pulse time","microseconds","Sets time length per step. Minimum 3usec."
"1","Step idle delay","milliseconds","Sets a short hold delay when stopping to let dynamics settle before disabling steppers. Value 255 keeps motors enabled with no delay."
"2","Step pulse invert","mask","Inverts the step signal. Set axis bit to invert (00000ZYX)."
"3","Step direction invert","mask","Inverts the direction signal. Set axis bit to invert (00000ZYX)."
"4","Invert step enable pin","boolean","Inverts the stepper driver enable pin signal."
"5","Invert limit pins","boolean","Inverts the all of the limit input pins."
"6","Invert probe pin","boolean","Inverts the probe input pin signal."
"7","Invert control pins","mask","Inverts the control input pins signal. Bit 0 (Emergency stop) has no effect."
"10","Status report options","mask","Alters data included in status reports."
"11","Junction deviation","millimeters","Sets how fast Grbl travels through consecutive motions. Lower value slows it down."
"12","Arc tolerance","millimeters","Sets the G2 and G3 arc tracing accuracy based on radial error. Beware: A very small value may effect performance."
"13","Report in inches","boolean","Enables inch units when returning any position and rate value that is not a settings value."
"20","Soft limits enable","boolean","Enables soft limits checks within machine travel and sets alarm when exceeded. Requires homing."
"21","Hard limits enable","boolean","Enables hard limits. Immediately halts motion and throws an alarm when switch is triggered."
"22","Homing cycle enable","boolean","Enables homing cycle. Requires limit switches on all axes."
"23","Homing direction invert","mask","Homing searches for a switch in the positive direction. Set axis bit (00000ZYX) to search in negative direction."
"24","Homing locate feed rate","mm/min","Feed rate to slowly engage limit switch to determine its location accurately."
"25","Homing search seek rate","mm/min","Seek rate to quickly find the limit switch before the slower locating phase."
"26","Homing switch debounce delay","milliseconds","Sets a short delay between phases of homing cycle to let a switch debounce."
"27","Homing switch pull-off distance","millimeters","Retract distance after triggering switch to disengage it. Homing will fail if switch isn't cleared."
"30","Maximum spindle speed","RPM","Maximum spindle speed. Sets PWM to 100% duty cycle."
"31","Minimum spindle speed","RPM","Minimum spindle speed. Sets PWM to 0.4% or lowest duty cycle."
"32","Laser-mode enable","boolean","Enables laser mode. Consecutive G1/2/3 commands will not halt when spindle speed is changed."
"37","XY skew correction factor","flaot","Sets the correction factor for software skew compensation between axis X and Y."
"38","XZ skew correction factor","flaot","Sets the correction factor for software skew compensation between axis X and Z."
"39","YZ skew correction factor","flaot","Sets the correction factor for software skew compensation between axis Y and Z."
"40","PID0 Kp","float","The Kp value for PID0."
"41","PID0 Ki","float","The Ki value for PID0."
"42","PID0 Kd","float","The Kd value for PID0."
"44","PID1 Kp","float","The Kp value for PID1."
"45","PID1 Ki","float","The Ki value for PID1."
"46","PID1 Kd","float","The Kd value for PID1."
"48","PID2 Kp","float","The Kp value for PID2."
"49","PID2 Ki","float","The Ki value for PID2."
"50","PID2 Kd","float","The Kd value for PID2."
"52","PID3 Kp","float","The Kp value for PID3."
"53","PID3 Ki","float","The Ki value for PID3."
"54","PID3 Kd","float","The Kd value for PID3."
"56","PID4 Kp","float","The Kp value for PID4."
"57","PID4 Ki","float","The Ki value for PID4."
"58","PID4 Kd","float","The Kd value for PID4."
"60","PID5 Kp","float","The Kp value for PID5."
"61","PID5 Ki","float","The Ki value for PID5."
"62","PID5 Kd","float","The Kd value for PID5."
"64","PID6 Kp","float","The Kp value for PID6."
"65","PID6 Ki","float","The Ki value for PID6."
"66","PID6 Kd","float","The Kd value for PID6."
"68","PID7 Kp","float","The Kp value for PID7."
"69","PID7 Ki","float","The Ki value for PID7."
"70","PID7 Kd","float","The Kd value for PID7."
"72","PID8 Kp","float","The Kp value for PID8."
"73","PID8 Ki","float","The Ki value for PID8."
"74","PID8 Kd","float","The Kd value for PID8."
"80","Default tool at startup","value","Sets the default tool to load at startup."
"81","Tool 1 length compensation value","millimeters","Sets Tool 1 length compensation value loaded via G43 H1."
"82","Tool 2 length compensation value","millimeters","Sets Tool 2 length compensation value loaded via G43 H2."
"83","Tool 3 length compensation value","millimeters","Sets Tool 3 length compensation value loaded via G43 H3."
"84","Tool 4 length compensation value","millimeters","Sets Tool 4 length compensation value loaded via G43 H4."
"85","Tool 5 length compensation value","millimeters","Sets Tool 5 length compensation value loaded via G43 H5."
"86","Tool 6 length compensation value","millimeters","Sets Tool 6 length compensation value loaded via G43 H6."
"87","Tool 7 length compensation value","millimeters","Sets Tool 7 length compensation value loaded via G43 H7."
"88","Tool 8 length compensation value","millimeters","Sets Tool 8 length compensation value loaded via G43 H8."
"89","Tool 9 length compensation value","millimeters","Sets Tool 9 length compensation value loaded via G43 H9."
"90","Tool 10 length compensation value","millimeters","Sets Tool 10 length compensation value loaded via G43 H10."
"91","Tool 11 length compensation value","millimeters","Sets Tool 11 length compensation value loaded via G43 H11."
"92","Tool 12 length compensation value","millimeters","Sets Tool 12 length compensation value loaded via G43 H12."
"93","Tool 13 length compensation value","millimeters","Sets Tool 13 length compensation value loaded via G43 H13."
"94","Tool 14 length compensation value","millimeters","Sets Tool 14 length compensation value loaded via G43 H14."
"95","Tool 15 length compensation value","millimeters","Sets Tool 15 length compensation value loaded via G43 H15."
"96","Tool 16 length compensation value","millimeters","Sets Tool 16 length compensation value loaded via G43 H16."
"100","X-axis travel resolution","step/mm","X-axis travel resolution in steps per millimeter."
"101","Y-axis travel resolution","step/mm","Y-axis travel resolution in steps per millimeter."
"102","Z-axis travel resolution","step/mm","Z-axis travel resolution in steps per millimeter."
"106","Linear delta bot arm length","millimeters","The length of a linear delta bot arm (from the tower joint to the effector joint)."
"107","Linear delta bot arm radial difference","millimeters","The difference between the arm's tower joints and the effector joints of a linear delta bot arm (measured parallel to the base)."
"110","X-axis maximum rate","mm/min","X-axis maximum rate. Used as G0 rapid rate."
"111","Y-axis maximum rate","mm/min","Y-axis maximum rate. Used as G0 rapid rate."
"112","Z-axis maximum rate","mm/min","Z-axis maximum rate. Used as G0 rapid rate."
"120","X-axis acceleration","mm/sec^2","X-axis acceleration. Used for motion planning to not exceed motor torque and lose steps."
"121","Y-axis acceleration","mm/sec^2","Y-axis acceleration. Used for motion planning to not exceed motor torque and lose steps."
"122","Z-axis acceleration","mm/sec^2","Z-axis acceleration. Used for motion planning to not exceed motor torque and lose steps."
"130","X-axis maximum travel","millimeters","Maximum X-axis travel distance from homing switch. Determines valid machine space for soft-limits and homing search distances."
"131","Y-axis maximum travel","millimeters","Maximum Y-axis travel distance from homing switch. Determines valid machine space for soft-limits and homing search distances."
"132","Z-axis maximum travel","millimeters","Maximum Z-axis travel distance from homing switch. Determines valid machine space for soft-limits and homing search distances."
"140","Stepper 0 backlash","steps","The backlash value in steps for stepper motor 0."
"141","Stepper 1 backlash","steps","The backlash value in steps for stepper motor 1."
"142","Stepper 2 backlash","steps","The backlash value in steps for stepper motor 2."
"143","Stepper 3 backlash","steps","The backlash value in steps for stepper motor 3."
"144","Stepper 4 backlash","steps","The backlash value in steps for stepper motor 4."
"145","Stepper 5 backlash","steps","The backlash value in steps for stepper motor 5."
"146","Stepper 6 backlash","steps","The backlash value in steps for stepper motor 6."
"147","Stepper 7 backlash","steps","The backlash value in steps for stepper motor 7."
23 changes: 15 additions & 8 deletions OpenCNCPilot/SettingsWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<Window x:Class="OpenCNCPilot.SettingsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OpenCNCPilot"
xmlns:util="clr-namespace:OpenCNCPilot.Util"
mc:Ignorable="d"
Title="SettingsWindow" Height="300" Width="390" Closed="Window_Closed" ResizeMode="NoResize">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OpenCNCPilot"
xmlns:util="clr-namespace:OpenCNCPilot.Util"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
Title="SettingsWindow" Height="310" Width="390" Closed="Window_Closed" ResizeMode="NoResize">
<Window.Resources>
<Style TargetType="TextBox">
<Setter Property="VerticalContentAlignment" Value="Center"/>
Expand Down Expand Up @@ -69,6 +70,12 @@

<CheckBox Content="Log traffic to file" HorizontalAlignment="Left" Margin="116,174,0,0" VerticalAlignment="Top" IsChecked="{util:SettingBinding LogTraffic}" ToolTip="Restart required to take effect"/>
<CheckBox Content="Ignore Additional Axes in Status Messages" HorizontalAlignment="Left" Margin="116,194,0,0" VerticalAlignment="Top" IsChecked="{util:SettingBinding IgnoreAdditionalAxes}" ToolTip="Compatibility with custom GRBL versions which report 4+ axes in status reports"/>

<Label Content="Board firmware" HorizontalAlignment="Left" Margin="135,212,0,0" VerticalAlignment="Top"/>
<ComboBox x:Name="FirmwareType" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" Margin="10,214,0,0" SelectedItem="{util:SettingBinding FirmwareType}" SelectionChanged="FirmwareType_SelectionChanged">
<sys:String>Grbl</sys:String>
<sys:String>uCNC</sys:String>
</ComboBox>
</Grid>
</TabItem>

Expand Down
Loading

0 comments on commit 02f9531

Please sign in to comment.