"fix:Enforce-Run-Mode-in-fAuto-VisibleChanged"

This commit is contained in:
2025-12-18 00:43:22 +09:00
parent 4bdc36040d
commit 2a44ba28a8
14 changed files with 11 additions and 58 deletions

View File

@@ -215,7 +215,15 @@ namespace Project.ViewForm
private void fAuto_VisibleChanged(object sender, EventArgs e)
{
this.timer1.Enabled = this.Visible;
if (timer1.Enabled) timer1.Start();
if (timer1.Enabled)
{
timer1.Start();
// 화면이 보일 때 Run 모드로 강제 설정
if (PUB._mapCanvas.Mode != AGVNavigationCore.Controls.UnifiedAGVCanvas.CanvasMode.Run)
{
PUB._mapCanvas.Mode = AGVNavigationCore.Controls.UnifiedAGVCanvas.CanvasMode.Run;
}
}
else timer1.Stop();
}

View File

@@ -1,55 +0,0 @@
private void HandleRunModeClick(MapNode targetNode)
{
if (targetNode == null) return;
ENIGProtocol.AGVCommandHE targetCmd = ENIGProtocol.AGVCommandHE.Move;
string confirmMsg = "";
if (targetNode.StationType == StationType.Charger)
{
if (MessageBox.Show($"[{targetNode.Id}] 충전기로 이동하여 충전을 진행하시겠습니까?", "작업 확인", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
targetCmd = ENIGProtocol.AGVCommandHE.Charger;
ExecuteManualCommand(targetNode, targetCmd);
}
return;
}
else if (targetNode.isDockingNode)
{
// Loader, Unloader, Buffer, Cleaner
// Custom Dialog needed for PickOn / PickOff
// For now, let's use a simple MessageBox or just a ContextMenu like logic?
// User said: "click -> PickOn/Off selection -> Execute"
// A context menu at cursor position is good for selection.
ContextMenuStrip menu = new ContextMenuStrip();
var pickOn = new ToolStripMenuItem("Pick On (Move & Pick)");
pickOn.Click += (s, args) => ExecuteManualCommand(targetNode, ENIGProtocol.AGVCommandHE.PickOn);
menu.Items.Add(pickOn);
var pickOff = new ToolStripMenuItem("Pick Off (Move & Drop)");
pickOff.Click += (s, args) => ExecuteManualCommand(targetNode, ENIGProtocol.AGVCommandHE.PickOff);
menu.Items.Add(pickOff);
menu.Show(Cursor.Position);
return;
}
else
{
// Normal Node
if (MessageBox.Show($"[{targetNode.Id}] 노드로 이동하시겠습니까?", "이동 확인", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
targetCmd = ENIGProtocol.AGVCommandHE.Move; // Or PickOff as default move? usually just Move logic inside ExecuteManualCommand handles GOTO.
// But ExecuteManualCommand takes AGVCommandHE.
// Let's check ENIGProtocol.AGVCommandHE.
// If not present, we might need to modify ExecuteManualCommand or just pass PickOff as dummy?
// Actually ExecuteManualCommand uses 'cmd' for log and 'PUB.NextWorkCmd'.
// If 'Move', just GOTO.
// Let's assume 'Move' exists or we use 'PickOff' (Move & Drop often implies MoveTo).
// Or we check `ENIGProtocol.AGVCommandHE`.
ExecuteManualCommand(targetNode, ENIGProtocol.AGVCommandHE.Move);
}
return;
}
}

View File

@@ -229,7 +229,7 @@ namespace arDev
private void RevSTS(Dataframe frame)
{
LastSTS = frame.DataString;
string rcvdNow = frame.DataString;
string rcvdNow = frame.DataString.Replace("\0","");
byte[] bRcvData = frame.Buffer;
var encoding = System.Text.Encoding.Default;
try
@@ -267,7 +267,7 @@ namespace arDev
nDataTemp = Convert.ToByte(rcvdNow.Substring(idx, 2), 16);
signal1.SetValue(nDataTemp); idx += 2;
if(idx < rcvdNow.Length-2)
if(idx <= rcvdNow.Length-2)
{
nDataTemp = Convert.ToByte(rcvdNow.Substring(idx, 2), 16);
signal2.SetValue(nDataTemp);

Binary file not shown.