Announcing MPyControl - control MicroPhython with your own code

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
kr-g
Posts: 11
Joined: Sun Dec 01, 2019 7:52 pm
Contact:

Announcing MPyControl - control MicroPhython with your own code

Post by kr-g » Sun Dec 01, 2019 8:12 pm

hiya,
i developed a small tool for automating the work with my esp32/esp8266 board in the sense of eg. sending cntrl+c or a machine reset to the board, follow the output over serial etc.etc.
it can be used in own code as well as from the cmd line
https://pypi.org/project/mpycntrl/
any feedback welcome. (guess there are still some bugs inside)
hope you like it :-)

cgglzpy
Posts: 15
Joined: Thu Jul 18, 2019 4:20 pm

Re: Announcing MPyControl - control MicroPhython with your own code

Post by cgglzpy » Thu Dec 05, 2019 2:49 pm

Hi, I'm glad someone else is working on this :)
see viewtopic.php?f=15&t=7120#p40515 and this viewtopic.php?f=15&t=6808
I like the fact that the serial interface requires just Pyserial (I use Picocom also, but sadly the latest version is not available for Raspbian)

Also I would like to mention that there is an official tool pyboard.py (which is recently (I think?) documented in the official docs, and therefore a bit unknown in my opinion)

I guess in the future MicroPython should have an 'unified' command line tool (Serial and WebREPL/BleREPL/Wireless_REPL) + Python library to interface/control MicroPython.

So any piece of work in this direction should be welcome. :D

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

Re: Announcing MPyControl - control MicroPhython with your own code

Post by jimmo » Fri Dec 06, 2019 3:19 am

cgglzpy wrote:
Thu Dec 05, 2019 2:49 pm
Also I would like to mention that there is an official tool pyboard.py (which is recently (I think?) documented in the official docs, and therefore a bit unknown in my opinion)
Yes this documentation was added this week. Sorry it's been long overdue. But pyboard.py is an official part of MicroPython, and a potentially useful building block for writing automation and scripting tools for MicroPython.

kr-g
Posts: 11
Joined: Sun Dec 01, 2019 7:52 pm
Contact:

Re: Announcing MPyControl - control MicroPhython with your own code

Post by kr-g » Fri Dec 06, 2019 8:08 am

docu !!! good that it is now in place !
haven't seen that before ...
probably i skiped it because of the name (i use esp boards... not pyboard...)
ok, then i sending my tool for retiring
yesterday evening i spent some efforts on webrepl and a small websockets prototype.
will kick that too... (will check the pyboard tool lateron)
;-)

kr-g
Posts: 11
Joined: Sun Dec 01, 2019 7:52 pm
Contact:

Re: Announcing MPyControl - control MicroPhython with your own code

Post by kr-g » Fri Dec 06, 2019 8:18 am

btw regarding docu and webrepl

https://docs.micropython.org/en/latest/ ... /repl.html

refering last line on the page

"Note that ctrl-A and ctrl-D do not work with WebREPL."

cntrl+A ... this works by the way... (cntrl+d on blank line resets the socket)

have done it yesterday with my websocket prototype.
webrepl as such (https://micropython.org/webrepl/?) has stoppped working
dont know if its just on my laptop (and network) or a generell problem...

jedie
Posts: 99
Joined: Fri Jan 29, 2016 12:32 pm

Re: Announcing MPyControl - control MicroPhython with your own code

Post by jedie » Fri Dec 06, 2019 8:20 pm

I try to use your project to sync local files to device via USB (in the same way as my OTA stuff: compare size and hash and update only changed/missing files) ... WIP: https://github.com/jedie/micropython-so ... a49e3ecd94

But i ran into a problem sending files: https://github.com/kr-g/mpycntrl/issues/1

cgglzpy
Posts: 15
Joined: Thu Jul 18, 2019 4:20 pm

Re: Announcing MPyControl - control MicroPhython with your own code

Post by cgglzpy » Sat Dec 07, 2019 7:08 pm

kr-g wrote:
Fri Dec 06, 2019 8:08 am
docu !!! good that it is now in place !
haven't seen that before ...
probably i skiped it because of the name (i use esp boards... not pyboard...)
ok, then i sending my tool for retiring
yesterday evening i spent some efforts on webrepl and a small websockets prototype.
will kick that too... (will check the pyboard tool lateron)
;-)
Hi kr-g, I did not mean that you should stop working on those projects :roll: , as I said, any piece of work in this direction should be welcome.
I just wanted to point out that there is already some work that have been done, so you may want to try it out before "reinventing the wheel" and see if it is good enough for your needs and/or meet your expectations. If that is not the case then you may want to contribute to those projects if you see or find any possible improvements. :)

If you still decide to start from zero that's okey too because you may find a new approach or solution that works better than any existing project and even if it does not, you will learn a lot from the process. ;)
jimmo wrote:
Fri Dec 06, 2019 3:19 am
Yes this documentation was added this week. Sorry it's been long overdue. But pyboard.py is an official part of MicroPython, and a potentially useful building block for writing automation and scripting tools for MicroPython.
Thanks for the confirmation jimmo, I had to double check the docs before posting the first message because I did know about pyboard.py but I didn't know if it was already documented.

And yes, I would like point out that some of the most known projects/tools which are based on this "building block" are rshell, ampy or mpfshell, so they may be taken as an example for future work also.

kr-g
Posts: 11
Joined: Sun Dec 01, 2019 7:52 pm
Contact:

Re: Announcing MPyControl - control MicroPhython with your own code

Post by kr-g » Fri Dec 13, 2019 12:26 pm

cgglzpy wrote:
Sat Dec 07, 2019 7:08 pm
... before "reinventing the wheel"
anything better than sudoku in the evening ... :-)

kr-g
Posts: 11
Joined: Sun Dec 01, 2019 7:52 pm
Contact:

Re: Announcing MPyControl - control MicroPhython with your own code

Post by kr-g » Fri Dec 13, 2019 12:30 pm

jedie wrote:
Fri Dec 06, 2019 8:20 pm
I try to use your project to sync local files to device via USB (in the same way as my OTA stuff: compare size and hash and update only changed/missing files) ... WIP: https://github.com/jedie/micropython-so ... a49e3ecd94

But i ran into a problem sending files: https://github.com/kr-g/mpycntrl/issues/1
i just closed the issue.
please check out the latest version with pttydev (experimental threaded reader)
should give also better performance (hopefully)

Post Reply