111
This commit is contained in:
@@ -36,7 +36,7 @@ namespace 头罩视野.Views
|
|||||||
//// 定时采集用
|
//// 定时采集用
|
||||||
private DispatcherTimer testTimer;
|
private DispatcherTimer testTimer;
|
||||||
|
|
||||||
private DispatcherTimer testTimerForLight;
|
//private DispatcherTimer testTimerForLight;
|
||||||
// 保存上一条数据(用于去重)
|
// 保存上一条数据(用于去重)
|
||||||
private TestDataStore.TestRecord? _lastRecord;
|
private TestDataStore.TestRecord? _lastRecord;
|
||||||
|
|
||||||
@@ -69,9 +69,9 @@ namespace 头罩视野.Views
|
|||||||
testTimer.Tick += Timer_Tick;
|
testTimer.Tick += Timer_Tick;
|
||||||
|
|
||||||
|
|
||||||
testTimerForLight = new DispatcherTimer();
|
//testTimerForLight = new DispatcherTimer();
|
||||||
testTimerForLight.Interval = TimeSpan.FromMilliseconds(1000); // 500ms = 0.5秒
|
//testTimerForLight.Interval = TimeSpan.FromMilliseconds(1000); // 500ms = 0.5秒
|
||||||
testTimerForLight.Tick += testTimerForLightTick;
|
//testTimerForLight.Tick += testTimerForLightTick;
|
||||||
|
|
||||||
//// 判断连接
|
//// 判断连接
|
||||||
if (!ModbusHelper.IsConnected)
|
if (!ModbusHelper.IsConnected)
|
||||||
@@ -334,27 +334,32 @@ namespace 头罩视野.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private async void testTimerForLightTick(object sender, EventArgs e)
|
//private async void testTimerForLightTick(object sender, EventArgs e)
|
||||||
{
|
//{
|
||||||
if (_modbusMaster == null)
|
// if (_modbusMaster == null)
|
||||||
return;
|
// return;
|
||||||
ma.BtnClickFunction(Function.ButtonType.切换型, 1);
|
// await _modbusMaster.ReadCoilsAsync(1, 1, 1);
|
||||||
|
|
||||||
var ret = await _modbusMaster.ReadCoilsAsync(1, 1, 1);
|
// var ret = await _modbusMaster.ReadCoilsAsync(1, 1, 1);
|
||||||
if (ret != null && ret.Length > 0)
|
// if (ret != null && ret.Length > 0)
|
||||||
{
|
// {
|
||||||
if (ret[0])
|
// if (ret[0])
|
||||||
{
|
// {
|
||||||
LedOn(led0);
|
// LedOn(led0);
|
||||||
LedOff(led1);
|
// LedOff(led1);
|
||||||
}
|
// btnLeft.Content = "左眼关";
|
||||||
else
|
// btnRight.Content = "右眼开";
|
||||||
{
|
// }
|
||||||
LedOn(led1);
|
// else
|
||||||
LedOff(led0);
|
// {
|
||||||
}
|
// LedOn(led1);
|
||||||
}
|
// LedOff(led0);
|
||||||
}
|
|
||||||
|
// btnLeft.Content = "左眼开";
|
||||||
|
// btnRight.Content = "右眼关";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
//计算
|
//计算
|
||||||
private async Task calCurrentangle()
|
private async Task calCurrentangle()
|
||||||
{
|
{
|
||||||
@@ -802,7 +807,7 @@ namespace 头罩视野.Views
|
|||||||
_timer.Start();
|
_timer.Start();
|
||||||
ma = new Function(_modbusMaster);
|
ma = new Function(_modbusMaster);
|
||||||
c = new DataChange();
|
c = new DataChange();
|
||||||
testTimerForLight.Start();
|
//testTimerForLight.Start();
|
||||||
//zmsyarea.Text = "4.00"; // 左目
|
//zmsyarea.Text = "4.00"; // 左目
|
||||||
//smsyarea.Text = "5.00"; // 双目
|
//smsyarea.Text = "5.00"; // 双目
|
||||||
//kbsyarea.Text = "6.00"; // 空白
|
//kbsyarea.Text = "6.00"; // 空白
|
||||||
|
|||||||
Reference in New Issue
Block a user