Fix bug of minipush

pull/99/head
Takumasa Sakao 3 years ago
parent ff382c3faf
commit 5c2bd55bf7

@ -31,12 +31,14 @@ class MiniPush < MiniTerm
puts "[#{@name_short}] 🔌 Please power the target now"
# Timeout for the request token starts after the first sign of life was received.
chars = []
received = @target_serial.readpartial(4096)
Timeout.timeout(10) do
loop do
raise ProtocolError if received.nil?
if received.chars.last(3) == ["\u{3}", "\u{3}", "\u{3}"]
chars.concat(received.chars)
if chars.last(3) == ["\u{3}", "\u{3}", "\u{3}"]
# Print the last chunk minus the request token.
print received[0..-4]
return

Loading…
Cancel
Save