Skip to content

Commit 43451a3

Browse files
umbynosper1234
andauthored
Apply suggestions from code review
Co-authored-by: per1234 <[email protected]>
1 parent fcaa53c commit 43451a3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

serialport.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ func (p *serport) reader(buftype string) {
125125
p.bufferwatcher.OnIncomingDataBinary(ch[:n])
126126
case "default": // the bufferbuftype is actually called default 🤷‍♂️
127127
// save the left out bytes for the next iteration due to UTF-8 encoding
128-
ch = append(buffered_ch.Bytes(), ch[:n]...) // TODO ch is not handled correctly: doing this way it's length is messed up. Use ch2
128+
ch = append(buffered_ch.Bytes(), ch[:n]...) // TODO ch is not handled correctly: doing this way its length is messed up. Use ch2
129129
n += len(buffered_ch.Bytes())
130130
buffered_ch.Reset()
131131
for i, w := 0, 0; i < n; i += w {
132-
runeValue, width := utf8.DecodeRune(ch[i:n]) // try to decode the first i bytes in the buffer (UTF8 runes do not have a fixed lenght)
132+
runeValue, width := utf8.DecodeRune(ch[i:n]) // try to decode the first i bytes in the buffer (UTF8 runes do not have a fixed length)
133133
if runeValue == utf8.RuneError {
134134
buffered_ch.Write(ch[i:n])
135135
break

test/test_ws.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def general_test_serial(socketio, buffertype):
5959
message = []
6060
#in message var we will find the "response"
6161
socketio.on('message', message_handler)
62-
#open a new serial connection with the specified buffertype, if buffertype s empty it will use the default one
62+
#open a new serial connection with the specified buffertype, if buffertype is empty it will use the default one
6363
socketio.emit('command', 'open ' + port + ' 9600 ' + buffertype)
6464
# give time to the message var to be filled
6565
time.sleep(.5)
@@ -109,7 +109,7 @@ def message_handler(msg):
109109
global message
110110
message.append(msg)
111111

112-
# helper function used to extract serial data from it's json representation
112+
# helper function used to extract serial data from its JSON representation
113113
# NOTE make sure to pass a clean message (maybe reinitialize the message global var before populating it)
114114
def extract_serial_data(msg):
115115
serial_data = ""

0 commit comments

Comments
 (0)