fix: 레시피 Guide Beam DO 읽기 try/catch 이동(크래시 방지) + AjinIO.ReadDoBit 구현 활성화
- UCScannerObjectTeachingControlBoxViewModel.OnMonitoring: IsGuidBeam = _IODevice.ReadDO(17) 를 try 블록 안으로 이동, catch 에서 IsGuidBeam=false → IO 미연결(시뮬/개발PC)에서 Recipe View 진입 시 미처리 예외로 앱 종료되던 문제 해결 - AjinIO.ReadDoBit(int): 스텁(return true) → AxdoReadOutport 실제 구현 활성화 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
eb307b459e
commit
8bfeb7377a
@ -496,17 +496,17 @@ namespace AuroraIO.AJINEXTEK
|
||||
public override bool ReadDoBit(int index)
|
||||
{
|
||||
//현재 사용하지 않아서 추후 구현
|
||||
return true;
|
||||
//return true;
|
||||
|
||||
// [추후 구현] return true 스텁 의존 코드 확인 후 아래로 교체 (ReadDiBit(int) 패턴)
|
||||
//uint data = 0;
|
||||
//
|
||||
//int err = (int)CAXD.AxdoReadOutport(index, ref data);
|
||||
//if (err != (int)AXT_FUNC_RESULT.AXT_RT_SUCCESS)
|
||||
//{
|
||||
// throw new Exception(string.Format("ERR_IO_FAIL_TO_GET_BIT;ERROR CODE:{0}", err));
|
||||
//}
|
||||
//return Convert.ToBoolean(data);
|
||||
//[추후 구현] return true 스텁 의존 코드 확인 후 아래로 교체(ReadDiBit(int) 패턴)
|
||||
uint data = 0;
|
||||
|
||||
int err = (int)CAXD.AxdoReadOutport(index, ref data);
|
||||
if (err != (int)AXT_FUNC_RESULT.AXT_RT_SUCCESS)
|
||||
{
|
||||
throw new Exception(string.Format("ERR_IO_FAIL_TO_GET_BIT;ERROR CODE:{0}", err));
|
||||
}
|
||||
return Convert.ToBoolean(data);
|
||||
}
|
||||
public override bool ReadDiBit(int index)
|
||||
{
|
||||
|
||||
@ -171,16 +171,6 @@ namespace WeldingCommon.Views
|
||||
private void OnMonitoring(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
// Guide Beam: DI 결선 없음 → 가이드빔 제어 DO 17 명령 비트를 그대로 표시
|
||||
// (기존 _Laser.GetPilotLaserStatus()는 DO 3=GuideLaserEnable 을 봤으나, 현장 가이드빔 제어선은 DO 17)
|
||||
// IO 미연결 가드는 현장PC에서 동작 안 해 주석 (개발PC에서 주석 해제)
|
||||
//if (_IODevice == null || !_IODevice.IsConnected()) {
|
||||
// IsGuidBeam = false;
|
||||
//} else {
|
||||
// IsGuidBeam = _IODevice.ReadDO(17);
|
||||
//}
|
||||
IsGuidBeam = _IODevice.ReadDO(17);
|
||||
|
||||
// [기존 소스 보존] Laser 디바이스 기반 Pilot 상태 (DO 3=GuideLaserEnable) — 일부 Laser 미구현 시 항상 false
|
||||
//if (_Laser.GetPilotLaserStatus()) {
|
||||
// IsGuidBeam = true;
|
||||
@ -189,6 +179,10 @@ namespace WeldingCommon.Views
|
||||
//}
|
||||
try
|
||||
{
|
||||
// Guide Beam: DI 결선 없음 → 가이드빔 제어 DO 17 명령 비트를 그대로 표시
|
||||
// (현장 가이드빔 제어선은 DO 17). IO 미연결 시 ReadDO 예외 → 아래 catch 에서 처리(앱 종료 방지)
|
||||
IsGuidBeam = _IODevice.ReadDO(17);
|
||||
|
||||
// 시뮬 아님 + IO보드 없음 → _iOUnit == null → ReadDI에서 NRE로 꺼짐. - 현장PC 아닌 경우 개발PC에서 주석 해제 (시뮬안하고 레시피 들어갔을 때 프로그램 종료 방지)
|
||||
// IsConnected()가 _iOUnit null/미연결을 체크하므로, 미연결이면 폴링 스킵(꺼짐 방지).
|
||||
//if (_IODevice == null || !_IODevice.IsConnected())
|
||||
@ -210,6 +204,7 @@ namespace WeldingCommon.Views
|
||||
{
|
||||
Log.E($"[OnMonitoring] DI 읽기 실패: {ex.Message}");
|
||||
IsLaserReady = false;
|
||||
IsGuidBeam = false;
|
||||
}
|
||||
|
||||
// TODO: PRIBAT_L1, PRIBAT_L2 는 Blow 의 상태 check 가 들어 있음. 장비 한정이므로 이를 check 하는 것을 modelItem 이나 setting 으로 빼서 진행되도록 함.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user