dhylands / rshell

Remote Shell for MicroPython
MIT License
955 stars 137 forks source link

added fixes for connecting to micropython if it doesn't jump into REPL after boot #209

Open YesterKo opened 1 year ago

YesterKo commented 1 year ago

I had the same problem as in #182, though instead of infinitely printing out info, I ran a loop that didn't print any info and read_until() got stuck at the first serial read. Solution: If no data is in the buffer, instead of reading the minimum number of bytes it will just set data as an empty byte-string.

If the program spits out continuous data however, the while True: loop inside read_until will never stop. Solution: I added a hard_timeout to the function, so that will at some point stop, even if it keeps getting info.

The next problem appeared when after that, rshell wasn't able to get sysinfo from the board. The problem was that enter_raw_repl function was resetting the board, and coincidentally restarting the loop inside boot.py. Solution: Instead of giving an exception if it doesn't get into raw repl, it will first try ctrl-c too.

These changes should fix problems when connecting to boards that don't go to REPL after boot, as in #182.