This commit is contained in:
2026-04-20 14:03:01 +08:00
parent 4e3e3be090
commit 343e575339
18 changed files with 93 additions and 826 deletions

View File

@@ -28,13 +28,14 @@ namespace 头罩视野.Views
private TcpClient _tcpClient => ModbusResourceManager.Instance.TcpClient;
private IModbusMaster _modbusMaster => ModbusResourceManager.Instance.ModbusMaster;
DispatcherTimer _timer;
DataChange c = new DataChange();
Function ma;
public PageTest()
{
InitializeComponent();
InitializeModbusTcp();
_timer = InitDispatcherTimer();
}
//复位btn
@@ -53,7 +54,7 @@ namespace 头罩视野.Views
{
ma.BtnClickFunction(Function.ButtonType., 1);
}
//反转
//反转
private void Button_Click_Res(object sender, RoutedEventArgs e)
{
ma.BtnClickFunction(Function.ButtonType., 10);
@@ -79,7 +80,7 @@ namespace 头罩视野.Views
private void Button_Click_Print(object sender, RoutedEventArgs e)
{
ma.BtnClickFunction(Function.ButtonType., 103);
}
@@ -92,7 +93,7 @@ namespace 头罩视野.Views
}
private void RadioButton_Unchecked(object sender, RoutedEventArgs e)
{
{
ma.BtnClickFunction(Function.ButtonType., 41);
@@ -151,7 +152,7 @@ namespace 头罩视野.Views
ShowError($"读取数据失败:{ex.Message}");
}
}
// 地址, 根据格式显示字符长度 322 161 绑定页面的name 值F2 保留两位小数,单位
// 地址, 根据格式显示字符长度 322 161 绑定页面的name 值F2 保留两位小数,单位
private async Task ReadAndUpdateFloatAsync(int address, int length, System.Windows.Controls.TextBox control, string format, string unit)
{
try
@@ -287,8 +288,9 @@ namespace 头罩视野.Views
}
private void Page_Loaded(object sender, RoutedEventArgs e)
{
InitializeModbusTcp();
//InitializeModbusTcp();
_timer.Start();
}
}
}