File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ type BufferflowTimed struct {
1818
1919var (
2020 bufferedOutput string
21+ sPort string
2122)
2223
2324func (b * BufferflowTimed ) Init () {
2425 log .Println ("Initting timed buffer flow (output once every 16ms)" )
2526 bufferedOutput = ""
27+ sPort = ""
2628
2729 go func () {
2830 b .ticker = time .NewTicker (16 * time .Millisecond )
@@ -32,14 +34,16 @@ func (b *BufferflowTimed) Init() {
3234 select {
3335 case data := <- b .Input :
3436 bufferedOutput = bufferedOutput + data
37+ sPort = b .Port
3538 case <- b .ticker .C :
3639 if bufferedOutput != "" {
37- m := SpPortMessage {bufferedOutput }
40+ m := SpPortMessage {sPort , bufferedOutput }
3841 buf , _ := json .Marshal (m )
3942 // data is now encoded in base64 format
4043 // need a decoder on the other side
4144 b .Output <- []byte (buf )
4245 bufferedOutput = ""
46+ sPort = ""
4347 }
4448 case <- b .done :
4549 break Loop
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ func (b *BufferflowTimedRaw) Init() {
3232 b .ticker = time .NewTicker (16 * time .Millisecond )
3333 for _ = range b .ticker .C {
3434 if len (bufferedOutputRaw ) != 0 {
35- m := SpPortMessageRaw {bufferedOutputRaw }
35+ m := SpPortMessageRaw {b . Port , bufferedOutputRaw }
3636 buf , _ := json .Marshal (m )
3737 // data is now encoded in base64 format
3838 // need a decoder on the other side
Original file line number Diff line number Diff line change @@ -83,12 +83,12 @@ type qwReport struct {
8383}
8484
8585type SpPortMessage struct {
86- // P string // the port, i.e. com22
86+ P string // the port, i.e. com22
8787 D string // the data, i.e. G0 X0 Y0
8888}
8989
9090type SpPortMessageRaw struct {
91- // P string // the port, i.e. com22
91+ P string // the port, i.e. com22
9292 D []byte // the data, i.e. G0 X0 Y0
9393}
9494
@@ -157,7 +157,7 @@ func (p *serport) reader() {
157157
158158 if p .bufferwatcher .IsBufferGloballySendingBackIncomingData () == false {
159159 //m := SpPortMessage{"Alice", "Hello"}
160- m := SpPortMessage {data }
160+ m := SpPortMessage {p . portConf . Name , data }
161161 //log.Print("The m obj struct is:")
162162 //log.Print(m)
163163
You can’t perform that action at this time.
0 commit comments