Skip to content

Instantly share code, notes, and snippets.

@Josverl
Last active June 23, 2025 12:40
Show Gist options
  • Save Josverl/afe2cb1527a72772c86f355cba7de86d to your computer and use it in GitHub Desktop.
Save Josverl/afe2cb1527a72772c86f355cba7de86d to your computer and use it in GitHub Desktop.
mpremote API
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Things to improve for mpremote

CLI

Allow mkdir without returning errors

  • mkdir -p, --parents no error if existing, make parent directories as needed

make mpremote cp folder/* :/ work on windows

# copy the src directory to the root of the ESP32 filesystem
# workaround needed for windows issue with mpremote cp -r
cd src 
mpremote resume cp -r . :/
cd ..

versus mpremote handling for bash

# copy the src directory to the root of the ESP32 filesystem
mpremote cp -r src/* :/

API

Avoid sys.exit() in any of the defined APIs

  • Use exceptions instead
  • This allows the caller to handle the error gracefully instead of terminating the program

Avoid using print() in any of the defined APIs

  • Either return a value
  • or pass a print/log function as oneof the parameters to the API/framework
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment