-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
tools/mpremote: Add delay
and rtc
commands. Extend documentation.
#11659
Conversation
Code size report:
|
Codecov Report
@@ Coverage Diff @@
## master #11659 +/- ##
==========================================
- Coverage 98.40% 98.39% -0.02%
==========================================
Files 156 156
Lines 20609 20614 +5
==========================================
+ Hits 20281 20283 +2
- Misses 328 331 +3 |
|
7022ccc
to
7b5abe3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A great improvement to the mpremote docs!
|
||
.. code-block:: bash | ||
|
||
$ mpremote fs <command> | ||
$ mpremote fs <sub-command> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many people I've shown mpremote to are confused by fs
. "Why bother using it when all the sub-commands are commands anyway"? Explaining that they are implemented as shortcuts doesn't help...I'm not sure what the solution is here, just sharing the feedback!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused by this too :p
I've added a Note:
to this section, to at least acknowledge that this is a thing and not some extra magic.
docs/reference/mpremote.rst
Outdated
|
||
.. code-block:: bash | ||
|
||
$ pipx run mpremote |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to see pipx install mpremote
as the example - make it easy for beginners to just copy 'n' paste. run
is handy but less useful.
I'd also be sorely tempted to place pipx
ahead of pip
; it's just a better way to install the tool. But I get that pip
is more...standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated it, see what you think.
docs/reference/mpremote.rst
Outdated
$ mpremote run <file> | ||
$ mpremote run <file.py> | ||
|
||
This will copy the file to RAM on the device and execute it directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps with less ambiguity:
This will copy the file to RAM on the device and execute it directly. | |
Transfer <file.py> to the device where it will be compiled and executed. |
(Mainly because it sounded like it was copied to a RAM disk.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the suggested wording because to me "transfer to the device" implies copying it to the filesystem. I've updated the wording to not say "copy". (And sentence about what this command is useful for).
- mount the local directory on the remote device: | ||
.. _mpremote_command_mount: | ||
|
||
- **mount** -- mount the local directory on the remote device: | ||
|
||
.. code-block:: bash | ||
|
||
$ mpremote mount [options] <local-dir> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good improvement - for a very difficult topic to explain!
I wonder if this should have a short animated gif? To show a simple sequence like:
- ls device - empty
- ls PC - foo.py
- mount, ls device - foo.py
Or maybe we just need to record a video, as we've discussed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. +1 to video.
Shortcuts can be defined using the macro system. Built-in shortcuts are:: | ||
Shortcuts can be defined using the macro system. Built-in shortcuts are: | ||
|
||
- ``devs``: Alias for ``connect list`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I'm often asked how devs
filters the serial device list to detect MicroPython devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
devs
(i.e.connect list
) doesn't filter, but auto
does, so I have explained that.
7b5abe3
to
132258a
Compare
Thanks @mattytrentini -- updated the branch. |
tools/mpremote/mpremote/main.py
Outdated
@@ -212,6 +222,10 @@ def argparse_none(description): | |||
do_connect, | |||
argparse_connect, | |||
), | |||
"delay": ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this should be delay_ms
to be clear on the units (and match sleep_ms
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with millis to match the existing args to reset/bootloader, but the new sleep command kind of makes those arguments unnecessary, so removed them instead. sleep
now uses seconds (to match unix sleep(1)
).
tools/mpremote/mpremote/main.py
Outdated
"exec", | ||
"import machine; machine.RTC().datetime((2020, 1, 1, 0, 10, 0, 0, 0))", | ||
], | ||
"setrtc": "rtc --set", # Backwards compatible alias for old command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this never really worked as intended (it set a fixed time...) I think it's safe to just delete it, and the user can add their own shortcut if needed (and this new setrtc
alias is not doing the same thing as the old command).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
a193e50
to
edf33ea
Compare
This allows the sequence to be paused (e.g. wait for device, etc). Also removes the t_ms arg in reset/bootloader, because these arguments don't really need to be changed, and keeping them would mean inconsistent units used for time delays. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
For example, the `reset` shortcut previously allowed an optional delay, but the argument handling cannot handle `reset next-command` as `next-command` will be interpreted as the delay argument. The fix in this commit allows `reset + next-command`. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Replaces the existing functionality provided by the `setrtc` alias to use the current time, rather than a hard-coded date/time. Use `rtc` to query the current time. Use `rtc --set` to set it. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Changes in this commit: - Add a extra detail to each of the commands. - Add more about handling options and arguments. - Include shortcut commands that behave like real commands to the command list (e.g. bootloader, rtc). - Add extra information and reword to address common misconceptions, in particular how commands chain together. - Add additional examples showing some more interesting combinations. - Add descriptions to each of the examples. - Add pipx installation instructions. - Describe how user-configuration works. This work was sponsored by Google Season of Docs. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
edf33ea
to
bd5d016
Compare
Minor
mpremote
updates:delay
command allowing a pause between commands.setrtc
"shortcut" command with a newrtc [--set]
command which allows getting/setting the RTC (to the current local time).setrtc
.cp
with no destination.Extensive documentation update for
mpremote
:command list (e.g. bootloader, rtc).
particular how commands chain together.
This work was funded in combination through GitHub Sponsors and Google Season of Docs.