From 7c755ca3d196306f0bd5d37c5e6cea47676a7071 Mon Sep 17 00:00:00 2001 From: David Montero Date: Sun, 5 Apr 2026 21:36:04 +0200 Subject: [PATCH] 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 --- frontend/src/store/useSimulatorStore.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/store/useSimulatorStore.ts b/frontend/src/store/useSimulatorStore.ts index f0ce286..045a69c 100644 --- a/frontend/src/store/useSimulatorStore.ts +++ b/frontend/src/store/useSimulatorStore.ts @@ -659,9 +659,12 @@ export const useSimulatorStore = create((set, get) => { } esp32Bridge.setSensors(sensors); - // Auto-detect WiFi usage in sketch files - const editorFiles = useEditorStore.getState().files; - const hasWifi = editorFiles.some(f => + // Auto-detect WiFi usage in this board's sketch files. + // Use the board's file group (not the legacy global files array). + const editorState = useEditorStore.getState(); + const boardFiles = editorState.fileGroups[board.activeFileGroupId] + ?? editorState.files; + const hasWifi = boardFiles.some(f => f.content.includes('#include ') || f.content.includes('#include ') || f.content.includes('#include "WiFi.h"') ||