JetBrains / intellij-micropython

Plugin for MicroPython devices in PyCharm and IntelliJ
https://plugins.jetbrains.com/plugin/9777-micropython
Apache License 2.0
510 stars 106 forks source link

Flash Python files to ESP8266 #6

Closed vlasovskikh closed 7 years ago

vlasovskikh commented 7 years ago
  1. There are several possible modes of operation:

Which one would you prefer?

  1. ESP8266 makes it possible to upload files via:

Any preferences here?

  1. Are you OK with using a Run Configuration in PyCharm / IntelliJ for flashing Python files to devices? The program is only flashed to the device and runs after its reset. The Run Console in the IDE would show only the results of the uploading process. Should it be a separate upload action instead?
vlasovskikh commented 7 years ago

Uploading could be done via the adafruit-ampy package. Although I've experienced some issues using it with WEMOS D1 mini, see #3. At least MicroPython's pyboard.py shipped as a submodule of ampy could be helpful as the core library for uploading files via REPL.

elf55 commented 7 years ago

I would prefer:

  1. upload multiple files from a folder.
  2. upload via WebREPL. But either is OK.
  3. Separate upload and run steps. It's sometimes useful to upload and make an adjustment via REPL before running.
lensvol commented 7 years ago
  1. Single file and/or multiple files.
  2. Upload via USB cable. WebREPL needs to be explicitly enabled, can be fickle and needs a presence on the same Wi-Fi network.
  3. Separate upload action seems like a good choice. "Run" step mainly amounts to performing a soft reset on a board, anyway.
vlasovskikh commented 7 years ago

Check out my draft script for uploading a directory to a MicroPython device 8be5cea8c08a9db6af839748a69c97f25952df22. Try it from the command line (requirements: adafruit-ampy, docopt). Does it work for you?

lensvol commented 7 years ago

It works with my mini Pro well enough.

Some thoughts:

vlasovskikh commented 7 years ago

@lensvol I will add the ability to upload a single file. I don't have any solution in mind for uploading files while the REPL session is active. If you have any ideas, please share them :) Let's start with the hard-coded timeout and make it configurable in some way later on, as it doesn't look like the highest priority issue.

lensvol commented 7 years ago

@vlasovskikh The only solution I can think of right now:

  1. Temporarily close REPL process (without closing Terminal View)
  2. Run upload command with output redirected into Terminal View.
  3. Restart REPL and reconnect it to the previously opened terminal window.

I am not that familiar with plugin development and IDEA internals, so I don't know if it's real or not. :)

vlasovskikh commented 7 years ago

Ok, currently I'm doing it via the Run configuration "Flash ... to device". It supports flashing files and folders to WEMOS D1 mini. I'm going to generalise it. Feel free to open new tickets to discuss flashing options / implementation details.