Commit 57061555 LN

RGB灯库位调试修改

1 个父辈 6bec1bd3
...@@ -75,6 +75,7 @@ namespace TSA_V.DeviceLibrary ...@@ -75,6 +75,7 @@ namespace TSA_V.DeviceLibrary
errmsg += Encoding.ASCII.GetString(rev); errmsg += Encoding.ASCII.GetString(rev);
if (rev.Count() > 0) if (rev.Count() > 0)
{ {
LogUtil.info("氛围灯" + comPortName + "查询到设备信息");
ok = true; ok = true;
Run(); Run();
break; break;
...@@ -127,6 +128,7 @@ namespace TSA_V.DeviceLibrary ...@@ -127,6 +128,7 @@ namespace TSA_V.DeviceLibrary
} }
public bool ShowColor(Color color, ColorFormat colorFormat = ColorFormat.GBR) public bool ShowColor(Color color, ColorFormat colorFormat = ColorFormat.GBR)
{ {
log("ShowColor,color=" + color );
var newbyte = CommandByte.SetOneColor; var newbyte = CommandByte.SetOneColor;
var colorbyte = ConvertColorToByteArray(color, colorFormat); var colorbyte = ConvertColorToByteArray(color, colorFormat);
newbyte[16] = colorbyte[0]; newbyte[16] = colorbyte[0];
...@@ -161,6 +163,7 @@ namespace TSA_V.DeviceLibrary ...@@ -161,6 +163,7 @@ namespace TSA_V.DeviceLibrary
/// <returns></returns> /// <returns></returns>
public bool ShowLedColor(Color color, List<int> ledIndex, int maxledIndex = 0, ColorFormat colorFormat = ColorFormat.GBR) public bool ShowLedColor(Color color, List<int> ledIndex, int maxledIndex = 0, ColorFormat colorFormat = ColorFormat.GBR)
{ {
log("开灯,color="+ color + ":" + string.Join("#", ledIndex));
ShowColor(Color.Black); ShowColor(Color.Black);
List<byte> allData = new List<byte>(); List<byte> allData = new List<byte>();
byte[] startByte = CommandByte.ledColorStart; byte[] startByte = CommandByte.ledColorStart;
...@@ -326,7 +329,7 @@ namespace TSA_V.DeviceLibrary ...@@ -326,7 +329,7 @@ namespace TSA_V.DeviceLibrary
{ {
debuglog("sendData:" + byteToHexStr(buff, " ")); debuglog("sendData:" + byteToHexStr(buff, " "));
_serialPort.Write(buff, 0, buff.Length); _serialPort.Write(buff, 0, buff.Length);
Thread.Sleep(80); Thread.Sleep(30);
int r = _serialPort.Read(recv, 0, recv.Length); int r = _serialPort.Read(recv, 0, recv.Length);
if (r > 0) if (r > 0)
...@@ -384,11 +387,11 @@ namespace TSA_V.DeviceLibrary ...@@ -384,11 +387,11 @@ namespace TSA_V.DeviceLibrary
//DD 55 EE 00 00 00 00 00 99 01 00 00 00 03 00 08 50 00 00 AABB //DD 55 EE 00 00 00 00 00 99 01 00 00 00 03 00 08 50 00 00 AABB
public static byte[] GetDeviceID = ConvertStringToByteArray("DD 55 EE 00 00 00 00 00 8F 02 00 00 00 03 00 01 00 00 00 AA BB"); public static byte[] GetDeviceID = ConvertStringToByteArray("DD 55 EE 00 00 00 00 00 8F 01 00 00 00 03 00 01 00 00 00 AA BB");
// DD55EE0000000000990100000003006F500000AABB // DD55EE0000000000990100000003006F500000AABB
public static byte[] SetOneColor = ConvertStringToByteArray("DD 55 EE 00 00 00 01 00 99 02 00 00 00 03 00 6F FF 00 00 AA BB"); public static byte[] SetOneColor = ConvertStringToByteArray("DD 55 EE 00 00 00 01 00 99 01 00 00 00 03 00 6F FF 00 00 AA BB");
//12,13 为数据数量 //12,13 为数据数量
public static byte[] ledColorStart = ConvertStringToByteArray("DD 55 EE 00 00 00 00 00 99 01 00 00 00 03 00 01 "); public static byte[] ledColorStart = ConvertStringToByteArray("DD 55 EE 00 00 00 01 00 99 01 00 00 00 03 00 01 ");
public static byte[] ledColorEnd = ConvertStringToByteArray("AA BB"); public static byte[] ledColorEnd = ConvertStringToByteArray("AA BB");
// DD 55 EE 00 00 00 01 00 99 01 00 00 00 03 00 C9 F0 F0 F0 AA BB // DD 55 EE 00 00 00 01 00 99 01 00 00 00 03 00 C9 F0 F0 F0 AA BB
//DD 55 EE 00 00 00 01 00 99 01 00 00 00 03 00 C9 F0 F0 F0 AA BB //DD 55 EE 00 00 00 01 00 99 01 00 00 00 03 00 C9 F0 F0 F0 AA BB
......
...@@ -24,6 +24,7 @@ namespace TSA_V.DeviceLibrary ...@@ -24,6 +24,7 @@ namespace TSA_V.DeviceLibrary
public DateTime endWorkTime = DateTime.Now; public DateTime endWorkTime = DateTime.Now;
public DateTime LastSetpTime = DateTime.Now; public DateTime LastSetpTime = DateTime.Now;
public uint PreNodeId = 0; public uint PreNodeId = 0;
private List<int> PreRgbLed = new List<int>();
public void StartWork() public void StartWork()
{ {
//开始工作 //开始工作
...@@ -42,7 +43,11 @@ namespace TSA_V.DeviceLibrary ...@@ -42,7 +43,11 @@ namespace TSA_V.DeviceLibrary
} }
if (PreLabel != null) if (PreLabel != null)
{ {
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac); LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
}
if (PreRgbLed.Count > 0)
{
RgbLedController.CloseAll();
} }
Thread.Sleep(500); Thread.Sleep(500);
endWorkTime = DateTime.Now; endWorkTime = DateTime.Now;
...@@ -56,7 +61,7 @@ namespace TSA_V.DeviceLibrary ...@@ -56,7 +61,7 @@ namespace TSA_V.DeviceLibrary
waitList = new List<WaitResultInfo>(); waitList = new List<WaitResultInfo>();
} }
private LabelInfo PreLabel = null; private LabelInfo PreLabel = null;
public void MoveToBag(TSAVPosition position,ComponetInfo componet ) public void MoveToBag(TSAVPosition position, ComponetInfo componet)
{ {
try try
{ {
...@@ -70,9 +75,12 @@ namespace TSA_V.DeviceLibrary ...@@ -70,9 +75,12 @@ namespace TSA_V.DeviceLibrary
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac); LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
Thread.Sleep(300); Thread.Sleep(300);
} }
if (PreRgbLed.Count > 0)
{
RgbLedController.CloseAll();
}
if (position.IsNodePos()) if (position.IsNodePos())
{ {
NodeInfo moveNode = position.GetNode(TSAVBean.RotateMap); NodeInfo moveNode = position.GetNode(TSAVBean.RotateMap);
if (moveNode != null) if (moveNode != null)
{ {
...@@ -104,17 +112,19 @@ namespace TSA_V.DeviceLibrary ...@@ -104,17 +112,19 @@ namespace TSA_V.DeviceLibrary
LedLabelController.UpdateScreen(label); LedLabelController.UpdateScreen(label);
PreLabel = label; PreLabel = label;
} }
else if(position.IsRgbLed()) else if (position.IsRgbLed())
{ {
if (PreNodeId > 0) if (PreNodeId > 0)
{ {
PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition); PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition);
} }
PreNodeId = 0; PreNodeId = 0;
LedManager.LightOn(position.DeviceIP, position.getLedList()); RgbLedController.OpenPosLed(position);
PreRgbLed = position.getLedList();
waitList.Add(WaitResultInfo.WaitTime(500)); waitList.Add(WaitResultInfo.WaitTime(500));
} }
}catch(Exception ex) }
catch (Exception ex)
{ {
LogUtil.error("MoveToBag 出错:" + ex.ToString()); LogUtil.error("MoveToBag 出错:" + ex.ToString());
} }
......
...@@ -310,8 +310,9 @@ namespace TSA_V.DeviceLibrary ...@@ -310,8 +310,9 @@ namespace TSA_V.DeviceLibrary
IsInSuddenDown = false; IsInSuddenDown = false;
IOManager.IOMove(IOManager.Line_FStart, IO_VALUE.LOW); IOManager.IOMove(IOManager.Line_FStart, IO_VALUE.LOW);
LogUtil.info(Name + "开始重置设备,打开设备照明"); LogUtil.info(Name + "开始重置设备,打开设备照明,打开所有RGB灯测试");
IOManager.IOMove(IOManager.Device_Led, IO_VALUE.HIGH); IOManager.IOMove(IOManager.Device_Led, IO_VALUE.HIGH);
RgbLedController.OpenAll();
LastResetChangeTime = DateTime.Now; LastResetChangeTime = DateTime.Now;
Status = TSAVStatus.Reset; Status = TSAVStatus.Reset;
...@@ -330,7 +331,7 @@ namespace TSA_V.DeviceLibrary ...@@ -330,7 +331,7 @@ namespace TSA_V.DeviceLibrary
{ {
PUSICANControl.InitNode(LWidthManager.Line_NodeAddr); PUSICANControl.InitNode(LWidthManager.Line_NodeAddr);
} }
LogUtil.info(Name + "重置中 " + resetStep + ":InitNode 所有节点 "); LogUtil.info(Name + "重置中 " + resetStep + ":InitNode 所有节点 ");
} }
public delegate bool ShowPointDelegate(ProjectorPInfo p ); public delegate bool ShowPointDelegate(ProjectorPInfo p );
public static event ShowPointDelegate ShowPointEvent; public static event ShowPointDelegate ShowPointEvent;
...@@ -408,6 +409,7 @@ namespace TSA_V.DeviceLibrary ...@@ -408,6 +409,7 @@ namespace TSA_V.DeviceLibrary
} }
WarnMsg = ""; WarnMsg = "";
LogUtil.info(Name + msg); LogUtil.info(Name + msg);
RgbLedController.CloseAll();
Status = TSAVStatus.Runing; Status = TSAVStatus.Runing;
} }
/// <summary> /// <summary>
...@@ -567,7 +569,7 @@ namespace TSA_V.DeviceLibrary ...@@ -567,7 +569,7 @@ namespace TSA_V.DeviceLibrary
//} //}
if (isAllOk.Equals(true)) if (isAllOk.Equals(true))
{ {
ToRunning("重置完成:所有旋转轴回到待机点"); ToRunning("重置完成:所有旋转轴回到待机点,关闭所有灯");
} }
} }
if (isTimeOut) if (isTimeOut)
......
...@@ -379,6 +379,7 @@ namespace TSA_V.DeviceLibrary ...@@ -379,6 +379,7 @@ namespace TSA_V.DeviceLibrary
PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition); PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition);
} }
RgbLedController.OpenPosLed(position); RgbLedController.OpenPosLed(position);
PreRgbLed = position.getLedList();
} }
else else
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!