diff --git a/README.md b/README.md index ca9557c..87bfa21 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,15 @@ pio device monitor ## Back to Normal To get your Tidbyt back to normal, you can run the following to flash the production firmware onto your Tidbyt: + +``` +pio run --target reset --environment tidbyt +``` + +And if you're working with a Tidbyt Gen 2: + ``` -pio run --target reset +pio run --target reset --environment tidbyt-gen2 ``` [1]: https://github.com/tidbyt/pixlet diff --git a/extra_scripts/reset.py b/extra_scripts/reset.py index d246319..3fd4899 100644 --- a/extra_scripts/reset.py +++ b/extra_scripts/reset.py @@ -3,9 +3,13 @@ import os.path import requests -PRODUCTION_VERSION = "v10/26961" +PRODUCTION_VERSION = { + "tidbyt": "v10/35369", + "tidbyt-gen2": "v11/35369" +}[env["PIOENV"]] def fetch_firmware(): + binaries = [ "firmware.bin", "partitions.bin", @@ -22,7 +26,7 @@ def fetch_firmware(): r = requests.get(f"https://storage.googleapis.com/tidbyt-public-firmware/{PRODUCTION_VERSION}/{binary}") if r.status_code != 200: raise Exception(f"Failed to fetch {binary}: {r.status_code}") - + with open(f".production/{PRODUCTION_VERSION}/{binary}", "wb") as f: f.write(r.content) @@ -58,4 +62,4 @@ def fetch_firmware(): RESET_UPLOADCMD='"$PYTHONEXE" "$RESET_UPLOADER" $RESET_UPLOADERFLAGS' ) -env.AddCustomTarget("reset", None, actions=['$RESET_UPLOADCMD']) \ No newline at end of file +env.AddCustomTarget("reset", None, actions=['$RESET_UPLOADCMD'])