From 0c4ea3c3700c596d1e877d30d62620f06827fcce Mon Sep 17 00:00:00 2001 From: "V.J. Manzo" <3967529+vjmanzo@users.noreply.github.com> Date: Sun, 28 Dec 2025 18:57:19 -0500 Subject: [PATCH 1/7] initial commit tested and working with productionSquidbox --- README.md | 31 +++++++++++++++++++++++++++- scripts/merge_firmware.py | 21 ++++++++++++++++--- src/components/joystick/Joystick.cpp | 7 ++++++- 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0ee1f71..1a96400 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,35 @@ Squidbox is a low-cost Bluetooth MIDI controller. It provides an intuitive and interactive way to learn about scales and chords while having fun making music. It runs on an ESP32 and features a 2-axis joystick, a small OLED screen, a knob, and multiple buttons. +## Flashing Quickstart (PlatformIO CLI) + +Assumes you have the board connected (USB) and PlatformIO CLI installed (`pip install platformio` and make sure `pio` is on your PATH). + +Replace `/dev/cu.usbserial-XXXX` with your serial port (check with `pio device list`). + +Copying and entering this two-line command below should get the firmware built and pushed to the Squidbox: + +# Build + upload main firmware +pio run -e adafruit_feather_esp32_v2 -t upload --upload-port /dev/cu.usbserial-59690893931 + +# Upload the LittleFS data (presets in data/config.json) +pio run -e adafruit_feather_esp32_v2 -t uploadfs --upload-port /dev/cu.usbserial-59690893931 + + +Here are the general commands we use: + +- Build + upload Squidbox firmware (Feather ESP32 V2 target): + `pio run -e adafruit_feather_esp32_v2 -t upload --upload-port /dev/cu.usbserial-XXXX` +- Upload LittleFS data (presets in `data/`): + `pio run -e adafruit_feather_esp32_v2 -t uploadfs --upload-port /dev/cu.usbserial-XXXX` +- Serial monitor at project baud: + `pio device monitor -b 115200 --port /dev/cu.usbserial-XXXX --echo` +- If you are using the DevKit simulation target instead: + `pio run -e esp32dev -t buildfs -t upload --upload-port /dev/cu.usbserial-XXXX` + +If upload hangs on “Connecting…”, hold BOOT during that phase and release after the dots start. Press EN/reset to reboot after flashing. + + ## Contributing -Navigate to the [CONTRIBUTING.md](./CONTRIBUTING.md) file for guidelines on how to contribute to the project. +Navigate to the [CONTRIBUTING.md](./CONTRIBUTING.md) file for guidelines on how to contribute to the project. \ No newline at end of file diff --git a/scripts/merge_firmware.py b/scripts/merge_firmware.py index aca85aa..f4a3047 100644 --- a/scripts/merge_firmware.py +++ b/scripts/merge_firmware.py @@ -39,8 +39,23 @@ def merge_bin(source, target, env): # Add a post action that runs esptoolpy to merge available flash images env.AddPostAction(APP_BIN, merge_bin) +# Also ensure the merged binary exists before upload even if the program binary +# wasn't rebuilt in this invocation (e.g., when only uploading an unchanged build). +env.AddPreAction("upload", merge_bin) + # Patch the upload command to flash the merged binary at address 0x0 -env.Replace( - UPLOADERFLAGS=[] + ["0x0", MERGED_BIN], - UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS', +# Keep PlatformIO's default uploader flags (chip/port/baud/reset/write_flash options), +# but replace the individual address/file pairs with our single merged image. +original_upload_flags = list(env.get("UPLOADERFLAGS", [])) +first_addr_idx = next( + (i for i, flag in enumerate(original_upload_flags) if str(flag).startswith("0x")), + None, ) + +if first_addr_idx is None: + # Unexpected shape; fall back to appending. + new_upload_flags = original_upload_flags + ["0x0", MERGED_BIN] +else: + new_upload_flags = original_upload_flags[:first_addr_idx] + ["0x0", MERGED_BIN] + +env.Replace(UPLOADERFLAGS=new_upload_flags, UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS') diff --git a/src/components/joystick/Joystick.cpp b/src/components/joystick/Joystick.cpp index 90dc9d3..52531c4 100644 --- a/src/components/joystick/Joystick.cpp +++ b/src/components/joystick/Joystick.cpp @@ -56,7 +56,12 @@ float Joystick::getX() { float Joystick::getY() { // Convert the raw Y value to a value in the range -1 to 1 and return it. + // Invert on hardware so pushing the stick up yields positive (UP) values. +#ifdef SIMULATION return convertRawValue(getRawY(), Y_CENTER, Y_MIN, Y_MAX); +#else + return -convertRawValue(getRawY(), Y_CENTER, Y_MIN, Y_MAX); +#endif } bool Joystick::isPressed() { @@ -142,4 +147,4 @@ bool Joystick::wasDownJustInputted() { wasDown = downInputted; // Return whether the joystick was just moved down. return downJustInputted; -} \ No newline at end of file +} From 9bcf12b6bc854272683ae836560db6e664c5ae12 Mon Sep 17 00:00:00 2001 From: "V.J. Manzo" <3967529+vjmanzo@users.noreply.github.com> Date: Sun, 28 Dec 2025 19:07:58 -0500 Subject: [PATCH 2/7] updated readme --- LICENSE | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index eff10bd..5336070 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Kai Nakamura +Copyright (c) 2024 EAMIR Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 1a96400..5839764 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Squidbox -Squidbox is a low-cost Bluetooth MIDI controller. It provides an intuitive and interactive way to learn about scales and chords while having fun making music. It runs on an ESP32 and features a 2-axis joystick, a small OLED screen, a knob, and multiple buttons. +The EAMIR Squidbox is a low-cost Bluetooth MIDI controller. It provides an intuitive and interactive way to learn about scales and chords while having fun making music. It runs on an ESP32 and features a 2-axis joystick, a small OLED screen, a knob, and multiple buttons. ## Flashing Quickstart (PlatformIO CLI) From e984aa870d66cfdb512537fd9c21512fe530d85c Mon Sep 17 00:00:00 2001 From: "V.J. Manzo" Date: Mon, 29 Dec 2025 17:07:45 -0500 Subject: [PATCH 3/7] Update README.md --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5839764..dc0e7b0 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,14 @@ Here are the general commands we use: If upload hangs on “Connecting…”, hold BOOT during that phase and release after the dots start. Press EN/reset to reboot after flashing. +## Related + +- The Squidbox Configuration Editor is available at https://eamirorg.github.io/Squidbox-web-editor/ + +- The Squidbox Configuration Editor source is available at https://github.com/EAMIRorg/Squidbox-web-editor + + + ## Contributing -Navigate to the [CONTRIBUTING.md](./CONTRIBUTING.md) file for guidelines on how to contribute to the project. \ No newline at end of file +Navigate to the [CONTRIBUTING.md](./CONTRIBUTING.md) file for guidelines on how to contribute to the project. From e6c90e102ccb6e6632dfc2e63c19c08e486007d5 Mon Sep 17 00:00:00 2001 From: "V.J. Manzo" Date: Mon, 29 Dec 2025 17:44:01 -0500 Subject: [PATCH 4/7] Update README.md --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dc0e7b0..157a0d5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,26 @@ # Squidbox -The EAMIR Squidbox is a low-cost Bluetooth MIDI controller. It provides an intuitive and interactive way to learn about scales and chords while having fun making music. It runs on an ESP32 and features a 2-axis joystick, a small OLED screen, a knob, and multiple buttons. +The EAMIR Squidbox is a low-cost Bluetooth MIDI controller. It provides an intuitive and interactive way to learn about scales and chords while having fun making music. It runs on an ESP32 and features a 2-axis joystick, a small OLED screen, a knob, and multiple buttons. + +## Python + PlatformIO setup (macOS) + +In Terminal on MacOS: +- Verify Python 3 is available by running: `python3 --version` +- Install PlatformIO via pip (preferred): `python3 -m pip install --user platformio` (or `pip3 install --user platformio`) +- Confirm install: `python3 -m platformio --version` +- If `platformio`/`pio` is not found, add your Python user bin to PATH: + - Find the user base: `python3 -m site --user-base` (expect something like `/Users//Library/Python/3.xx`) + - Add it: `echo 'export PATH="/Users//Library/Python/3.xx/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc` +- If all of that fails, use install platformio through Homebrew as an alternative: `brew install platformio` + +In VSCode: +- Restart VSCode +- Open the Terminal and test by running: `which platformio`, `which pio`, `pio --version` +- If it still cannot find `pio`, set the same PATH in VS Code settings (`terminal.integrated.env.osx`) or select the `python3` interpreter in the Command Palette by Opening VS Code settings (Command Palette → “Preferences: Open User Settings (JSON)”). Add or update this: "terminal.integrated.env.osx": { + "PATH": "/Users//Library/Python/3.xx/bin:${env:PATH}" +} + (replace with your actual user bin path from python3 -m site --user-base): + ## Flashing Quickstart (PlatformIO CLI) From 4a5a384d191d2d9eaf65f724d7ddf475ce9d8eba Mon Sep 17 00:00:00 2001 From: "V.J. Manzo" Date: Mon, 29 Dec 2025 17:49:04 -0500 Subject: [PATCH 5/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 157a0d5..401be26 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ In Terminal on MacOS: - If `platformio`/`pio` is not found, add your Python user bin to PATH: - Find the user base: `python3 -m site --user-base` (expect something like `/Users//Library/Python/3.xx`) - Add it: `echo 'export PATH="/Users//Library/Python/3.xx/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc` -- If all of that fails, use install platformio through Homebrew as an alternative: `brew install platformio` +- Alternatively, install platformio through Homebrew: `brew install platformio` In VSCode: - Restart VSCode -- Open the Terminal and test by running: `which platformio`, `which pio`, `pio --version` +- Open the Terminal and test by running: `platformio --version` (or `pio --version`),`which platformio` (or `which pio`) - If it still cannot find `pio`, set the same PATH in VS Code settings (`terminal.integrated.env.osx`) or select the `python3` interpreter in the Command Palette by Opening VS Code settings (Command Palette → “Preferences: Open User Settings (JSON)”). Add or update this: "terminal.integrated.env.osx": { "PATH": "/Users//Library/Python/3.xx/bin:${env:PATH}" } From 602918eb2b481dc432659499e87b95223642be99 Mon Sep 17 00:00:00 2001 From: "V.J. Manzo" Date: Mon, 29 Dec 2025 19:37:43 -0500 Subject: [PATCH 6/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 401be26..3b1d08a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ In Terminal on MacOS: - Confirm install: `python3 -m platformio --version` - If `platformio`/`pio` is not found, add your Python user bin to PATH: - Find the user base: `python3 -m site --user-base` (expect something like `/Users//Library/Python/3.xx`) - - Add it: `echo 'export PATH="/Users//Library/Python/3.xx/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc` + - Add run: `echo 'export PATH="/Users//Library/Python/3.xx/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc` - Alternatively, install platformio through Homebrew: `brew install platformio` In VSCode: From 64cf1338fc00328aad3f5040b65a4d1abfefb46a Mon Sep 17 00:00:00 2001 From: "V.J. Manzo" <3967529+vjmanzo@users.noreply.github.com> Date: Tue, 30 Dec 2025 14:39:13 -0500 Subject: [PATCH 7/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3b1d08a..40c8256 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,12 @@ The EAMIR Squidbox is a low-cost Bluetooth MIDI controller. It provides an intui In Terminal on MacOS: - Verify Python 3 is available by running: `python3 --version` -- Install PlatformIO via pip (preferred): `python3 -m pip install --user platformio` (or `pip3 install --user platformio`) + - If not installed, install from `https://www.python.org/downloads/` (or through Homebrew: `brew install python`) +- Install PlatformIO via pip (preferred): `python3 -m pip install --user platformio` (or `pip3 install --user platformio`) (or through Homebrew: `brew install platformio`) - Confirm install: `python3 -m platformio --version` - If `platformio`/`pio` is not found, add your Python user bin to PATH: - Find the user base: `python3 -m site --user-base` (expect something like `/Users//Library/Python/3.xx`) - Add run: `echo 'export PATH="/Users//Library/Python/3.xx/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc` -- Alternatively, install platformio through Homebrew: `brew install platformio` In VSCode: - Restart VSCode