feat: 설정 로드 완료 후 시리얼 포트 초기화하도록 수정
- 모든 설정 로드 후 시리얼 포트를 초기화하는 InitializeSerialAfterLoad() 함수 추가 - loadConfig에서 즉시 시리얼 포트 연결하는 로직 제거 - 라디오 버튼 설정이 완전히 로드된 후 시리얼 포트 초기화되도록 수정 - QW 모드 감지 오류 해결
This commit is contained in:
parent
4aa6d57d2a
commit
eb2365ffe7
@ -301,6 +301,8 @@ Public Class mainForm
|
|||||||
dgvRefresh()
|
dgvRefresh()
|
||||||
fullLoad(sender, e)
|
fullLoad(sender, e)
|
||||||
|
|
||||||
|
' 모든 설정 로드 후에 시리얼 포트 초기화
|
||||||
|
InitializeSerialAfterLoad()
|
||||||
If rdbMode2.Checked = True Then
|
If rdbMode2.Checked = True Then
|
||||||
loadConfig(saveList.lastCount)
|
loadConfig(saveList.lastCount)
|
||||||
End If
|
End If
|
||||||
@ -311,6 +313,23 @@ Public Class mainForm
|
|||||||
txbProdSN.Focus()
|
txbProdSN.Focus()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub InitializeSerialAfterLoad()
|
||||||
|
Try
|
||||||
|
If ckbWeight.Checked = True AndAlso cboComPort.SelectedItem IsNot Nothing Then
|
||||||
|
Dim serialName As String = cboComPort.SelectedItem.ToString()
|
||||||
|
If serialName <> "" Then
|
||||||
|
'Debug.Print("설정 로드 완료 후 시리얼 초기화")
|
||||||
|
'Debug.Print("serialName: [" & serialName & "]")
|
||||||
|
'Debug.Print("QW 체크 여부: " & rdbWeightQW.Checked)
|
||||||
|
'Debug.Print("CAS 체크 여부: " & rdbWeightCAS.Checked)
|
||||||
|
openSerial(serialName)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
Debug.Print("시리얼 초기화 오류: " & ex.Message)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub StartFormSet()
|
Private Sub StartFormSet()
|
||||||
Me.Text = projectName & projectVer
|
Me.Text = projectName & projectVer
|
||||||
pnOption.Visible = False
|
pnOption.Visible = False
|
||||||
@ -5108,8 +5127,8 @@ Public Class mainForm
|
|||||||
Try
|
Try
|
||||||
If ckbWeight.Checked = True Then
|
If ckbWeight.Checked = True Then
|
||||||
If serialName <> "" Or serialName <> Nothing Then
|
If serialName <> "" Or serialName <> Nothing Then
|
||||||
Debug.Print("serialName: [" & serialName & "]")
|
'Debug.Print("serialName: [" & serialName & "]")
|
||||||
Debug.Print("QW 체크 여부: " & rdbWeightQW.Checked)
|
'Debug.Print("QW 체크 여부: " & rdbWeightQW.Checked)
|
||||||
|
|
||||||
If rdbWeightQW.Checked Then
|
If rdbWeightQW.Checked Then
|
||||||
' QW 모드: QWSerialPort 사용
|
' QW 모드: QWSerialPort 사용
|
||||||
@ -5376,16 +5395,18 @@ Public Class mainForm
|
|||||||
|
|
||||||
LoadComport()
|
LoadComport()
|
||||||
|
|
||||||
|
'For cnt = 0 To cboComPort.Items.Count - 1
|
||||||
|
' cboComPort.SelectedIndex = cnt
|
||||||
|
' If parsingCk = cboComPort.SelectedItem Then
|
||||||
|
' openSerial(parsingCk)
|
||||||
|
' End If
|
||||||
|
'Next
|
||||||
For cnt = 0 To cboComPort.Items.Count - 1
|
For cnt = 0 To cboComPort.Items.Count - 1
|
||||||
cboComPort.SelectedIndex = cnt
|
If parsingCk = cboComPort.Items(cnt).ToString() Then
|
||||||
If parsingCk = cboComPort.SelectedItem Then
|
cboComPort.SelectedIndex = cnt
|
||||||
'openSerial(parsingCk)
|
' 여기서 즉시 시리얼 포트를 열지 않고 선택만 함
|
||||||
' QW 모드라면 라디오 버튼 체크 후 한 번만 openSerial 호출
|
' openSerial(parsingCk) <- 이 부분을 제거
|
||||||
If rdbWeightQW.Checked = True Then
|
Exit For
|
||||||
openSerial(parsingCk) ' parsingCk는 포트명(예: "COM5")이어야 함
|
|
||||||
Else
|
|
||||||
openSerial(parsingCk)
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
Loading…
x
Reference in New Issue
Block a user