Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make reset target work for gen2 #18

Merged
merged 1 commit into from
Sep 11, 2024
Merged
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
make reset target work for gen2
matslina committed Sep 11, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit cf66c71eae8f0d8254c7d50daabf1ed8d0440167
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
10 changes: 7 additions & 3 deletions extra_scripts/reset.py
Original file line number Diff line number Diff line change
@@ -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'])
env.AddCustomTarget("reset", None, actions=['$RESET_UPLOADCMD'])