Skip to content

Commit 15e6101

Browse files
committed
Made updateSerialPortList a method of SerialPortList
1 parent 400e9a8 commit 15e6101

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ func loop() {
366366
go func() {
367367
for {
368368
if !upload.Busy {
369-
updateSerialPortList()
369+
serialPorts.Update()
370370
}
371371
time.Sleep(2 * time.Second)
372372
}

serial.go

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 4 deletions
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)