diff --git a/HBLConsole.Business/MessageServer/Base.cs b/HBLConsole.Business/MessageServer/Base.cs
index 5a8a9a0..10c8178 100644
--- a/HBLConsole.Business/MessageServer/Base.cs
+++ b/HBLConsole.Business/MessageServer/Base.cs
@@ -32,7 +32,7 @@ namespace HBLConsole.Business.MessageServer
OrderPush = morkOrderpush
});
ActionOperate.GetInstance.Send("AddOrder",morkOrderpush);
- ActionOperate.GetInstance.Send("DataParse",morkOrderpush);
+ ActionOperate.GetInstance.Send("DataParse", morkOrderpush);
}
}
}
diff --git a/HBLConsole.Communication/LebaiHelper.cs b/HBLConsole.Communication/LebaiHelper.cs
index f59ce4a..a14496d 100644
--- a/HBLConsole.Communication/LebaiHelper.cs
+++ b/HBLConsole.Communication/LebaiHelper.cs
@@ -41,16 +41,24 @@ namespace HBLConsole.Communication
}
StartRobot();
MessageLog.GetInstance.Show("乐百机器人连接成功!");
- //GetSpeed();
- //ActionOperate.GetInstance.Send($"{GVL.GeneralConfig.DeviceType.ToString()}/ConnectOk");
}
public void GetSpeed()
{
- //client.StartSys().GetAwaiter();
var aa = client.GetActualTcpSpeed().GetAwaiter();
- //robotData.RobotMode.Mode
+
+
+ }
+
+ ///
+ /// 获取机器人当前运行的命令
+ ///
+ ///
+ public CmdStatus GetRobotRunCmd()
+ {
+ if (robotData == null) return default(CmdStatus);
+ return robotData.CurrentCmd;
}
///
diff --git a/HBLConsole.Debug/Debug_MORKIC.xaml b/HBLConsole.Debug/Debug_MORKIC.xaml
index 556dcdd..e71656d 100644
--- a/HBLConsole.Debug/Debug_MORKIC.xaml
+++ b/HBLConsole.Debug/Debug_MORKIC.xaml
@@ -121,7 +121,7 @@
-
+
@@ -137,6 +137,7 @@
+
@@ -144,6 +145,7 @@
+
diff --git a/HBLConsole.Debug/ViewModel/ViewModel_MORKIC.cs b/HBLConsole.Debug/ViewModel/ViewModel_MORKIC.cs
index d49e702..c2129ea 100644
--- a/HBLConsole.Debug/ViewModel/ViewModel_MORKIC.cs
+++ b/HBLConsole.Debug/ViewModel/ViewModel_MORKIC.cs
@@ -70,6 +70,10 @@ namespace HBLConsole.Debug
/// 成型比
///
public byte CXB { get; set; }
+ ///
+ /// 打料完成状态
+ ///
+ public string DLCompleted { get; set; }
public List IceCreamModes { get; set; } = new List();
public string SelecteIceCreamdMode { get; set; }
@@ -111,7 +115,7 @@ namespace HBLConsole.Debug
CurrentMode = MorkIStatus.GetInstance().CurrentMode;
IceCreamFault = MorkIStatus.GetInstance().Fault;
CXB = MorkIStatus.GetInstance().CXB;
-
+ DLCompleted = MorkIStatus.GetInstance().DLCompleted?"打料完成":"打料中";
Thread.Sleep(500);
}), "MORK IC-状态刷新");
}
diff --git a/HBLConsole.MORKIC/Control_MORKIC.cs b/HBLConsole.MORKIC/Control_MORKIC.cs
index 15370b7..ed4f706 100644
--- a/HBLConsole.MORKIC/Control_MORKIC.cs
+++ b/HBLConsole.MORKIC/Control_MORKIC.cs
@@ -15,6 +15,7 @@ using HBLDevice.Coffee;
using HBLDevice.IceCream;
using Robotc;
using System.Collections.Concurrent;
+using System.Diagnostics;
namespace HBLConsole.MORKIC
{
@@ -244,20 +245,22 @@ namespace HBLConsole.MORKIC
//开始心跳刷新,根据咖啡机及冰淇淋机来判断
ThreadOperate.GetInstance.StartLong(new Action(() =>
{
- //GeneralConfig.Healthy = true;
- GeneralConfig.Healthy =
- MorkIStatus.GetInstance().CanDo &&
- MorkCStatus.GetInstance().CanDo;
+ GeneralConfig.Healthy = true;
+ //GeneralConfig.Healthy =
+ // MorkIStatus.GetInstance().CanDo &&
+ // MorkCStatus.GetInstance().CanDo;
Thread.Sleep(100);
}), "MORK-IC心跳刷新");
}
+
public void ReadData()
{
ThreadOperate.GetInstance.StartLong(new Action(() =>
{
lebai = LebaiHelper.GetInstance.GetValueAsync();
+ Debug.WriteLine(LebaiHelper.GetInstance.GetClawWdight());
Thread.Sleep(100);
}), "乐百机器人数据读取");
}
diff --git a/HBLConsole/App.xaml.cs b/HBLConsole/App.xaml.cs
index 1b3a562..241b960 100644
--- a/HBLConsole/App.xaml.cs
+++ b/HBLConsole/App.xaml.cs
@@ -50,7 +50,7 @@ namespace HBLConsole
protected override void OnExit(ExitEventArgs e)
{
- IotReport.GetInstance.Close();
+ //IotReport.GetInstance.Close();
base.OnExit(e);
SqlHelper.GetInstance.Save();
MainConsole.Main.GetInstance.DataSave();
diff --git a/HBLDevice.IceCream/CommandHandler.cs b/HBLDevice.IceCream/CommandHandler.cs
index f0fda17..0d00573 100644
--- a/HBLDevice.IceCream/CommandHandler.cs
+++ b/HBLDevice.IceCream/CommandHandler.cs
@@ -20,6 +20,8 @@ namespace HBLDevice.IceCream
private SerialPortClient commProxy;
private IceCreamEndCook iceCreamEndCook = new IceCreamEndCook();
+ public Action PauseAsk { get; set; }
+
///
/// 初始化
///
@@ -42,9 +44,12 @@ namespace HBLDevice.IceCream
public void ModeSetEventHandle(IEvent @event, EventCallBackHandle callBack = null)
{
+ PauseAsk?.Invoke(true);
+ Thread.Sleep(200);
var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build(((ModeSetEvent)@event).Mode));
commProxy.SendData(data);
-
+ Thread.Sleep(200);
+ PauseAsk?.Invoke(false);
MessageLog.GetInstance.Show(string.Format("设置模式[{0}]", ((ModeSetEvent)@event).Mode));
}
@@ -81,8 +86,12 @@ namespace HBLDevice.IceCream
if (modeRight)
{
+ PauseAsk?.Invoke(true);
+ Thread.Sleep(200);
var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.打料));
commProxy.SendData(data);
+ Thread.Sleep(200);
+ PauseAsk?.Invoke(false);
iceCreamEndCook.Publish();
MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]", MORKI_MODE.打料));
}
diff --git a/HBLDevice.IceCream/IceCreamMachine.cs b/HBLDevice.IceCream/IceCreamMachine.cs
index a22d5b5..169163b 100644
--- a/HBLDevice.IceCream/IceCreamMachine.cs
+++ b/HBLDevice.IceCream/IceCreamMachine.cs
@@ -19,7 +19,8 @@ namespace HBLDevice.IceCream
private DataStorage dataStorage = new DataStorage();
//主线程运行标识
private bool running = false;
-
+ //是否下发指令,主线程等待
+ private bool free = true;
public Action SendCallback;
public Action ReciveCallback;
@@ -30,7 +31,10 @@ namespace HBLDevice.IceCream
commProxy = new SerialPortClient(portName, baud);
commProxy.SetDataStorage(dataStorage);
commandHandler.Init(commProxy);
-
+ commandHandler.PauseAsk = delegate (bool pause)
+ {
+ free = !pause;
+ };
}
public void Start()
@@ -49,8 +53,11 @@ namespace HBLDevice.IceCream
{
ThreadOperate.GetInstance.StartLong(new Action(() =>
{
- commProxy.SendData(commandHandler.GetHeartDW());
- SendCallback?.Invoke(BitConverter.ToString(commandHandler.GetHeartDW()));
+ if (free)
+ {
+ commProxy.SendData(commandHandler.GetHeartDW());
+ SendCallback?.Invoke(BitConverter.ToString(commandHandler.GetHeartDW()));
+ }
Thread.Sleep(500);
}), "冰淇淋询问线程");
diff --git a/HBLDevice.IceCream/MorkIStatus.cs b/HBLDevice.IceCream/MorkIStatus.cs
index 351f202..252e629 100644
--- a/HBLDevice.IceCream/MorkIStatus.cs
+++ b/HBLDevice.IceCream/MorkIStatus.cs
@@ -52,6 +52,10 @@ namespace HBLDevice.IceCream
/// 成型比(门限)
///
public byte CXB_Threshold { get; set; }
+ ///
+ /// 打料完成(完成为true,正在打料为false)
+ ///
+ public bool DLCompleted { get; set; }
public bool CanDo
{
@@ -76,7 +80,17 @@ namespace HBLDevice.IceCream
DL = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L, heartUpMsg.DL_H }, 0);
Fault = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L, heartUpMsg.GZ_H }, 0);
CXB = heartUpMsg.CXB;
+ DLCompleted = (heartUpMsg.DLTJ >> 4 & 1) == 1;
+ if (RTrig.GetInstance("打料完成检测").Start(DLCompleted))
+ {
+ MessageLog.GetInstance.Show("打料完成");
+ }
+
+ if(RTrig.GetInstance("打料中检测").Start(!DLCompleted))
+ {
+ MessageLog.GetInstance.Show("打料中");
+ }
//MessageLog.GetInstance.Show(string.Format("当前模式为:{0}", CurrentMode));
}