🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Tools: ampy reloaded

    PROJECTS
    1
    2
    5.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      felix42eu
      last edited by

      ampy is a great console script implemented in Python to conntect to the M5/Micropython Devices via serial terminal

      NOTE: so this will not work if another tool (like putty) already using the serial port!

      The following command (in windows style) would print the content of the file boot.py from the system on the command line

      ampy -p COM1 get /flash/boot.py
      

      Use the following to write a new file

      ampy -p COM1 get /flash/boot.py  boot.py
      

      that is

      ampy -p {{port}} get  {{remote_file_path}}  {{local_file_path}}
      

      To put a file on the device you have to write

      ampy -p COM1 put boot.py /flash/boot.py
      

      that is

      ampy -p {{port}}  put {{local_file_path}} {{remote_file_path}}
      

      There are some ideas for improvement of the process of ampy:

      1. the serial port would better be read from a configuration file, hence it often the same entry

      you may use the environment variable AMPY_PORT, AMPY_BAUD... but this is a little bit too static
      you can find my test code on the forked repository https://github.com/ahaeberle/ampy

      1. add default path for local files and write them without giving the name on a second parameter

      from the system on the command line to write a new file.

      remember to put the an ampy.json in the folder or use a --json {{filename}}

      ampy -p COM1 get /flash/boot.py
      

      Use the following to write a new file

      ampy get /flash/boot.py  # with implicit filename
      
      1. add default path for remote files to put them with a simpler command

      new command to get a file with an ampy.json in the calling directory

      ampy get /flash/boot.py   
      

      that is

      ampy get  {{remote_file_path}}  # implicit name and path with json
      

      and the JSON-File

      {
          "AMPY_PORT": "COM1",
          "AMPY_DELAY":     0.0,
          "AMPY_BAUD": 115200,
          "REMOTE_PATH": "/flash/",
          "LOCAL_PATH": "./"
      }
      
      1 Reply Last reply Reply Quote 0
      • F
        felix42eu
        last edited by

        there is a small mistake in the last commands:

        ampy put boot.py

        that is

        ampy put {{local_file_path}} # implicit remote path and name with json

        and the JSON-File

        1 Reply Last reply Reply Quote 0
        • First post
          Last post