회전중입력된 태그는 무시
This commit is contained in:
@@ -24,6 +24,7 @@ namespace arDev
|
||||
{
|
||||
public DateTime Start { get; set; }
|
||||
public DateTime End { get; set; }
|
||||
public string Message { get; set; }
|
||||
public TimeSpan Runtime
|
||||
{
|
||||
get
|
||||
@@ -41,6 +42,13 @@ namespace arDev
|
||||
End = new DateTime(1982, 11, 23);
|
||||
State = eNarumiTurn.None;
|
||||
}
|
||||
public bool IsTurning
|
||||
{
|
||||
get
|
||||
{
|
||||
return State == eNarumiTurn.LeftIng || State == eNarumiTurn.RightIng;
|
||||
}
|
||||
}
|
||||
}
|
||||
public class NarumiCommandTime
|
||||
{
|
||||
@@ -76,6 +84,7 @@ namespace arDev
|
||||
{
|
||||
public eNarmiPBSSensor PBSSensor = eNarmiPBSSensor.notset;
|
||||
|
||||
|
||||
public NarumiTurnInfo TurnInformation { get; set; } = null;
|
||||
Dictionary<string, NarumiCommandTime> SendCommandFailList { get; set; } = new Dictionary<string, NarumiCommandTime>();
|
||||
|
||||
@@ -297,6 +306,38 @@ namespace arDev
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 턴정보를 설정한다
|
||||
/// </summary>
|
||||
/// <param name="newstate"></param>
|
||||
void TurnInformationSetting(eNarumiTurn newstate)
|
||||
{
|
||||
if (TurnInformation == null) TurnInformation = new NarumiTurnInfo();
|
||||
TurnInformation.Start = DateTime.Now;
|
||||
TurnInformation.End = new DateTime(1982, 11, 23);
|
||||
if (TurnInformation.State != newstate)
|
||||
{
|
||||
TurnInformation.Message = $"Change {TurnInformation.State} -> {newstate}";
|
||||
TurnInformation.State = newstate;
|
||||
RaiseMessage(MessageType.Normal, TurnInformation.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 턴이진행중일경우에는 상태를 해제한다
|
||||
/// </summary>
|
||||
void TurnInformationSettingCancel()
|
||||
{
|
||||
if (TurnInformation == null) return;
|
||||
if (TurnInformation.State == eNarumiTurn.LeftIng || TurnInformation.State == eNarumiTurn.RightIng)
|
||||
{
|
||||
TurnInformation.End = DateTime.Now;
|
||||
TurnInformation.State = eNarumiTurn.None;
|
||||
TurnInformation.Message = "Turningstatus cancled";
|
||||
RaiseMessage(MessageType.Normal, TurnInformation.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected eNarumiCommandResult AddCommand(eAgvCmd command, BunkiData param)
|
||||
{
|
||||
@@ -332,10 +373,14 @@ namespace arDev
|
||||
cmdString = $"CST{param}";
|
||||
system1.agv_run_manual = false;
|
||||
retval = AddCommand(cmdString);
|
||||
if (retval == eNarumiCommandResult.Success)
|
||||
TurnInformationSettingCancel();
|
||||
break;
|
||||
case eAgvCmd.MoveStart:
|
||||
cmdString = $"CRN{param}";
|
||||
retval = AddCommand(cmdString);
|
||||
if (retval == eNarumiCommandResult.Success)
|
||||
TurnInformationSettingCancel();
|
||||
break;
|
||||
|
||||
case eAgvCmd.ChargeOf:
|
||||
@@ -354,10 +399,7 @@ namespace arDev
|
||||
retval = AddCommand(cmdString);
|
||||
if (retval == eNarumiCommandResult.Success)
|
||||
{
|
||||
if (TurnInformation == null) TurnInformation = new NarumiTurnInfo();
|
||||
TurnInformation.Start = DateTime.Now;
|
||||
TurnInformation.End = new DateTime(1982, 11, 23);
|
||||
TurnInformation.State = eNarumiTurn.LeftIng;
|
||||
TurnInformationSetting(eNarumiTurn.LeftIng);
|
||||
}
|
||||
break;
|
||||
case eAgvCmd.TurnRight:
|
||||
@@ -365,10 +407,7 @@ namespace arDev
|
||||
retval = AddCommand(cmdString);
|
||||
if (retval == eNarumiCommandResult.Success)
|
||||
{
|
||||
if (TurnInformation == null) TurnInformation = new NarumiTurnInfo();
|
||||
TurnInformation.Start = DateTime.Now;
|
||||
TurnInformation.End = new DateTime(1982, 11, 23);
|
||||
TurnInformation.State = eNarumiTurn.RightIng;
|
||||
TurnInformationSetting(eNarumiTurn.RightIng);
|
||||
}
|
||||
break;
|
||||
case eAgvCmd.BackAndTurn:
|
||||
@@ -399,6 +438,8 @@ namespace arDev
|
||||
system1.agv_run_manual = true;
|
||||
cmdString = $"CRT{param}";
|
||||
retval = AddCommand(cmdString);
|
||||
if (retval == eNarumiCommandResult.Success)
|
||||
TurnInformationSettingCancel();
|
||||
break;
|
||||
|
||||
case eAgvCmd.LiftControl:
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace arDev
|
||||
/// </summary>
|
||||
public event EventHandler<DataEventArgs> DataReceive;
|
||||
public event EventHandler<TurnEventArgs> TurnComplete;
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -344,11 +344,20 @@ namespace arDev
|
||||
var tagnostr = rcvdNow.Substring(3);
|
||||
if (ushort.TryParse(tagnostr, out ushort tagnoint))
|
||||
{
|
||||
var Changed = !old_TagString.Equals(tagnostr);
|
||||
data.TagString = tagnostr;
|
||||
data.TagNo = tagnoint;
|
||||
old_TagString = tagnostr;
|
||||
DataReceive?.Invoke(this, new DataEventArgs(DataType.TAG));
|
||||
if (TurnInformation != null && TurnInformation.IsTurning)
|
||||
{
|
||||
//턴진행중에 들어온 태그는 무시하자 260226
|
||||
RaiseMessage(MessageType.Normal, $"Tag Ignore by Turn (Tag:{tagnostr})");
|
||||
}
|
||||
else
|
||||
{
|
||||
//var Changed = !old_TagString.Equals(tagnostr);
|
||||
data.TagString = tagnostr;
|
||||
data.TagNo = tagnoint;
|
||||
old_TagString = tagnostr;
|
||||
DataReceive?.Invoke(this, new DataEventArgs(DataType.TAG));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WriteData(MakeCheckSum("ACKTAG"));
|
||||
@@ -476,7 +485,7 @@ namespace arDev
|
||||
Mid,
|
||||
Low,
|
||||
}
|
||||
|
||||
|
||||
|
||||
private bool CheckSum(byte[] bData)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user