Bläddra i källkod

Fix bug: Incorrect data type in variable ActiveAutoTune

SenGao 1 vecka sedan
förälder
incheckning
e4735e2a07

+ 10 - 1
Tools/Mini8SlaveSim/ViewModels/Mini8TabViewModel.cs

@@ -242,6 +242,15 @@ public partial class Mini8TabViewModel : ObservableObject
                             _ => throw new NotImplementedException(),
                         };
                     }
+                    else if(pointName == "ActiveAutoTune")
+                    {
+                        valueStr = value switch
+                        {
+                            (ushort)AutotuneActive.OFF => AutotuneActive.OFF.ToString(),
+                            (ushort)AutotuneActive.Active => AutotuneActive.Active.ToString(),
+                            _ => throw new NotImplementedException(),
+                        };
+                    }
                     else
                     {
                         valueStr = value.ToString();
@@ -337,7 +346,7 @@ public partial class Mini8TabViewModel : ObservableObject
             AddData(nameof(ch.Value.Running_I), ch.Key, ch.Value.Running_I, DataType.Float);
             AddData(nameof(ch.Value.Running_D), ch.Key, ch.Value.Running_D, DataType.Float);
             AddData(nameof(ch.Value.Inhibit), ch.Key, ch.Value.Inhibit, DataType.UShort);
-            AddData(nameof(ch.Value.ActiveAutoTune), ch.Key, ch.Value.ActiveAutoTune, DataType.Float);
+            AddData(nameof(ch.Value.ActiveAutoTune), ch.Key, ch.Value.ActiveAutoTune, DataType.UShort);
             AddData(nameof(ch.Value.SetpointUpRate), ch.Key, ch.Value.SetpointUpRate, DataType.Float);
             AddData(nameof(ch.Value.SetpointDownRate), ch.Key, ch.Value.SetpointDownRate, DataType.Float);
             AddData(nameof(ch.Value.Caps), ch.Key, ch.Value.Caps, DataType.UShort);

+ 1 - 1
Tools/Mini8SlaveSim/Views/Mini8Tab.xaml

@@ -44,7 +44,7 @@
             <Label Content="Point:" HorizontalAlignment="Center" VerticalAlignment="Center"/>
             <TextBox Text="{Binding RegisterName}" IsEnabled="False" Height="25" Width="150" HorizontalAlignment="Center" VerticalAlignment="Center"/>
             <Label Content="Ch:" HorizontalAlignment="Center" VerticalAlignment="Center"/>
-            <TextBox Text="{Binding ChannelNumber}" Height="25" Width="150" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+            <TextBox Text="{Binding ChannelNumber}" IsEnabled="False" Height="25" Width="150" HorizontalAlignment="Center" VerticalAlignment="Center"/>
             <Label Content="Value:" HorizontalAlignment="Center" VerticalAlignment="Center"/>
             <TextBox Text="{Binding WriteValue}" Height="25" Width="150" HorizontalAlignment="Center" VerticalAlignment="Center"/>
             <Button Content="Write" Command="{Binding WriteCommand}" Margin="20,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Height="25" Width="50"/>