Skip to content

Commit

Permalink
Release 2.0.38, se changelog for details
Browse files Browse the repository at this point in the history
  • Loading branch information
terjeio committed Jun 13, 2022
1 parent 7131356 commit 3e76e54
Show file tree
Hide file tree
Showing 57 changed files with 560 additions and 429 deletions.
6 changes: 3 additions & 3 deletions CNC Controls Camera/CNC Controls Camera/Camera.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Camera.xaml.cs - part of CNC Controls Camera library
*
* v0.37 / 2022-03-02 / Io Engineering (Terje Io)
* v0.38 / 2022-04-20 / Io Engineering (Terje Io)
*
*/

Expand Down Expand Up @@ -108,8 +108,8 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs
e.Cancel = true;
Hide();
}
else
CNCCamera.CloseCurrentVideoSource();

CNCCamera.CloseCurrentVideoSource();

IsVisibilityChanged?.Invoke();
}
Expand Down
8 changes: 4 additions & 4 deletions CNC Controls Camera/CNC Controls Camera/CameraControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* CameraControl.xaml.cs - part of CNC Controls Camera library
*
* v0.37 / 2022-03-02 / Io Engineering (Terje Io)
* v0.38 / 2022-04-20 / Io Engineering (Terje Io)
*
*/

Expand Down Expand Up @@ -250,12 +250,12 @@ private void btnMove_Click(object sender, RoutedEventArgs e)
if (!AppConfig.Settings.Camera.ConfirmMove || MessageBox.Show(UIUtils.TryFindParent<Window>(this), (string)FindResource(MoveCameraToSpindlePosition ? "MoveCameraTo" : "MoveSpindleTo"), "ioSender", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
{
if (MoveCameraToSpindlePosition)
{
MoveCameraToSpindlePosition = false;
MoveOffset?.Invoke(Mode, -XOffset, -YOffset);
}
else
MoveOffset?.Invoke(Mode, XOffset, YOffset);

if (AppConfig.Settings.Camera.InitialMoveToSpindle)
MoveCameraToSpindlePosition = !MoveCameraToSpindlePosition;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,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("2.0.37.0")]
[assembly: AssemblyFileVersion("2.0.37.0")]
[assembly: AssemblyVersion("2.0.38.0")]
[assembly: AssemblyFileVersion("2.0.38.0")]
18 changes: 16 additions & 2 deletions CNC Controls Probing/CNC Controls Probing/Converters.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* Converters.cs - part of CNC Probing library
*
* v0.14 / 2020-03-29 / Io Engineering (Terje Io)
* v0.38 / 2022-04-20 / Io Engineering (Terje Io)
*
*/

/*
Copyright (c) 2019-2020, Io Engineering (Terje Io)
Copyright (c) 2019-2022, Io Engineering (Terje Io)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -47,6 +47,7 @@ namespace CNC.Controls.Probing
public static class Converters
{
public static EnumValueToVisibleConverter EnumValueToVisibleConverter = new EnumValueToVisibleConverter();
public static OriginToBooleanConverter OriginToBooleanConverter = new OriginToBooleanConverter();
}

public class EnumValueToVisibleConverter : IMultiValueConverter
Expand All @@ -65,4 +66,17 @@ public object[] ConvertBack(object value, Type[] targetTypes, object parameter,
throw new NotImplementedException();
}
}

public class OriginToBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is OriginControl.Origin && (OriginControl.Origin)value == OriginControl.Origin.None;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool)value ? OriginControl.Origin.None : OriginControl.Origin.Center;
}
}
}
2 changes: 1 addition & 1 deletion CNC Controls Probing/CNC Controls Probing/ProbingView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<TextBlock Text="{Binding Path=Position, Mode=OneWay}" TextWrapping="NoWrap" Height="25" Width="235" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>
</DockPanel>
<StackPanel DockPanel.Dock="Right" Margin="0,10,0,0" Width="635" HorizontalAlignment="Left" VerticalAlignment="Top">
<TabControl x:Name="tab" HorizontalAlignment="Stretch" VerticalAlignment="Top" Width="Auto" Height="410" SelectionChanged="tab_SelectionChanged">
<TabControl x:Name="tab" HorizontalAlignment="Stretch" VerticalAlignment="Top" Width="Auto" Height="Auto" SelectionChanged="tab_SelectionChanged">
<TabItem x:Uid="tab_toolOffset" Header="Tool length offset">
<local:ToolLengthControl HorizontalAlignment="Left" VerticalAlignment="Top"/>
</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,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("2.0.37.0")]
[assembly: AssemblyFileVersion("2.0.37.0")]
[assembly: AssemblyVersion("2.0.38.0")]
[assembly: AssemblyFileVersion("2.0.38.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<Controls:LogicalNotConverter x:Key="IsNotRunningConverter" />
<Controls:EnumValueToBooleanConverter x:Key="EnumToEdgeConverter" />
<Controls:BoolToVisibleConverter x:Key="ToVisibleConverter" />
<local:EnumValueToVisibleConverter x:Key="ZProbeIsVisibleConverter"/>
<local:OriginToBooleanConverter x:Key="UseX0Y0Converter" />
<local:EnumValueToVisibleConverter x:Key="ZProbeIsVisibleConverter" />
<Style x:Key="ButtonStyleNoHighlighting" TargetType="Button" BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
<Setter Property="Template">
<Setter.Value>
Expand Down Expand Up @@ -69,15 +70,15 @@
<GroupBox x:Uid="grp_RotationCenter" Header="Rotation center" HorizontalAlignment="Left" Margin="5,0" ToolTip="Click to select rotation center relative to job, if not selected X0,Y0 is used.">
<StackPanel Orientation="Horizontal">
<Controls:OriginControl Value="{Binding Path=Origin, Mode=TwoWay}" IsEnabled="{Binding Path=Grbl.IsFileLoaded}" Margin="5,5,0,0"/>
<Button x:Uid="btn_useX0Y0" Content="Use X0,Y0" IsEnabled="{Binding Path=Grbl.IsFileLoaded}" Margin="8,0,5,3" Width="75" Focusable="False" Click="use00_Click" VerticalAlignment="Bottom"/>
<CheckBox x:Uid="chk_useX0Y0" Content="Use X0,Y0" Margin="8,30,5,3" IsEnabled="{Binding Path=Grbl.IsFileLoaded}" IsChecked="{Binding Path=Origin, Mode=TwoWay, Converter={StaticResource UseX0Y0Converter}}"/>
</StackPanel>
</GroupBox>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,5,0,5">
<CheckBox x:Uid="lbl_preview" Content="Preview" Margin="15,0,0,0" IsChecked="{Binding Path=PreviewEnable}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Grid x:Uid="grd_action" ToolTip="Click edge to select probing action." Width="160" Height="160" Margin="5,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid x:Name="grd_action" x:Uid="grd_action" ToolTip="Click edge to select probing action." Width="160" Height="160" Margin="5,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="80" />
<RowDefinition Height="80" />
Expand Down
26 changes: 12 additions & 14 deletions CNC Controls Probing/CNC Controls Probing/RotationControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* RotationControl.xaml.cs - part of CNC Probing library
*
* v0.37 / 2022-02-21 / Io Engineering (Terje Io)
* v0.38 / 2022-05-01 / Io Engineering (Terje Io)
*
*/

Expand Down Expand Up @@ -79,7 +79,11 @@ private void Probing_PropertyChanged(object sender, System.ComponentModel.Proper
{
var probing = DataContext as ProbingViewModel;

probing.CanApplyTransform = probing.CameraPositions == 2;
if (probing.CameraPositions == 1 && probing.ProbeEdge == Edge.None)
probing.PreviewText += ((string)grd_action.ToolTip).Replace('.', '!');

if ((probing.CanApplyTransform = probing.CameraPositions == 2 && probing.ProbeEdge != Edge.None))
getAngle();
}
}

Expand Down Expand Up @@ -183,17 +187,15 @@ private void addpos ()

private void OnCompleted()
{
bool ok;

var probing = DataContext as ProbingViewModel;

if ((probing.CanApplyTransform = probing.IsSuccess && probing.Positions.Count == 2))
{
getAngle();
}
probing.CanApplyTransform = probing.IsSuccess && probing.Positions.Count == 2;

probing.Program.End((string)FindResource(probing.CanApplyTransform ? "ProbingCompleted" : "ProbingFailed"));

if (probing.CanApplyTransform)
getAngle();

if (!probing.Grbl.IsParserStateLive && probing.CoordinateMode == ProbingViewModel.CoordMode.G92)
probing.Grbl.ExecuteCommand(GrblConstants.CMD_GETPARSERSTATE);

Expand All @@ -208,7 +210,7 @@ private void PreviewOnCompleted()
probing.Program.Clear();
}

private double getAngle ()
private double getAngle()
{
var probing = DataContext as ProbingViewModel;

Expand All @@ -217,7 +219,7 @@ private double getAngle ()
if (probing.ProbeEdge == Edge.CB || probing.ProbeEdge == Edge.AD)
angle = -1.0d / angle;

probing.Grbl.Message = string.Format((string)FindResource("ProbedAngle"), Math.Round(Math.Atan(angle) * 180d / Math.PI, 1).ToString());
probing.Grbl.Message = string.Format((string)FindResource("ProbedAngle"), Math.Round(Math.Atan(angle) * 180d / Math.PI, 3).ToInvariantString());

return angle;
}
Expand All @@ -231,10 +233,6 @@ private void stop_Click(object sender, RoutedEventArgs e)
{
Stop();
}
private void use00_Click(object sender, RoutedEventArgs e)
{
(DataContext as ProbingViewModel).Origin = OriginControl.Origin.None;
}

private void apply_Click(object sender, RoutedEventArgs e)
{
Expand Down
6 changes: 3 additions & 3 deletions CNC Controls/CNC Controls/AppConfig.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* AppConfig.cs - part of CNC Controls library
*
* v0.37 / 2022-03-02 / Io Engineering (Terje Io)
* v0.38 / 2022-04-20 / Io Engineering (Terje Io)
*
*/

Expand Down Expand Up @@ -725,8 +725,8 @@ public RestartResult Restart ()
else
{
MessageBox.Show(response == string.Empty
? "No respone received from controller, exiting."
: string.Format("Unexpected response received from controller: \"{0}\", exiting.", response),
? LibStrings.FindResource("MsgNoResponseExit")
: string.Format(LibStrings.FindResource("MsgBadResponseExit"), response),
"ioSender", MessageBoxButton.OK, MessageBoxImage.Stop);
return RestartResult.Exit;
}
Expand Down
14 changes: 7 additions & 7 deletions CNC Controls/CNC Controls/GCodeRotateDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* GCodeRotateDialog.xaml.cs - part of CNC Controls library for Grbl
*
* v0.33 / 2021-05-14 / Io Engineering (Terje Io)
* v0.38 / 2022-05-08 / Io Engineering (Terje Io)
*
*/

/*
Copyright (c) 2021, Io Engineering (Terje Io)
Copyright (c) 2021-2022, Io Engineering (Terje Io)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -125,23 +125,23 @@ public void Apply()
break;

case OriginControl.Origin.Center:
offset = new RP.Math.Vector3(limits.MaxX / 2d, limits.MaxY / 2d, 0d);
offset = new RP.Math.Vector3(limits.MinX + limits.SizeX / 2d, limits.MinY + limits.SizeY / 2d, 0d);
break;

case OriginControl.Origin.AB:
offset = new RP.Math.Vector3(limits.MaxX / 2d, limits.MinY, 0d);
offset = new RP.Math.Vector3(limits.MinX + limits.SizeX / 2d, limits.MinY, 0d);
break;

case OriginControl.Origin.AD:
offset = new RP.Math.Vector3(limits.MinX, limits.MaxY / 2d, 0d);
offset = new RP.Math.Vector3(limits.MinX, limits.MinY + limits.SizeY / 2d, 0d);
break;

case OriginControl.Origin.CB:
offset = new RP.Math.Vector3(limits.MaxX, limits.MaxY / 2d, 0d);
offset = new RP.Math.Vector3(limits.MaxX, limits.MinY + limits.SizeY / 2d, 0d);
break;

case OriginControl.Origin.CD:
offset = new RP.Math.Vector3(limits.MaxX / 2d, limits.MaxY, 0d);
offset = new RP.Math.Vector3(limits.MinX + limits.SizeX / 2d, limits.MaxY, 0d);
break;

default: // Origin.None -> 0,0
Expand Down
2 changes: 2 additions & 0 deletions CNC Controls/CNC Controls/LibStrings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<system:String x:Uid="str_msgNoComm" x:Key="MsgNoComm">Controller is in {0} state and cannot respond, try a soft reset?</system:String>
<system:String x:Uid="str_msgResetExit" x:Key="MsgResetExit">Controller soft reset failed, exiting.</system:String>
<system:String x:Uid="str_msgNoResponse" x:Key="MsgNoResponse">Controller is not responding!</system:String>
<system:String x:Uid="str_msgNoResponseExit" x:Key="MsgNoResponseExit">No response received from controller, exiting.</system:String>
<system:String x:Uid="str_msgBadResponseExit" x:Key="MsgBadResponseExit">Unexpected response received from controller: {0}, exiting.</system:String>
<system:String x:Uid="str_grblStateUnknown" x:Key="StateUnknown">UNKNOWN</system:String>
<system:String x:Uid="str_grblStateIdle" x:Key="StateIdle">IDLE</system:String>
<system:String x:Uid="str_grblStateRun" x:Key="StateRun">RUN</system:String>
Expand Down
30 changes: 24 additions & 6 deletions CNC Controls/CNC Controls/NumericTextBox.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* NumericTextBox.cs - part of CNC Controls library
*
* v0.14 / 2020-03-20 / Io Engineering (Terje Io)
* v0.38 / 2022-06-13 / Io Engineering (Terje Io)
*
*/

/*
Copyright (c) 2018-2020, Io Engineering (Terje Io)
Copyright (c) 2018-2022, Io Engineering (Terje Io)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -67,7 +67,7 @@ public NumericTextBox()
DependencyProperty.Register(nameof(Value), typeof(double), typeof(NumericTextBox), new PropertyMetadata(double.NaN, new PropertyChangedCallback(OnValueChanged)));
public double Value
{
get { return (double)GetValue(ValueProperty); }
get { double v = (double)GetValue(ValueProperty); return v == double.NaN ? 0d : v; }
set { SetValue(ValueProperty, value); }
}
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
Expand Down Expand Up @@ -98,9 +98,9 @@ private static void OnFormatChanged(DependencyObject d, DependencyPropertyChange
public new void Clear()
{
updateText = false;
Value = 0.0d;
Value = double.NaN;
updateText = true;
Text = "";
Text = string.Empty;
}

protected override void OnPreviewKeyUp(KeyEventArgs e)
Expand All @@ -112,7 +112,7 @@ protected override void OnPreviewKeyUp(KeyEventArgs e)
string text = SelectionLength > 0 ? Text.Remove(SelectionStart, SelectionLength) : Text;

updateText = false;
Value = double.Parse(text == "" || text == "." || text == "-" || text == "-." ? "0" : text, np.Styles, CultureInfo.InvariantCulture);
Value = double.Parse(text == string.Empty || text == "." || text == "-" || text == "-." ? "0" : text, np.Styles, CultureInfo.InvariantCulture);
updateText = true;
}
}
Expand All @@ -131,5 +131,23 @@ protected override void OnPreviewTextInput(TextCompositionEventArgs e)

base.OnPreviewTextInput(e);
}

protected override void OnTextChanged(TextChangedEventArgs e)
{
double val = 0d;
if (double.TryParse(Text == string.Empty ? "NaN" : Text, np.Styles, CultureInfo.InvariantCulture, out val))
{
if (!IsReadOnly && IsEnabled)
{
updateText = false;
Value = val;
updateText = true;
}

base.OnTextChanged(e);
}
else
Text = Math.Round(Value, (np.Precision)).ToString(np.DisplayFormat, CultureInfo.InvariantCulture);
}
}
}
4 changes: 2 additions & 2 deletions CNC Controls/CNC Controls/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,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("2.0.37.0")]
[assembly: AssemblyFileVersion("2.0.37.0")]
[assembly: AssemblyVersion("2.0.38.0")]
[assembly: AssemblyFileVersion("2.0.38.0")]
6 changes: 3 additions & 3 deletions CNC Controls/CNC Controls/Widget.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* Widget.cs - part of CNC Controls library for Grbl
*
* v0.34 / 2021-07-18 / Io Engineering (Terje Io)
* v0.38 / 2022-03-21 / Io Engineering (Terje Io)
*
*/

/*
Copyright (c) 2018-2021, Io Engineering (Terje Io)
Copyright (c) 2018-2022, Io Engineering (Terje Io)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -81,7 +81,7 @@ public class WidgetProperties

public void Assign (string value)
{
properties.Value = value;
properties.Value = Value = value;
}

public WidgetProperties(GrblSettingDetails Properties)
Expand Down
Loading

0 comments on commit 3e76e54

Please sign in to comment.