Skip to content

Commit 1796891

Browse files
committed
Made updateSerialPortList a method of SerialPortList
1 parent 8bde36f commit 1796891

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ func loop() {
364364
go func() {
365365
for {
366366
if !upload.Busy {
367-
updateSerialPortList()
367+
serialPorts.Update()
368368
}
369369
time.Sleep(2 * time.Second)
370370
}

serial.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (sp *SerialPortList) List() {
134134

135135
var serialEnumeratorLock sync.Mutex
136136

137-
func updateSerialPortList() {
137+
func (sp *SerialPortList) Update() {
138138
if !serialEnumeratorLock.TryLock() {
139139
return
140140
}

serialport.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func (p *serport) writerNoBuf() {
232232
log.Println(msgstr)
233233
h.broadcastSys <- []byte(msgstr)
234234
p.portIo.Close()
235-
updateSerialPortList()
235+
serialPorts.Update()
236236
serialPorts.List()
237237
}
238238

@@ -327,7 +327,7 @@ func spHandlerOpen(portname string, baud int, buftype string) {
327327
sh.register <- p
328328
defer func() { sh.unregister <- p }()
329329

330-
updateSerialPortList()
330+
serialPorts.Update()
331331
serialPorts.List()
332332

333333
// this is internally buffered thread to not send to serial port if blocked
@@ -339,7 +339,7 @@ func spHandlerOpen(portname string, baud int, buftype string) {
339339

340340
p.reader(buftype)
341341

342-
updateSerialPortList()
342+
serialPorts.Update()
343343
serialPorts.List()
344344
}
345345

@@ -352,6 +352,6 @@ func spHandlerClose(p *serport) {
352352
func spCloseReal(p *serport) {
353353
p.bufferwatcher.Close()
354354
p.portIo.Close()
355-
updateSerialPortList()
355+
serialPorts.Update()
356356
serialPorts.List()
357357
}

0 commit comments

Comments
 (0)