Commit Graph

380 Commits

Author SHA1 Message Date
David Montero Crespo 46e459f51b Refactor I2C slave tests for ESP32: update event handling and improve accuracy of ACK/NACK responses; add full end-to-end test for MPU-6050 I2C simulation; update components metadata timestamp; mark subproject commits as dirty for wokwi-libs. 2026-04-09 15:06:39 -03:00
David Montero Crespo 5795b1d506 Fix MPU6050Slave I2C handling and add comprehensive tests
- Updated the threshold for switching to data mode in MPU6050Slave from 2 to 3 WHO_AM_I reads to ensure correct chip identification.
- Enhanced comments in the code to clarify the sequence of I2C events during initialization.
- Added a new test file `test_mpu6050_emulation.py` to validate the MPU6050Slave state machine and ensure it handles the full Adafruit_MPU6050::begin() event sequence correctly.
- Updated existing tests to reflect the changes in the I2C handling logic.
- Modified `components-metadata.json` to update the generated timestamp.
- Marked submodules `rp2040js` and `wokwi-elements` as dirty to reflect local changes.
2026-04-09 02:04:41 -03:00
David Montero 75c4ead6de Merge remote-tracking branch 'origin/master' 2026-04-09 02:36:06 +02:00
David Montero 6c95013f24 fix: prevent save to /api/projects/none when project ID is invalid
Two bugs causing "can't save project" reports:

1. SaveProjectModal: validate currentProject.id is a real UUID before
   calling updateProject. If id is "none" or any non-UUID string, fall
   through to createProject instead, avoiding PUT /api/projects/none.

2. ProjectByIdPage: call clearCurrentProject() when the project fetch
   fails (404/403/error). Prevents stale project IDs from a previous
   session polluting the store and triggering spurious update calls.
2026-04-09 02:34:43 +02:00
David Montero Crespo 4667c8bb3b feat: Enhance MPU6050Slave I2C handling with improved WHO_AM_I read tracking; update tests for clarity 2026-04-08 08:48:14 -03:00
David Montero Crespo a76f7b51fd
Merge pull request #106 from davidmonterocrespo24/feature/micropython-rp2040
Feature/micropython rp2040
2026-04-08 00:11:59 -03:00
David Montero Crespo a64b14c94e Merge branch 'master' into feature/micropython-rp2040
# Conflicts:
#	.gitignore
#	frontend/src/components/editor/EditorToolbar.tsx
#	frontend/src/components/simulator/SerialMonitor.tsx
#	frontend/src/types/board.ts
2026-04-08 00:11:23 -03:00
David Montero Crespo d03ce7df24
Merge pull request #105 from davidmonterocrespo24/feature/shareable-urls
Feature/shareable urls
2026-04-08 00:06:44 -03:00
David Montero Crespo 71fa6eae4a Merge branch 'master' into feature/shareable-urls
# Conflicts:
#	.gitignore
2026-04-08 00:03:59 -03:00
David Montero Crespo ca6520e48d feat: Update I2C event handling and improve MPU-6050 slave emulation; enhance README and tests 2026-04-08 00:02:54 -03:00
David Montero Crespo 0f2c39f23b feat: Add I2C sensor support and implement ESP32 I2C slave emulation
- Introduced I2C_SENSOR_MAP for pre-registering I2C sensors in the simulator store.
- Implemented I2C slave state machines for MPU6050, BMP280, DS1307, and DS3231 sensors in esp32_i2c_slaves.py.
- Added unit tests for I2C slave functionality covering BMP280, DS1307, DS3231, and I2CWriteSink.
- Updated the simulator store to handle I2C address resolution and sensor data management.
- Marked submodules as dirty in wokwi-libs for rp2040js and wokwi-elements.
2026-04-08 00:02:43 -03:00
David Montero Crespo 689f8e71db feat: Add I2C slave emulation for MPU-6050 and BMP280 sensors
- Implemented _MPU6050Slave and _BMP280Slave classes for I2C communication.
- Enhanced main function to register these sensors and handle I2C events.
- Updated sensor management to support MPU-6050, BMP280, DS1307, DS3231, SSD1306, and PCF8574.
- Added frontend examples for BMP280 weather station and SSD1306 OLED display.
- Modified Esp32Bridge to handle new I2C transaction events.
- Updated ProtocolParts to support ESP32 path for I2C devices.
- Enhanced useSimulatorStore to manage I2C transaction listeners.
2026-04-07 15:43:09 -03:00
David Montero Crespo 9761aad0be feat: enhance Arduino library handling by detecting external libraries and creating IDF components, add tests for library resolution logic 2026-04-07 14:59:51 -03:00
David Montero Crespo d789a2c7e2 fix: update version to 2.0.1, enhance Discord release notification workflow, and mark subproject commits as dirty 2026-04-07 14:12:10 -03:00
David Montero Crespo 4b473ade6a feat: add Discord release merge notification workflow 2026-04-07 14:11:46 -03:00
David Montero Crespo f43c9d019d fix: update generatedAt timestamp, improve wire properties, and mark subproject commits as dirty 2026-04-07 13:27:54 -03:00
David Montero Crespo 9e117ee5c7 feat: enhance wire connection handling and GND checks for components 2026-04-07 13:08:15 -03:00
David Montero Crespo 4f3236437a feat: implement component metadata overrides and enhance property controls 2026-04-07 11:33:34 -03:00
David Montero Crespo e489a10255 fix: update generatedAt timestamp and clean up component metadata defaults
feat: enhance wire tracking in DynamicComponent for better event handling
chore: mark subproject commits as dirty for rp2040js and wokwi-elements
2026-04-07 11:19:48 -03:00
David Montero Crespo 0e366ee5dc Add comprehensive documentation for Velxio Docker infrastructure
- Created `docker-infrastructure.md` detailing the Docker build system, CI/CD pipelines, multi-architecture support, and deployment configuration.
- Included sections on architecture diagram, multi-stage Docker builds, QEMU ESP32 build pipeline, Docker publish CI/CD pipeline, entrypoint script, Nginx reverse proxy configuration, and Docker Compose setup.
- Provided a quick start guide and troubleshooting tips for common issues.
2026-04-07 10:49:05 -03:00
David Montero Crespo a3db014d2d feat: multi-arch Docker (amd64+arm64) and fix LED ground check
Docker multi-arch:
- Dockerfile downloads arch-specific QEMU .so via TARGETARCH
- docker-publish.yml adds setup-qemu-action and platforms: linux/amd64,linux/arm64
- qemu-lcgamboa submodule updated (matrix build for both architectures)

LED fix:
- LEDs now require cathode wired to GND (or LOW GPIO) to light up
- Previously LEDs turned on with anode HIGH regardless of cathode connection
- Updated tests to verify anode+cathode behavior
2026-04-07 03:58:52 -03:00
David Montero Crespo 97f8f6cd52 feat: add protocol selection and editable properties in component dialogs 2026-04-07 03:58:17 -03:00
David Montero 5e372f1418 docs: add wiki — ESP32/C3 WiFi emulation investigation and fixes
Detailed document covering the full debugging process and three root
causes fixed to make WiFi association work in QEMU emulation:
  1. channel=0 in wifi_pkt_rx_ctrl_t
  2. wrong AP lookup due to beacon timer race
  3. DMA ring resetting to 0 after firmware clears next pointers
2026-04-07 04:36:06 +02:00
David Montero Crespo c697aa261d
Merge pull request #102 from davidmonterocrespo24/feature/load-precompiled-firmware
Feature/load precompiled firmware
2026-04-06 23:04:01 -03:00
David Montero ef299ba7fa fix: align ESP32 WiFi SSID/channel with QEMU access_points[] array
Two fixes for ESP32 WiFi not connecting in production:

1. espidf_compiler.py: Change WiFi normalization from 'Velxio-GUEST' on
   channel 6 to 'Espressif' on channel 5. The lcgamboa QEMU binary
   downloaded from GitHub Releases only contains the original three APs:
   PICSimLabWifi (ch1), Espressif (ch5), MasseyWifi (ch10). Channel 6
   had no matching AP, so the beacon timer's channel-match condition never
   fired → firmware scanned forever and never connected.

2. esp32_worker.py: Redirect fd 1 to /dev/null before loading QEMU so
   raw UART bytes from QEMU's -nographic mux don't corrupt the JSON
   event pipe. The real pipe fd is saved and sys.stdout is rebound so
   _emit() continues to work. This also prevents stdout pipe back-pressure
   from stalling qemu_main_loop() (and thus REALTIME timers).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 06:11:29 +02:00
David Montero 2a386f99b0 fix: SaveProjectModal uses active board files/kind and better error messages
Two bugs fixed:
1. SaveProjectModal was reading from the legacy global `files` array instead
   of the active board's file group, causing projects to be saved with the
   wrong board_type (e.g. 'arduino-uno' for ESP32 projects).
   Now reads from fileGroups[activeBoard.activeFileGroupId] and uses
   activeBoard.boardKind for board_type.

2. Error handling was always showing "Save failed." — now shows:
   - "Server unreachable. Check your connection and try again." for network errors
   - "Not authenticated. Please log in and try again." for 401 responses
   - The server's detail message (with status code) for other errors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 22:27:17 +02:00
David Montero 32acf80e0d fix: propagate has_wifi from compiler to startBoard for reliable WiFi detection
Frontend WiFi detection via file-content scanning was unreliable because
fileGroups[board.activeFileGroupId] could be an empty array (not null),
bypassing the ?? fallback to editorState.files.

Fix: the ESP-IDF compiler now returns has_wifi:bool in its compile response.
The frontend stores this on the BoardInstance and uses it in startBoard()
instead of scanning file contents. The file-content scan is kept as a
fallback for boards that haven't been compiled in this session.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 22:14:40 +02:00
David Montero 7c755ca3d1 fix: use board's file group for WiFi auto-detection instead of legacy global files
startBoard() was reading useEditorStore.getState().files (the legacy global
array with the default Arduino sketch) instead of the board's specific file
group. This caused hasWifi to always be false for ESP32 boards, so QEMU
never received the -nic flag and WiFi never connected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 21:36:04 +02:00
David Montero 1298be72b2 fix: add RISC-V toolchain paths to build env for ESP32-C3 compilation
_build_env() on Linux only set IDF_TOOLS_PATH but never added the tool
binary directories to PATH, so cmake could not find riscv32-esp-elf-g++
when compiling for ESP32-C3. Also improve ninja failure logging to show
stdout (where build errors actually appear) instead of empty stderr.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 20:55:38 +02:00
David Montero Crespo 0d83b09dd9
Merge pull request #93 from davidmonterocrespo24/feature/vscode-extension
feat: enhance logging for library loading and WiFi progress; update s…
2026-04-05 00:50:00 -03:00
David Montero Crespo b0fe5b5d14 feat: enhance logging for library loading and WiFi progress; update subproject commits 2026-04-05 00:49:25 -03:00
David Montero Crespo 79865ab289
Merge pull request #92 from davidmonterocrespo24/feature/vscode-extension
feat: enhance ESP32 boot stability with deterministic instruction cou…
2026-04-05 00:17:42 -03:00
David Montero Crespo 7ccd5a7b63 feat: enhance ESP32 boot stability with deterministic instruction counting and mark subprojects as dirty 2026-04-05 00:16:40 -03:00
David Montero Crespo 669fbe7e5c
Merge pull request #91 from davidmonterocrespo24/feature/vscode-extension
Feature/vscode extension
2026-04-04 23:32:28 -03:00
David Montero Crespo 4d87ea9bb9 feat: add ARDUINO_ESP32_PATH to docker-compose and mark subprojects as dirty 2026-04-04 23:32:09 -03:00
David Montero Crespo 826c207970 feat: update workflows for ESP-IDF toolchain and Docker image publishing 2026-04-04 23:28:06 -03:00
David Montero Crespo 9aab48ec64
Merge pull request #90 from davidmonterocrespo24/feature/vscode-extension
Feature/vscode extension
2026-04-04 18:04:22 -03:00
David Montero Crespo b73f28c174 feat: add pre-built ESP-IDF toolchain image workflow 2026-04-04 18:03:43 -03:00
David Montero Crespo 0a724b7566 feat: pre-built QEMU binaries from GitHub Release + WiFi SSID normalization
- Dockerfile: download pre-built .so + ROM from velxio public release
  instead of building from private qemu-lcgamboa source
- espidf_compiler: normalize any WiFi SSID → "Velxio-GUEST" for QEMU
  compatibility (channel 6, open auth)
- docker-compose.yml: unified dev/prod using Dockerfile.standalone
- .dockerignore: exclude qemu-lcgamboa source from Docker context
- .gitignore: ignore prebuilt/ binaries, keep .gitkeep

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 14:27:52 -03:00
David Montero Crespo 1afcbf7718 vs extension fix 2026-04-03 18:14:22 -03:00
David Montero Crespo 937ac36d04 Merge branch 'master' into feature/vscode-extension 2026-04-03 00:03:38 -03:00
David Montero Crespo ff12b83e34 feat: add ESP-IDF compilation service for QEMU-compatible firmware generation 2026-04-02 02:54:02 -03:00
David Montero Crespo d77a68e896 feat: add ESP-IDF compilation service for QEMU-compatible firmware generation 2026-04-02 00:12:38 -03:00
David Montero Crespo f495a2ce3a feat: implement ESP32 QEMU backend manager and frontend simulation interface 2026-04-01 22:41:52 -03:00
David Montero 69aaa070f2 chore: update sitemap.xml with current date
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 19:30:28 +02:00
David Montero f29e964e91 fix: ESP32 Run button auto-compiles and recovers firmware after page refresh
- handleRun now auto-compiles for ESP32/QEMU boards when no firmware is
  available (same behavior as AVR/RP2040 boards)
- startBoard now reloads compiledProgram into the bridge if _pendingFirmware
  was lost (e.g. after a page refresh between compile and run)
- Adds Esp32Bridge.hasFirmware() helper used by the store check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 18:47:15 +02:00
David Montero ba8b56c647 fix: install ESP-IDF Python requirements in final Docker stage
ESP-IDF 4.4.x requires specific package versions (reedsolo<=1.5.4,
bitstring<4, pyparsing<2.4.0, kconfiglib==13.7.1, etc.) that conflict
with newer defaults. Installing requirements.txt after copying ESP-IDF
ensures the correct versions are used and cmake configure succeeds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 07:45:47 +02:00
David Montero 372e4aea38 fix: add git and packaging to runtime image for ESP-IDF cmake
- git is required by ESP-IDF cmake to resolve submodules and version info
- packaging Python package is required by ESP-IDF Python dependency checks
  during cmake configure step

Without these, ESP32 compilation fails at cmake configure with:
  "Some Python dependencies must be installed"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 07:39:46 +02:00
David Montero 447ab872f5 fix: add cmake, ninja-build and libusb to runtime image
- cmake and ninja are required by ESP-IDF compilation pipeline but were
  missing from the final stage, causing all ESP32 compilations to fail
- libusb-1.0-0 fixes the openocd-esp32 shared library warning on startup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 07:28:01 +02:00
David Montero 8cff52bb2e fix: ignore ESP-IDF export.sh non-zero exit to prevent container crash
The openocd-esp32 tool fails with exit code 127 due to missing libusb-1.0.so.0
in the runtime image. With set -e, this caused the entrypoint to exit before
starting uvicorn and nginx, putting the container in a restart loop.

Adding || true allows the ESP-IDF environment to be sourced while tolerating
the non-critical openocd warning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 07:18:35 +02:00