fix: 코드 AI에 STM32 보드 컨텍스트 항상 포함

- _boardSpecificHints에 stm32 케이스 추가 (C++/Arduino 명시, Python 금지)
- boardBlock: hints 유무 관계없이 보드명+FQBN 항상 시스템 프롬프트에 포함

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
kim
2026-06-30 16:54:22 +09:00
co-authored by Claude Sonnet 4.6
parent 11799e7553
commit b5155a153b
+14 -1
View File
@@ -1615,6 +1615,17 @@ function _boardSpecificHints(code = '') {
if (usesWifi) lines.push('- WiFi 실드: #include <SPI.h> + #include <WiFiNINA.h> 또는 #include <WiFi.h>');
return '\n' + lines.join('\n');
}
if (arch === 'stm32') {
return '\n' + [
'STM32 (Arduino) 코딩 규칙 (반드시 준수):',
'- 언어: C++ (Arduino 스케치), Python 절대 사용 금지',
'- 핀 이름: PB_3·PA_0 등 STM32 PinName 상수 사용. Arduino D-number와 혼용 주의',
'- Serial = USART1 (PA9/PA10), Serial.begin(115200) 필수',
'- analogWrite() 없음 → HardwareTimer + PWM 채널 사용',
'- Wire(I2C1): SDA=PB7, SCL=PB6 (블루필 기본)',
'- SPI1: MOSI=PA7, MISO=PA6, SCK=PA5',
].join('\n');
}
return '';
}
@@ -2862,7 +2873,9 @@ function _buildCodeSystemPrompt() {
const summaryBlock = _historySummary ? `\n[이전 대화 요약]\n${_historySummary}\n` : '';
const _activeCode = (() => { try { const f = codeFiles.find(f => f.id === activeCodeFileId); return f?.model?.getValue() || f?.content || ''; } catch { return ''; } })();
const boardHints = _boardSpecificHints(_activeCode);
const boardBlock = boardHints ? `\n## 대상 보드: ${_csbSelBoard.name} (${_csbSelBoard.fqbn})${boardHints}\n` : '';
const boardBlock = _csbSelBoard?.fqbn
? `\n## 대상 보드: ${_csbSelBoard.name} (${_csbSelBoard.fqbn})${boardHints}\n`
: '';
const karpathyBlock = _karpathyMode ? `
## Karpathy 코딩 가이드라인 (필수)
1. Think Before Coding — 가정을 명시하고, 모호하면 질문하세요. 여러 해석 가능 시 제시 후 선택하세요.