ntoll / uflash

A module and command to easily flash Python onto the BBC's micro:bit device.
http://micropython.org/
MIT License
101 stars 27 forks source link

Check .hex file burning completed in microbit #64

Closed GauravBole closed 1 year ago

GauravBole commented 4 years ago

how we check .hex file burning completed in microbit? to run another .hex file in my case I am running one .hex file and before completing its burring I run another .hex file so I got a error like microbit not connected check microbit . so if we able to identify first burning is not completed to burn another hex file then i think it solve a problem

ntoll commented 4 years ago

Hi @GauravBole, thank you for reporting this idea. It depends entirely on the underlying operating system. Flashing to the micro:bit is, as you know, just a filesystem copy of a file onto the device. On some OS's this is non-blocking (i.e. as soon as Python makes the system call to copy the file onto the device, the function returns and the OS does the FS copy in the background). That's why you're seeing the behaviour you describe (Python asks the OS to copy, then immediately exits since the OS gets on with the FS operation in the background).

If you can find a way to do blocking file writes with Python on all operating systems, then I think we have a solution to your idea and I would happily merge in any PR you submit if it comes with unit tests and so on. :+1:

carlosperate commented 1 year ago

Since commit https://github.com/ntoll/uflash/commit/d1b3d03b0abb8f4275607fe93850fe900c52315d uFlash now blocks until the copy is done, so this can be closed as implemented :)

ntoll commented 1 year ago

Thank you.