Skip to content

Commit

Permalink
fixed Status Parse Error for non-English Systems
Browse files Browse the repository at this point in the history
  • Loading branch information
martin2250 committed Jun 13, 2017
1 parent a06b4e6 commit e9da466
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 27 deletions.
51 changes: 27 additions & 24 deletions OpenCNCPilot/Communication/Machine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -644,32 +644,35 @@ private void UpdateStatus(string line)
if (!Connected)
return;

//we use a Regex here so G91.1 etc don't get recognized as G91

foreach (Match m in GCodeSplitter.Matches(line))
try
{
if (m.Groups[1].Value != "G")
continue;

float code = float.Parse(m.Groups[2].Value);

if (code == 17)
Plane = ArcPlane.XY;
if (code == 18)
Plane = ArcPlane.YZ;
if (code == 19)
Plane = ArcPlane.ZX;

if (code == 20)
Unit = ParseUnit.Imperial;
if (code == 21)
Unit = ParseUnit.Metric;

if (code == 90)
DistanceMode = ParseDistanceMode.Absolute;
if (code == 91)
DistanceMode = ParseDistanceMode.Incremental;
//we use a Regex here so G91.1 etc don't get recognized as G91
foreach (Match m in GCodeSplitter.Matches(line))
{
if (m.Groups[1].Value != "G")
continue;

float code = float.Parse(m.Groups[2].Value, Constants.DecimalParseFormat);

if (code == 17)
Plane = ArcPlane.XY;
if (code == 18)
Plane = ArcPlane.YZ;
if (code == 19)
Plane = ArcPlane.ZX;

if (code == 20)
Unit = ParseUnit.Imperial;
if (code == 21)
Unit = ParseUnit.Metric;

if (code == 90)
DistanceMode = ParseDistanceMode.Absolute;
if (code == 91)
DistanceMode = ParseDistanceMode.Incremental;
}
}
catch { RaiseEvent(NonFatalException, "Error while Parsing Status Message"); }
}

private static Regex StatusEx = new Regex(@"(?<=[<|])(\w+):?(([0-9\.-]*),?([0-9\.-]*)?,?([0-9\.,-]*)?)?(?=[|>])", RegexOptions.Compiled);
Expand Down
2 changes: 1 addition & 1 deletion OpenCNCPilot/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private void UnhandledException(object sender, UnhandledExceptionEventArgs ea)
}
catch { }

System.Environment.Exit(1);
Environment.Exit(1);
}

private void Default_SettingChanging(object sender, System.Configuration.SettingChangingEventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions OpenCNCPilot/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.1.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]
[assembly: AssemblyVersion("1.3.2.0")]
[assembly: AssemblyFileVersion("1.3.2.0")]

0 comments on commit e9da466

Please sign in to comment.