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>
This commit is contained in:
parent
1298be72b2
commit
7c755ca3d1
|
|
@ -659,9 +659,12 @@ export const useSimulatorStore = create<SimulatorState>((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 <WiFi.h>') ||
|
||||
f.content.includes('#include <esp_wifi.h>') ||
|
||||
f.content.includes('#include "WiFi.h"') ||
|
||||
|
|
|
|||
Loading…
Reference in New Issue