Skip to content

Commit d704dd2

Browse files
committed
make sendNoBuf more general: will be used later 😏
1 parent d077ded commit d704dd2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

serialport.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type serport struct {
3636
sendBuffered chan string
3737

3838
// unbuffered channel of outbound messages that bypass internal serial port buffer
39-
sendNoBuf chan string
39+
sendNoBuf chan []byte
4040

4141
// Do we have an extra channel/thread to watch our buffer?
4242
BufferType string
@@ -180,7 +180,7 @@ func (p *serport) writerBuffered() {
180180
} else {
181181
// send to the non-buffered serial port writer
182182
//log.Println("About to send to p.sendNoBuf channel")
183-
p.sendNoBuf <- data
183+
p.sendNoBuf <- []byte(data)
184184
}
185185
}
186186
msgstr := "writerBuffered just got closed. make sure you make a new one. port:" + p.portConf.Name
@@ -204,7 +204,7 @@ func (p *serport) writerNoBuf() {
204204

205205
// FINALLY, OF ALL THE CODE IN THIS PROJECT
206206
// WE TRULY/FINALLY GET TO WRITE TO THE SERIAL PORT!
207-
n2, err := p.portIo.Write([]byte(data))
207+
n2, err := p.portIo.Write(data)
208208

209209
log.Print("Just wrote ", n2, " bytes to serial: ", string(data))
210210
if err != nil {
@@ -254,7 +254,7 @@ func spHandlerOpen(portname string, baud int, buftype string) {
254254
log.Print("Opened port successfully")
255255
//p := &serport{send: make(chan []byte, 256), portConf: conf, portIo: sp}
256256
// we can go up to 256,000 lines of gcode in the buffer
257-
p := &serport{sendBuffered: make(chan string, 256000), sendNoBuf: make(chan string), portConf: conf, portIo: sp, BufferType: buftype}
257+
p := &serport{sendBuffered: make(chan string, 256000), sendNoBuf: make(chan []byte), portConf: conf, portIo: sp, BufferType: buftype}
258258

259259
var bw Bufferflow
260260

0 commit comments

Comments
 (0)