Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# ampy replacement
We have been working on the next version of ampy which will solve various problems with the current system. Based on a new modular architecture, it makes adding device support and features very simple using plugins. It also aims to support coding over WiFi for supported devices. This should eliminate the need to have a wired connection and improve reliability as well.
[Here](https://github.com/curiouswala/ampy-2) is an alpha release please go ahead and play with it. Leave suggestions for a new name in the issue section. :)
## Interactive ampy

This is a fork of ampy to add an interactive frontend to the program. It also means to add some extra
functionality to make manipulation of files on the local and remote system more like working in a linux
terminal. Little bug fixes will be added as necessary. This tool is focused on MicroPython compatibility
right now and so no guarantees any of this will work with CircuitPython.

As of now, all features of ampy are available to the new interactive client, plus the quality-of-life stuff to
make file management between computer and device easier. The tool can drop you into the REPL of your device with
tio, and everything's fully documented through an in-client help command.

Features:
- Interactive bash-style client to manage a MicroPython device on the cli
- Client implements a working directory on your MicroPython device's filesystem and manages the working directory on your local PC
- Filesystem navigation relative to current working directory (on both PC and microcontroller filesystem)
- Overwrite protection for file I/O operations.
- Client tracks what is a file and what is a directory and tells you which is which.
- Remotely execute script files stored on your microcontroller as well as files stored locally on your PC
- Client keeps track of previous commands - quickly re-enter long commands using partial implementation of bash bang syntax

I am confident there are bugs to track down and features which need some finessing, but the basics are all there!

## ampy

Expand Down
13 changes: 6 additions & 7 deletions ampy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

import click
import dotenv
from progress_bar import PorgressBar
from progress_bar import PorgressBarBath
from progress_bar import ProgressBar

# Load AMPY_PORT et al from .ampy file
# Performed here because we need to beat click's decorators.
Expand All @@ -50,7 +49,7 @@ def windows_full_port_name(portname):
# 9 are just referred to by COM1, COM2, etc. (wacky!) See this post for
# more info and where this code came from:
# http://eli.thegreenplace.net/2009/07/31/listing-all-serial-ports-on-windows-with-python/
m = re.match("^COM(\d+)$", portname)
m = re.match(r"^COM(\d+)$", portname)
if m and int(m.group(1)) < 10:
return portname
else:
Expand Down Expand Up @@ -253,12 +252,12 @@ def put(local, remote):
# Otherwise it's a file and should simply be copied over.
if os.path.isdir(local):
# Create progress bar for each file
pb_bath = PorgressBarBath('Overall progress')
pb_bath = ProgressBar('Overall progress')
for parent, child_dirs, child_files in os.walk(local, followlinks=True):
for filename in child_files:
path = os.path.join(parent, filename)
size = os.stat(path).st_size
pb_bath.add_subjob(PorgressBar(name=path,total=size ))
pb_bath.add_subjob(ProgressBar(name=path,total=size ))

# Directory copy, create the directory and walk all children to copy
# over the files.
Expand Down Expand Up @@ -289,9 +288,9 @@ def put(local, remote):
# Put the file on the board.
with open(local, "rb") as infile:
data = infile.read()
progress = PorgressBar(name=local, total=len(data))
# progress = ProgressBar()
board_files = files.Files(_board)
board_files.put(remote, data, progress.on_progress_done)
board_files.put(remote, data, None)
print('')

@cli.command()
Expand Down
Loading