File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -95,12 +95,13 @@ type SpPortMessageRaw struct {
9595func (p * serport ) reader () {
9696
9797 //var buf bytes.Buffer
98- ch := make ([]byte , 1024 )
9998 timeCheckOpen := time .Now ()
10099 var buffered_ch bytes.Buffer
101100
102101 for {
103102
103+ ch := make ([]byte , 1024 )
104+
104105 n , err := p .portIo .Read (ch )
105106
106107 //if we detect that port is closing, break out o this for{} loop.
@@ -127,12 +128,9 @@ func (p *serport) reader() {
127128 for i , w := 0 , 0 ; i < n ; i += w {
128129 runeValue , width := utf8 .DecodeRune (ch [i :n ])
129130 if runeValue == utf8 .RuneError {
130- buffered_ch .Write (append ( ch [i :n ]) )
131+ buffered_ch .Write (ch [i :n ])
131132 break
132133 }
133- if i == n {
134- buffered_ch .Reset ()
135- }
136134 data += string (runeValue )
137135 w = width
138136 }
You can’t perform that action at this time.
0 commit comments