@@ -35,9 +35,8 @@ namespace HBLConsole.MORKIC | |||||
GVL_MORIC mORKD = new GVL_MORIC(); | GVL_MORIC mORKD = new GVL_MORIC(); | ||||
//咖啡机主控程序 | //咖啡机主控程序 | ||||
private CoffeeMachine coffeeMachine; | private CoffeeMachine coffeeMachine; | ||||
//单片机主控程序 | |||||
private ICChipMachine icchipMachine; | private ICChipMachine icchipMachine; | ||||
//冰淇淋主控程序 | |||||
private IceCreamMachine iceCreamMachine; | |||||
//物料存放位置 | //物料存放位置 | ||||
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>(); | private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>(); | ||||
//容器位置 | //容器位置 | ||||
@@ -98,8 +97,7 @@ namespace HBLConsole.MORKIC | |||||
} | } | ||||
//咖啡机创建 | //咖啡机创建 | ||||
coffeeMachine = new CoffeeMachine(com_Coffee, (BaudRates)Enum.Parse(typeof(BaudRates), baud_Coffee)); | coffeeMachine = new CoffeeMachine(com_Coffee, (BaudRates)Enum.Parse(typeof(BaudRates), baud_Coffee)); | ||||
//冰淇淋机创建 | |||||
iceCreamMachine = new IceCreamMachine(com_IceCream, (BaudRates)Enum.Parse(typeof(BaudRates), baud_IceCream)); | |||||
//单片机机创建 | |||||
icchipMachine = new ICChipMachine(com_ICChip, (BaudRates)Enum.Parse(typeof(BaudRates), baud_ICChip)); | icchipMachine = new ICChipMachine(com_ICChip, (BaudRates)Enum.Parse(typeof(BaudRates), baud_ICChip)); | ||||
Main(); | Main(); | ||||
@@ -171,23 +169,17 @@ namespace HBLConsole.MORKIC | |||||
{ | { | ||||
//咖啡机开启主线程 | //咖啡机开启主线程 | ||||
coffeeMachine.Start(); | coffeeMachine.Start(); | ||||
//冰淇淋机开启主线程 | |||||
iceCreamMachine.Start(); | |||||
//单片机开启主线程 | |||||
icchipMachine.Start(); | icchipMachine.Start(); | ||||
new ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); | new ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish(); | ||||
//开始心跳刷新,根据咖啡机及冰淇淋机来判断 | //开始心跳刷新,根据咖啡机及冰淇淋机来判断 | ||||
ThreadManage.GetInstance.StartLong(new Action(() => | ThreadManage.GetInstance.StartLong(new Action(() => | ||||
{ | { | ||||
//GeneralConfig.Healthy = true; | |||||
//GeneralConfig.Healthy = | |||||
// LebaiHelper.GetInstance.IsConnected && | |||||
// MorkIStatus.GetInstance().CanDo && | |||||
// MorkCStatus.GetInstance().CanDo; | |||||
GeneralConfig.Healthy = | GeneralConfig.Healthy = | ||||
LebaiHelper.GetInstance.IsConnected && | LebaiHelper.GetInstance.IsConnected && | ||||
MorkCStatus.GetInstance().CanDo; | |||||
MorkCStatus.GetInstance().CanDo && | |||||
ChipStatus.GetInstance().CanDo; | |||||
//GeneralConfig.Healthy = true; | //GeneralConfig.Healthy = true; | ||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), "MORK-IC心跳刷新"); | }), "MORK-IC心跳刷新"); | ||||
@@ -47,6 +47,14 @@ namespace HBLDevice.ICChip | |||||
/// 3号舵机关闭完成 | /// 3号舵机关闭完成 | ||||
/// </summary> | /// </summary> | ||||
public bool CompletedClose_SE_3 { get; set; } | public bool CompletedClose_SE_3 { get; set; } | ||||
/// <summary> | |||||
/// 是否存在物品 | |||||
/// </summary> | |||||
public bool ArticleExits { get; set; } | |||||
/// <summary> | |||||
/// 物品距离 | |||||
/// </summary> | |||||
public byte ArticleDist { get; set; } | |||||
public bool CanDo | public bool CanDo | ||||
{ | { | ||||
@@ -105,6 +113,12 @@ namespace HBLDevice.ICChip | |||||
break; | break; | ||||
} | } | ||||
break; | break; | ||||
case IC_CMD.ARTICLE_EXITS: | |||||
ArticleExits = data.Value > 0; | |||||
break; | |||||
case IC_CMD.ARTICLE_DIST: | |||||
ArticleDist = data.Value; | |||||
break; | |||||
} | } | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
@@ -30,4 +30,14 @@ namespace HBLDevice.ICChip | |||||
{ | { | ||||
public bool TurnOn { get; set; } | public bool TurnOn { get; set; } | ||||
} | } | ||||
public class ArticleExitsEvent : IEvent | |||||
{ | |||||
} | |||||
public class ArticleDistEvent : IEvent | |||||
{ | |||||
} | |||||
} | } |
@@ -30,10 +30,26 @@ namespace HBLDevice.ICChip | |||||
EventBus.GetInstance().Subscribe<MakeIceCreamEvent>(MakeIceCreamEventHandle); | EventBus.GetInstance().Subscribe<MakeIceCreamEvent>(MakeIceCreamEventHandle); | ||||
EventBus.GetInstance().Subscribe<SESwitchCreamEvent>(StopMakeIceCreamEventHandle); | EventBus.GetInstance().Subscribe<SESwitchCreamEvent>(StopMakeIceCreamEventHandle); | ||||
EventBus.GetInstance().Subscribe<RotorSwitchEvent>(RotorSwitchEventHandle); | EventBus.GetInstance().Subscribe<RotorSwitchEvent>(RotorSwitchEventHandle); | ||||
EventBus.GetInstance().Subscribe<ArticleExitsEvent>(ArticleExitsEventHandle); | |||||
EventBus.GetInstance().Subscribe<ArticleDistEvent>(ArticleDistEventHandle); | |||||
} | |||||
private void ArticleDistEventHandle(IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
package.Cmd = IC_CMD.ARTICLE_DIST; | |||||
commProxy.SendData(StructureToByte(package)); | |||||
} | |||||
private void ArticleExitsEventHandle(IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
ChipStatus.GetInstance().ArticleExits = false; | |||||
package.Cmd = IC_CMD.ARTICLE_EXITS; | |||||
commProxy.SendData(StructureToByte(package)); | |||||
} | } | ||||
private void StopMakeIceCreamEventHandle(IEvent @event, EventCallBackHandle callBack) | private void StopMakeIceCreamEventHandle(IEvent @event, EventCallBackHandle callBack) | ||||
{ | { | ||||
ChipStatus.GetInstance().ArticleDist = 0; | |||||
package.Cmd = (@event as SESwitchCreamEvent).IsOpen ? IC_CMD.OPEN_SE : IC_CMD.CLOSE_SE; | package.Cmd = (@event as SESwitchCreamEvent).IsOpen ? IC_CMD.OPEN_SE : IC_CMD.CLOSE_SE; | ||||
package.Value = (byte)(@event as SESwitchCreamEvent).SteeringEngine; | package.Value = (byte)(@event as SESwitchCreamEvent).SteeringEngine; | ||||
commProxy.SendData(StructureToByte(package)); | commProxy.SendData(StructureToByte(package)); | ||||
@@ -26,7 +26,7 @@ namespace HBLDevice.ICChip | |||||
/// </summary> | /// </summary> | ||||
public IC_CMD Cmd; | public IC_CMD Cmd; | ||||
/// <summary> | /// <summary> | ||||
/// 故障(咖啡机负责写,工控机负责读) | |||||
/// 值 | |||||
/// </summary> | /// </summary> | ||||
public byte Value; | public byte Value; | ||||
/// <summary> | /// <summary> | ||||
@@ -9,20 +9,20 @@ namespace HBLDevice.ICChip | |||||
/// <summary> | /// <summary> | ||||
/// 命令 | /// 命令 | ||||
/// </summary> | /// </summary> | ||||
public enum IC_CMD:byte | |||||
public enum IC_CMD : byte | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 心跳 | /// 心跳 | ||||
/// </summary> | /// </summary> | ||||
HEART_BEAT=0x00, | |||||
HEART_BEAT = 0x00, | |||||
/// <summary> | /// <summary> | ||||
/// 下杯(带上碗参数) | /// 下杯(带上碗参数) | ||||
/// </summary> | /// </summary> | ||||
TAKE_CUP=0x01, | |||||
TAKE_CUP = 0x01, | |||||
/// <summary> | /// <summary> | ||||
/// 打开舵机(带上舵机参数) | /// 打开舵机(带上舵机参数) | ||||
/// </summary> | /// </summary> | ||||
OPEN_SE=0x02, | |||||
OPEN_SE = 0x02, | |||||
/// <summary> | /// <summary> | ||||
/// 关闭舵机(带上舵机参数) | /// 关闭舵机(带上舵机参数) | ||||
/// </summary> | /// </summary> | ||||
@@ -30,6 +30,14 @@ namespace HBLDevice.ICChip | |||||
/// <summary> | /// <summary> | ||||
/// 使能冰淇淋转子(带上开关参数) | /// 使能冰淇淋转子(带上开关参数) | ||||
/// </summary> | /// </summary> | ||||
ROTOR=0x04, | |||||
ROTOR = 0x04, | |||||
/// <summary> | |||||
/// 检测是否有物品 | |||||
/// </summary> | |||||
ARTICLE_EXITS = 0x05, | |||||
/// <summary> | |||||
/// 检测物品距离 | |||||
/// </summary> | |||||
ARTICLE_DIST = 0x06 | |||||
} | } | ||||
} | } |