Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb3860b0

Browse files
authored
[EDITOR-621] add port to serial output (#616)
* add port to serial output
1 parent4e91762 commitb3860b0

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

‎bufferflow_timed.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ type BufferflowTimed struct {
1818

1919
var (
2020
bufferedOutputstring
21+
sPortstring
2122
)
2223

2324
func (b*BufferflowTimed)Init() {
2425
log.Println("Initting timed buffer flow (output once every 16ms)")
2526
bufferedOutput=""
27+
sPort=""
2628

2729
gofunc() {
2830
b.ticker=time.NewTicker(16*time.Millisecond)
@@ -32,14 +34,16 @@ func (b *BufferflowTimed) Init() {
3234
select {
3335
casedata:=<-b.Input:
3436
bufferedOutput=bufferedOutput+data
37+
sPort=b.Port
3538
case<-b.ticker.C:
3639
ifbufferedOutput!="" {
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

‎bufferflow_timedraw.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (b *BufferflowTimedRaw) Init() {
3232
b.ticker=time.NewTicker(16*time.Millisecond)
3333
for_=rangeb.ticker.C {
3434
iflen(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

‎serialport.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ type qwReport struct {
8383
}
8484

8585
typeSpPortMessagestruct {
86-
//P string // the port, i.e. com22
86+
Pstring// the port, i.e. com22
8787
Dstring// the data, i.e. G0 X0 Y0
8888
}
8989

9090
typeSpPortMessageRawstruct {
91-
//P string // the port, i.e. com22
91+
Pstring// 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
ifp.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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp