장치 연결 로직을 별도 쓰레드로 분리

상태머신에서 장치 연결(AGV, XBee, BMS)이 메인 루프를 블로킹하는 문제 해결

주요 변경사항:
- DeviceConnectionWorker: 별도 쓰레드에서 장치 연결 처리
- StartDeviceConnectionThread: 쓰레드 시작 로직
- StopDeviceConnectionThread: 프로그램 종료 시 안전한 쓰레드 종료
- sm_SPS: 연결 로직 제거, 쓰레드 시작만 담당
- __Closing: 프로그램 종료 시 쓰레드 종료 호출

이점:
- 장치 연결 중 상태머신 블로킹 방지
- 1초 간격으로 비동기 연결 시도
- 프로그램 종료 시 안전한 쓰레드 정리

파일:
- StateMachine/_SPS.cs: 쓰레드 로직 추가
- fMain.cs: 종료 시 쓰레드 정리

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
backuppc
2025-11-18 08:52:11 +09:00
parent 92dfe2978c
commit a46d0b526d
2 changed files with 96 additions and 33 deletions

View File

@@ -110,6 +110,9 @@ namespace Project
private void __Closing(object sender, FormClosingEventArgs e)
{
// 장치 연결 쓰레드 종료
StopDeviceConnectionThread();
PUB.popup.needClose = true;
if (remoteClose == true)
{