File Manager

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
kgschlosser
Posts: 22
Joined: Fri Apr 10, 2020 6:18 pm

File Manager

Post by kgschlosser » Wed Jan 27, 2021 11:40 am

I have been working with MicroPython specifically with the ESP32 and I have not been able to locate an easy and reliable way of transferring files to the ESP32. I have been using Ampy and each time I do I end up losing some hair over it. It works < 10% of the time without any aggravation. There is no plugin that works with the ESP 32 and MicroPython for PyCharm and i really do not want to have to install a whole other IDE just to transfer files to this thing!

I have grown tired of messing about with Ampy so I decided to set out on a mission to write a program that will allow sending files to this thing.
So the way to send the files is pretty cut and dry, it is all about not overloading the serial buffer and also performing garbage collections on a regular basis. The garbage collection is not being done in Ampy and when sending large amounts of data I believe it is what is causing some of the issues. The other thing is the constant sending of duplicate code, this just slows the whole thing down way to much.

So I write the connection end of things and that works works without a hitch. it's nice and fast too. I started to write a GUI for it and then a thought came to mind as i was dealing with the headache called drag and drop.. I thought why can't I add the ESP32 as a drive to the OS and let the OS handle all the rest of the GUI related aspects.

After doing some reading and tinkering about I have found an easy way to go about doing this without me having to write a Kernel Mode driver.
YAY!!! So expect to see in the not so distant future a post from me letting you know when it is done. I am about 70% done with writing a Python binder to a C library that is going to allow this to work. It is going to be so nice to be able to plug the ESP32 in have the computer recognize it and prompt me if I want to attach it as a drive. Being able to use the native OS's file explorer to move files to and from the thing is going to be sweet.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: File Manager

Post by jimmo » Mon Feb 01, 2021 1:12 am

Have you seen rshell or pyboard.py

https://github.com/dhylands/rshell

http://docs.micropython.org/en/latest/r ... rd.py.html

And soon to be merged mpr -- https://github.com/micropython/micropython/pull/6375 -- which builds on pyboard.py. I think this is really cool (especially the remote-mount-host-filesystem feature).

kgschlosser
Posts: 22
Joined: Fri Apr 10, 2020 6:18 pm

Re: File Manager

Post by kgschlosser » Sat Feb 06, 2021 9:47 pm

OK so I changed gears as to how I am developing this thing.

First thing is I scrapped the GUI interface. instead I have now leveraged the Windows OS API to allow the ESP32 to be seen as a removable drive
This is done using a kernel mode driver called Dokany. I had to write a Python binding to the Dokany dll as one did not exist. The program I wrote is in Python and currently needs to be run as an application, I am going to be adding a service option to it. It automatically detects the ESP32 when it is plugged in and optionally automatically mount it as a drive. This is a nice way to do this because I am not reinventing the wheel and allowing the OS to handle all of the GUI related bits to display the files to the user and to allow the user to manipulate the files as well. There is a HUGE up side to doing this as well. in place editing/creation of files. Since the OS sees the drive so will an IDE a user has the ability to modify/create/delete anything on the ESP32 without having to use any kind of a utility to "transfer" files.

I have only a single issue at this point. the 115200 baudrate. it is to damned slow. and also using the repl to send "commands" as if I was typing them myself. This adds a HUGE amount of overhead and with that overhead comes more slowdown.

I need to locate a way to be able to disconnect the repl from the UART regreate the UART at a higher speed and when finished reconnect the repl to the UART. problem I am having is the thing keeps on rebooting which reconnects the repl to the UART at 115200.

kgschlosser
Posts: 22
Joined: Fri Apr 10, 2020 6:18 pm

Re: File Manager

Post by kgschlosser » Sun Feb 07, 2021 12:13 am

I m also going to make it cross platform so it will work on posix systems as well. I am going to use Fuse for that end of things.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: File Manager

Post by pythoncoder » Sun Feb 07, 2021 8:21 am

Beware of this pitfall. The reference is about Pyboards but it sounds as if your approach may hit the same problem.
Peter Hinch
Index to my micropython libraries.

oyster
Posts: 26
Joined: Tue Feb 16, 2021 1:21 pm

Re: File Manager

Post by oyster » Sat Mar 06, 2021 9:13 am

any processing of this project?
I am on Windows 10. I do expect a tools like Total Commander or Midnight_Commander

Post Reply