-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directory support on mcu side ? #25
Comments
Hi. Another issue is that when I started uPyLoader, there was no support for MCU folders (as far as I can remember). In current design, I can't imagine an easy way how user could specify destination MCU folder for transferred file. Suggestions are welcome, but it seems like lot of changes would be needed. I'm not saying it can't be done, just that it's lot of work and my time is limited now. If more people would request this feature, it might go up my priorities list. And if someone decided to implement this, I'd be more than happy to review pull request and ultimately add it to new release. |
+1 for directory structure ... |
@profra Could you explain what you meant by "and try to be compatible with CP from Adafruit". |
So, after revisiting current design, I have came up with an idea how to make this work. Below is image describing necessary changes. The "Set as destination" will be enabled only for directories. The concept also includes support for #16. Any selected directories could be copied recursively (might be an option in settings to turn off), though it will probably take a while. Difficult will be whole MCU directory listing, which may require custom script on MCU (simillar to transfer scripts) as plain REPL communication over serial tends to be unreliable for larger quantities of data. Hopefully WiFi connections (specifically WebREPL) are fine for long communication, because such script is not possible there. |
After some considerations, I think the proposed concept will be confusing. For example, I forgot that user can choose multiple files (and folders), possibly marking whole sub-trees in filesystem. As a result, it would be different when user selected and copied 2 files (which would appear in destination folder), or selected 2 files and the folder I find the above really confusing, so I would like to ask for your ( @pidou46, @profra , @jdeltoft, and everyone else) ideas how the UI should look and behave like. If nothing comes up, I propose using same interface as Total Commander. There wouldn't be trees, just flat folder structure and user could go into (and out of) directories. The transfer would always happen between current folder on Local and Remote side. I would like your ideas before 25.11., after which I begin implementing the best solution. Thanks :) |
Hi BetaRavener, I'm perfectly ok with "Total Commander" behaviour provided that it's possible to select the root directory on the local and remote side to be able to sync the entire file system of a given mcu to/from a local directory. Here is the file structure on both side (not the GUI): local file system remote (MCU) It would be great to have the MCU unique ID displayed : machine.unique_id(), to avoid errors. I hope it could help... |
Hi BetaRavener/all, My earlier ask for "syncronization" feature was more around supporting a way to know what files have changed since I've last updated my nodemcu, and having uPyLoader highlight or auto detect those to auto transfer (after compile if applicable). What I find is that I may have made changes to various files since the last update and then it's hard to be 100% sure what I changed so I often times end up uploading all 10. Nobody wants to debug a setup where they just forgot to update the version of a given py file in the nodemcu!!! Timestamps, or md5sum hashes of the files to compare mcu side to local side? I think spending effort on this would be way more valuable than directory support. |
I agree that this is lower priority than sync support. However, I can also imagine when dir support becomes handy. For example, working on multiple projects, where name conflicts may occur, it is good to keep each project in its own dir. As these MCUs become ever more powerful (ESP32), it's nice to be able to take advantage of it. The reason I took on this before sync support is that once you get some 1:1 mapping between folders, it's easy to synchronize them (from UI perspective). Without doing this, I would have to create separate mechanism for specifying what to sync. Ad @pidou46 I got a bit confused by your file structure, but basically all files (even in subfolders) contained in current folder would be compared to other side. |
Sorry, I haven't check my comment after publishing and I haven't seen that layout have gone. I'm agree that we don't need synchro of individual file/directory, nevertheless it would be nice to be able to synchronize a whole file structure including directories. Said differently, no selection but synchro of the complete structure (including directories if possible) It's (only) my point off view. |
My opinions have been published in the other issue... see comments #30 (comment) #30 (comment) |
I see you are working on the dev-transfer branch but I cannot get the list of files on Remote (esp8266) ... the function 'Init transfer files' is OK but 'Could not list files'... hence I cannot test anything... what is the difference between 'Project Folder' and 'Parrent Folder'? |
I haven't yet pushed the script for listing files, because I'm not sure if I want another script sitting on the MCU. The other approach would be defining necessary functions when connecting (when connected, send bunch of code..). But this have disadvantages too - possible errors during transmission and longer connection time. I was planning to decide when all functions are done ( Without the script, it can't list the files. It is planned to fallback to basic MCU listing in such case, but not yet implemented. And the buttons - Project Folder takes you to folder you have selected when |
Here is the necessary file if you are interested. You will have to save it as |
Sorry, I have been doing some more changes in meantime and the script changed :) The file should still be Sure, swapping those buttons probably makes sense and it's easy to do. Probably in next commit if I'll remember. |
I'm also having issues not being able to select a folder destination into de MCU, please bring this issue back up. This is one of the best management apps I've seen for generic MCUs and it is a pity that it cant be used properly because of that. |
Just an idea and please do let me know if I'm completely off the mark. I think os.stat(path) could be used to detect whether a path is a folder or a directory:
Then in connection.py, replace the self.send_line() string with:
So this prepends a '#' for a directory and a '$' for file. Doesn't matter what these are, because the real filename is always And the actual list_files() method could be changed to accept a folder to check, be it "/" or one of the subfolders:
Then "somehow" add files or directory icons for each rwo in the MCU panel widget. Looking at the screenshots in this thread, the code may already be there. And when you click on a row of type "directory", then change the path sent to list_files()... Or something along these lines :-) Cheers, |
@zindy Hi Egor. This is already done in this branch of uPyLoader. There's already working protocol that can list all files. The idea was to define a function |
@BetaRavener Hi Ivan, thank you for coming back to me! Don't worry, I perfectly understand you may have other commitments. If this amounts to anything I'll send you a pull request :-) I had a quick look at your other Branch this afternoon and it seems that a lot of code has been committed to master since, and it's become quite hard to follow the changes directly related to the directory support. So I went ahead and forked uPyLoader and added my additions to send_line to retrieve whether a path on the mcu is a folder or a file, this without the need for additional files stored on the microcontroller. Then as a very quick and dirty test, I changed the right panel to a QStandardItemModel like you did and re-used your icons and (modified) remote_file_system_model.py. This is where I'm at: Display works, clicking on folders works, editing files works (load and save. root and subfolders), removing files work, executing files on the MCU should work. Anyway, here's a screenshot: Cheers, |
Nice, I'm actually surprised that you accepted the challenge. It's true that the branch is ancient and lot of things changed since. Nice work, I'll try to run your fork in near future. Can you also go inside the folder on the MCU side? The idea was to change both panes to something akin total commander (now the left pane is tree structure. It would get replaced with simple list and after double-clicking folder you would enter it). This change would help to make file transfer more intuitive - you could enter a folder on MCU side and files would get transferred into that folder. That's why we also needed "root folder" and "one level up" buttons in the branch. And also both sides would behave the same after the change, only difference is the model that is pulling the data. |
Ok cool. I didn't mean to change MCU side to tree but the opposite - change PC side to behave like MCU. I used extra buttons for navigation before because I used vanilla model for PC side and didn't want to mess around adding Actually querying only current directory is fine - in certain cases it's better (many files in different folders on the device) although opening directory will have some delay. But I think this is nothing to worry about :) Regarding timestamps - this depends on what micropython FS supports. You could at least get file size with Anyway, great work and I'm looking forward to that pull request. I really appreciate the effort. |
Hi Ivan,
This is work in progress, but definitely worth a screenshot! I followed your advice (changing the local side to behave like the MCU), and implemented The new code still needs "a bit" of refactoring, but the interface does work as it's supposed to. I just need to reparent a few things like the context menus, add key bindings, then "later", I will add a column for file sizes (but yes, you're right, timestamps on the MCU side is was a bit too optimistic). That's it for now! A bit of clean-up and I'll push my changes later tonight :-) Cheers, |
OK, one more for the road, sorry about the flood. This is where Windows 10's quarter dock can really come into play (editor | terminal / mainwindow): Compile + Auto transfer works perfectly, and I modified the "Execute" button to simply import the selected module. This works especially well if a main function called at the end... But remember to reset the mcu, simply re-uploading a module and importing it won't do anything if it was already imported once before. So basically, the workflow becomes Compile -> Upload -> Reset -> Import. At this point, the GUI could be re-arranged a bit, but I think I have enough functionality to try and do some actual work! If I find any regressions I will of course update my fork (until I send a PR). Cheers for now! |
I'll definitely take a look at it tomorrow evening! And you've probably discovered one of the traps of working on project like this - it's important not to forget that it's just tool for creating something else. Go do the actual work :) Anyway, it's nice to see the progress. Cheers. |
@BetaRavener Has there been any progress on this? I downloaded the latest source, but it doesn't have this feature, though I saw it in some of the screenshots in this issue page. Is it coming? |
@laukejas Hello. yes it's been a while, the feature is in separate branch that was kind of put on pause as it was deemed too much effort for the time I had on hands. I'm not even sure if it could be resumed or it's too obsolete. But overall, I personally came to conclusion that MCUs are such a simple devices that one shouldn't really need folders. |
The directory support on the side of the mcu would help to keep tidy file system on average at the big project.
Perhaps the "synchronization" feature suggested by jdeltoft will suffice if it processes directories.
uPyLoader gives me the most efficient workflow with micropython on esp8266, I've tried so far, please keep good the work going.
The text was updated successfully, but these errors were encountered: