增加CAN读取逆变器的选项

修改波特率的下拉框选择
This commit is contained in:
2025-09-13 09:57:02 +08:00
parent 8e0c063fc3
commit 0c43c2103a
6 changed files with 89 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>

View File

@@ -60,6 +60,29 @@ namespace CapMachine.Wpf.ViewModels
EventAggregator.GetEvent<LogicRuleChangeEvent>().Subscribe(LogicRuleChangeEventCall);
//数据波特率
DataBaudRateCbxItems = new ObservableCollection<CbxItems>()
{
new CbxItems(){ Key="100000",Text="100 Kbps"},
new CbxItems(){ Key="125000",Text="125 Kbps"},
new CbxItems(){ Key="200000",Text="200 Kbps"},
new CbxItems(){ Key="250000",Text="250 Kbps"},
new CbxItems(){ Key="400000",Text="400 Kbps"},
new CbxItems(){ Key="500000",Text="500 Kbps"},
new CbxItems(){ Key="666000",Text="666 Kbps"},
new CbxItems(){ Key="800000",Text="800 Kbps"},
new CbxItems(){ Key="1000000",Text="1.0 Mbps"},
new CbxItems(){ Key="1500000",Text="1.5 Mbps"},
new CbxItems(){ Key="2000000",Text="2.0 Mbps"},
new CbxItems(){ Key="3000000",Text="3.0 Mbps"},
new CbxItems(){ Key="4000000",Text="4.0 Mbps"},
new CbxItems(){ Key="5000000",Text="5.0 Mbps"},
new CbxItems(){ Key="6700000",Text="6.7 Mbps"},
new CbxItems(){ Key="8000000",Text="8.0 Mbps"},
new CbxItems(){ Key="10000000",Text="10.0 Mbps"},
};
WriteNameCbxItems = new ObservableCollection<CbxItems>()
{
new CbxItems(){ Key="转速",Text="转速"},
@@ -82,6 +105,7 @@ namespace CapMachine.Wpf.ViewModels
new CbxItems(){ Key="通讯母线电流",Text="通讯母线电流"},
new CbxItems(){ Key="通讯相电流",Text="通讯相电流"},
new CbxItems(){ Key="通讯功率",Text="通讯功率"},
new CbxItems(){ Key="通讯逆变器温度",Text="通讯逆变器温度"},
new CbxItems(){ Key="通讯芯片温度",Text="通讯芯片温度"},
new CbxItems(){ Key="通讯PTC入水温度",Text="通讯PTC入水温度"},
@@ -120,6 +144,8 @@ namespace CapMachine.Wpf.ViewModels
/// </summary>
public IDialogService DialogService { get; }
#region
@@ -1106,6 +1132,17 @@ namespace CapMachine.Wpf.ViewModels
}
private ObservableCollection<CbxItems> _DataBaudRateCbxItems;
/// <summary>
/// CAN 数据波特率
/// </summary>
public ObservableCollection<CbxItems> DataBaudRateCbxItems
{
get { return _DataBaudRateCbxItems; }
set { _DataBaudRateCbxItems = value; RaisePropertyChanged(); }
}
#endregion

View File

@@ -114,13 +114,13 @@ namespace CapMachine.Wpf.ViewModels
ReadNameCbxItems = new ObservableCollection<CbxItems>()
{
new CbxItems(){ Key="通讯Cmp转速",Text="通讯Cmp转速"},
new CbxItems(){ Key="通讯Cmp母线电压",Text="通讯Cmp母线电压"},
new CbxItems(){ Key="通讯Cmp母线电流",Text="通讯Cmp母线电流"},
new CbxItems(){ Key="通讯Cmp逆变器温度",Text="通讯Cmp逆变器温度"},
new CbxItems(){ Key="通讯Cmp相电流",Text="通讯Cmp相电流"},
new CbxItems(){ Key="通讯Cmp功率",Text="通讯Cmp功率"},
new CbxItems(){ Key="通讯Cmp芯片温度",Text="通讯Cmp芯片温度"},
new CbxItems(){ Key="通讯转速",Text="通讯转速"},
new CbxItems(){ Key="通讯母线电压",Text="通讯母线电压"},
new CbxItems(){ Key="通讯母线电流",Text="通讯母线电流"},
new CbxItems(){ Key="通讯逆变器温度",Text="通讯逆变器温度"},
new CbxItems(){ Key="通讯相电流",Text="通讯相电流"},
new CbxItems(){ Key="通讯功率",Text="通讯功率"},
new CbxItems(){ Key="通讯芯片温度",Text="通讯芯片温度"},
new CbxItems(){ Key="通讯PTC入水温度",Text="通讯PTC入水温度"},
new CbxItems(){ Key="通讯PTC出水温度",Text="通讯PTC出水温度"},

View File

@@ -55,6 +55,18 @@ namespace CapMachine.Wpf.ViewModels
//MachineDataService = machineDataService;
DialogService = dialogService;
//数据波特率
DataBaudRateCbxItems = new ObservableCollection<CbxItems>()
{
new CbxItems(){ Key="38400",Text="38400"},
new CbxItems(){ Key="19200",Text="19200"},
new CbxItems(){ Key="14400",Text="14400"},
new CbxItems(){ Key="9600",Text="9600"},
new CbxItems(){ Key="4800",Text="4800"},
new CbxItems(){ Key="2400",Text="2400"},
};
WriteNameCbxItems = new ObservableCollection<CbxItems>()
{
new CbxItems(){ Key="转速",Text="转速"},
@@ -70,6 +82,7 @@ namespace CapMachine.Wpf.ViewModels
new CbxItems(){ Key="通讯母线电流",Text="通讯母线电流"},
new CbxItems(){ Key="通讯相电流",Text="通讯相电流"},
new CbxItems(){ Key="通讯功率",Text="通讯功率"},
new CbxItems(){ Key="通讯逆变器温度",Text="通讯逆变器温度"},
new CbxItems(){ Key="通讯芯片温度",Text="通讯芯片温度"},
};
InitLoadLinConfigPro();
@@ -771,6 +784,18 @@ namespace CapMachine.Wpf.ViewModels
#region LIN操作
private ObservableCollection<CbxItems> _DataBaudRateCbxItems;
/// <summary>
/// CAN 数据波特率
/// </summary>
public ObservableCollection<CbxItems> DataBaudRateCbxItems
{
get { return _DataBaudRateCbxItems; }
set { _DataBaudRateCbxItems = value; RaisePropertyChanged(); }
}
private LINConfigExdDto _SelectedLINConfigExdDto;
/// <summary>
/// 选中的LIN操作

View File

@@ -397,6 +397,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,10,0"
@@ -405,9 +406,17 @@
FontSize="18"
Text="&#xe9f8;" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="波特率" />
<TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding SelectedCANConfigExdDto.BaudRate}" />
<ComboBox
Width="100"
DisplayMemberPath="Text"
FontSize="16"
ItemsSource="{Binding DataBaudRateCbxItems}"
SelectedValue="{Binding SelectedCANConfigExdDto.BaudRate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Key" />
<!--<TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding SelectedCANConfigExdDto.BaudRate}" />-->
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<TextBlock
Margin="10,0,10,0"

View File

@@ -398,6 +398,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,10,0"
@@ -406,7 +407,14 @@
FontSize="18"
Text="&#xe9f8;" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="波特率" />
<TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding SelectedLINConfigExdDto.BaudRate}" />
<ComboBox
Width="100"
DisplayMemberPath="Text"
FontSize="16"
ItemsSource="{Binding DataBaudRateCbxItems}"
SelectedValue="{Binding SelectedLINConfigExdDto.BaudRate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Key" />
<!--<TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding SelectedLINConfigExdDto.BaudRate}" />-->
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal">