Skip to content

Commit 1f05887

Browse files
author
Alice Pintus
authored
Merge pull request #106 from facchinm/fe_sync
Add explicit spList to avoid FE going out of sync
2 parents 035dfe4 + 29f947d commit 1f05887

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

programmer.go

+1
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ func touch_port_1200bps(portname string, WaitForUploadPort bool) (string, error)
494494
log.Println(ports)
495495
portname = findNewPortName(ports, after_reset_ports)
496496
if portname != "" {
497+
time.Sleep(time.Millisecond * 500)
497498
break
498499
}
499500
if timeout {

serialport.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ func (p *serport) writerNoBuf() {
281281
if err == nil {
282282
h.broadcastSys <- msgJson
283283
}
284-
285284
}
286285

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

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

361362
sh.register <- p
362363
defer func() { sh.unregister <- p }()
364+
365+
spListDual(false)
366+
spList(false)
367+
363368
// this is internally buffered thread to not send to serial port if blocked
364369
go p.writerBuffered()
365370
// this is thread to send to serial port regardless of block
@@ -378,4 +383,6 @@ func spHandlerClose(p *serport) {
378383
func spCloseReal(p *serport) {
379384
p.bufferwatcher.Close()
380385
p.portIo.Close()
386+
spListDual(false)
387+
spList(false)
381388
}

0 commit comments

Comments
 (0)