We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
arduino
Learn more about funding links in repositories.
Report abuse
There was an error while loading. Please reload this page.
1 parent 19f9a6d commit 00249d2Copy full SHA for 00249d2
bufferflow_timed.go
@@ -11,6 +11,7 @@ type BufferflowTimed struct {
11
Port string
12
Output chan []byte
13
Input chan string
14
+ ticker *time.Ticker
15
}
16
17
var (
@@ -28,9 +29,8 @@ func (b *BufferflowTimed) Init() {
28
29
}()
30
31
go func() {
- c := time.Tick(16 * time.Millisecond)
32
- log.Println(bufferedOutput)
33
- for _ = range c {
+ b.ticker = time.NewTicker(16 * time.Millisecond)
+ for _ = range b.ticker.C {
34
m := SpPortMessage{bufferedOutput}
35
buf, _ := json.Marshal(m)
36
b.Output <- []byte(buf)
@@ -93,4 +93,6 @@ func (b *BufferflowTimed) IsBufferGloballySendingBackIncomingData() bool {
93
94
95
func (b *BufferflowTimed) Close() {
96
+ b.ticker.Stop()
97
+ close(b.Input)
98
0 commit comments