nickzoic / mpy-utils

Utility programs for Micropython ...
MIT License
104 stars 23 forks source link

Two times timeout for initialize #11

Closed plaicy closed 6 years ago

plaicy commented 6 years ago

https://github.com/nickzoic/mpy-utils/blob/5b951db9c9e46cf88b3321782559dd940c541dd6/mpy_utils/replcontrol.py#L26

As fare as I see the initialize waits two times for timeout if there are not exactly 100 bytes in buffer. First time there will be a timeout because not 100 bytes are received. But for the while loop even one byte is True. So another attempt to receive 100 bytes is done which will also result in a timeout. Could be solved for example with this code:

        count = 100
        while (len(self.port.read(count)) >= count): pass

PS: The comment for reboot looks outdated.

nickzoic commented 6 years ago

Thanks! That bit got rewritten in 835125f0 so I think this can be closed ... thanks for your input though!