Skip to content

Add explicit spList to avoid FE going out of sync #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add explicit spList to avoid FE going out of sync
  • Loading branch information
facchinm committed Jun 15, 2016
commit 29f947d69d62c0c0e74a76e0d9b4e8638a8fe5aa
1 change: 1 addition & 0 deletions programmer.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ func touch_port_1200bps(portname string, WaitForUploadPort bool) (string, error)
log.Println(ports)
portname = findNewPortName(ports, after_reset_ports)
if portname != "" {
time.Sleep(time.Millisecond * 500)
break
}
if timeout {
Expand Down
9 changes: 8 additions & 1 deletion serialport.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ func (p *serport) writerNoBuf() {
if err == nil {
h.broadcastSys <- msgJson
}

}

log.Print("Just wrote ", n2, " bytes to serial: ", string(data.data))
Expand All @@ -299,6 +298,8 @@ func (p *serport) writerNoBuf() {
log.Println(msgstr)
h.broadcastSys <- []byte(msgstr)
p.portIo.Close()
spListDual(false)
spList(false)
}

func spHandlerOpen(portname string, baud int, buftype string, isSecondary bool) {
Expand Down Expand Up @@ -360,6 +361,10 @@ func spHandlerOpen(portname string, baud int, buftype string, isSecondary bool)

sh.register <- p
defer func() { sh.unregister <- p }()

spListDual(false)
spList(false)

// this is internally buffered thread to not send to serial port if blocked
go p.writerBuffered()
// this is thread to send to serial port regardless of block
Expand All @@ -378,4 +383,6 @@ func spHandlerClose(p *serport) {
func spCloseReal(p *serport) {
p.bufferwatcher.Close()
p.portIo.Close()
spListDual(false)
spList(false)
}