Skip to content

Commit

Permalink
make reset target work for gen2
Browse files Browse the repository at this point in the history
  • Loading branch information
matslina committed Sep 11, 2024
1 parent dc1908e commit cf66c71
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions extra_scripts/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)

Expand Down Expand Up @@ -58,4 +62,4 @@ def fetch_firmware():
RESET_UPLOADCMD='"$PYTHONEXE" "$RESET_UPLOADER" $RESET_UPLOADERFLAGS'
)

env.AddCustomTarget("reset", None, actions=['$RESET_UPLOADCMD'])
env.AddCustomTarget("reset", None, actions=['$RESET_UPLOADCMD'])

0 comments on commit cf66c71

Please sign in to comment.