diff --git a/src/gateway/routes-arduino.ts b/src/gateway/routes-arduino.ts index 0a81c57..14b24d9 100644 --- a/src/gateway/routes-arduino.ts +++ b/src/gateway/routes-arduino.ts @@ -1961,10 +1961,10 @@ app.post('/api/arduino/renode/start', async (req, res) => { const gpioHeader = [ 'static char _rn_pbuf[8];', 'static const char* _RN_PNAME(uint32_t p) {', - ' PinName pn = digitalPinToPinName(p);', - ' if (pn == NC) return "?";', - ' int port = ((uint32_t)pn >> 4) & 0xF;', - ' int pin = (uint32_t)pn & 0xF;', + ' // PB_3·PA_0 등 STM32 PinName 상수는 (port*16+pin) 인코딩', + ' // digitalPinToPinName()은 Arduino 핀 번호로 해석해 엉뚱한 핀 반환 — 직접 디코딩', + ' int port = (p >> 4) & 0xF;', + ' int pin = p & 0xF;', ' _rn_pbuf[0]=\'P\'; _rn_pbuf[1]=\'A\'+port;', ' if (pin>=10){_rn_pbuf[2]=\'1\';_rn_pbuf[3]=\'0\'+(pin-10);_rn_pbuf[4]=0;}', ' else {_rn_pbuf[2]=\'0\'+pin;_rn_pbuf[3]=0;}', @@ -2087,13 +2087,8 @@ app.post('/api/arduino/renode/start', async (req, res) => { if (trimmed.includes('[WARNING]')) continue; // Renode 프롬프트/모니터/버전 라인 생략 if (/^\(monitor\)|^\(STM32\)|^i @\/tmp\/|^Renode,/.test(trimmed)) continue; - console.error('[Renode]', trimmed); - // 시리얼 모니터에는 "Machine started"와 ERROR만 표시 — 나머지는 콘솔 전용 - if (trimmed.includes('Machine started')) { - // 타임스탬프·[INFO] 제거, 앞뒤 빈 줄로 스케치 출력과 구분 - const clean = trimmed.replace(/^\S+\s+\[INFO\]\s*/, ''); - _ssePush('data: ' + JSON.stringify({ serial: '\n[Renode] ' + clean + '\n\n' }) + '\n\n'); - } else if (trimmed.includes('[ERROR]')) { + // 시리얼 모니터에는 ERROR만 표시 + if (trimmed.includes('[ERROR]')) { _ssePush('data: ' + JSON.stringify({ serial: '[Renode] ' + trimmed + '\n' }) + '\n\n'); } } diff --git a/web-ui/arduino-emulator.html b/web-ui/arduino-emulator.html index 6f4615c..96202cd 100644 --- a/web-ui/arduino-emulator.html +++ b/web-ui/arduino-emulator.html @@ -3023,13 +3023,15 @@ function initEsp32Mode(sessionId, fname, fqbn) { let _renodeSessionId = null; let _renodeEvtSource = null; -// Arduino 번호 → STM32 핀 이름 (STM32duino BLUEPILL_F103C8 순서) +// Arduino 번호 → STM32 핀 이름 (variant_PILL_F103Cx 실제 순서) +// D0=PB9 … D6=PB3, D7=PA15, D8=PA12 … D17=PC13 … D19=PC15, D20=PA0 … const _STM32_ARDUINO_PINS = [ - 'PA0','PA1','PA2','PA3','PA4','PA5','PA6','PA7', // D0-D7 - 'PB0','PB1','PB10','PB11','PB12','PB13','PB14','PB15', // D8-D15 - 'PA8','PA9','PA10','PA11','PA12','PA15', // D16-D21 - 'PB3','PB4','PB5','PB6','PB7','PB8','PB9', // D22-D28 - 'PC13','PC14','PC15', // D29-D31 + 'PB9','PB8','PB7','PB6','PB5','PB4','PB3', // D0-D6 + 'PA15','PA12','PA11','PA10','PA9','PA8', // D7-D12 + 'PB15','PB14','PB13','PB12', // D13-D16 + 'PC13','PC14','PC15', // D17-D19 + 'PA0','PA1','PA2','PA3','PA4','PA5','PA6','PA7', // D20-D27 + 'PB0','PB1','PB10','PB11','PB2','PA13','PA14', // D28-D34 ]; // HIGH/LOW/1/0/0x1/0x0 → 0 or 1