Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/assets/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,12 @@
"Time to reach max scroll speed in steps (default: 40)": "最大スクロール速度に到達するまでのステップ数(デフォルト: 40)",
"Time in ms to hold combo for hold behavior (default: 150)": "コンボのホールド動作に必要な保持時間(ミリ秒、デフォルト: 150)",
"Only trigger combos from this layer number": "このレイヤー番号からのみコンボを発動する",
"Audio": "オーディオ",
"Voices": "ボイス",
"Macro Beep": "マクロビープ",
"Audio output pins, comma-separated (e.g. C6, B5)": "オーディオ出力ピン(カンマ区切り、例: C6, B5)",
"Encoder": "エンコーダー",
"Audio": "オーディオ",
"Primary audio output pin (e.g. C6, B5)": "メインオーディオ出力ピン(例: C6, B5)",
"Secondary audio output pin for stereo or alternative output": "ステレオまたは代替出力用のセカンダリオーディオ出力ピン",
"Audio driver (pwm_hardware, pwm_software, dac_basic, dac_additive)": "オーディオドライバー(pwm_hardware, pwm_software, dac_basic, dac_additive)",
"Enable multiple audio voices to play different sounds simultaneously": "複数のオーディオボイスを有効にして異なるサウンドを同時に再生する",
"Play a beep sound when a macro is executed": "マクロ実行時にビープ音を鳴らす"
"Add a delay during audio initialization to avoid startup noise": "起動時のノイズを避けるためにオーディオ初期化に遅延を追加する",
"GPIO pin to detect USB VBUS for split keyboard host detection": "スプリットキーボードのホスト検出用 USB VBUS 検出 GPIO ピン"
}
153 changes: 153 additions & 0 deletions src/components/workbench/dialogs/ConfigHSettingsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React, {
useMemo,
} from 'react';
import {
Autocomplete,
FormControlLabel,
Stack,
Switch,
Expand Down Expand Up @@ -141,6 +142,16 @@ export function ConfigHSettingsPanel(props: ConfigHSettingsPanelProps) {
const [leaderPerKeyTiming, setLeaderPerKeyTiming] = useState(false);
const [leaderNoTimeout, setLeaderNoTimeout] = useState(false);

// --- Hardware ---
const [usbVbusPin, setUsbVbusPin] = useState('');

// --- Audio ---
const [audioPin, setAudioPin] = useState('');
const [audioPinAlt, setAudioPinAlt] = useState('');
const [audioDriver, setAudioDriver] = useState('');
const [audioVoices, setAudioVoices] = useState(false);
const [audioInitDelay, setAudioInitDelay] = useState(false);

// Helper to read a numeric value from defines
const getNumeric = (defines: ConfigDefines, key: string): string => {
const val = defines.get(key);
Expand Down Expand Up @@ -206,6 +217,16 @@ export function ConfigHSettingsPanel(props: ConfigHSettingsPanelProps) {
setLeaderTimeout(getNumeric(defines, 'LEADER_TIMEOUT'));
setLeaderPerKeyTiming(getFlag(defines, 'LEADER_PER_KEY_TIMING'));
setLeaderNoTimeout(getFlag(defines, 'LEADER_NO_TIMEOUT'));

// Hardware
setUsbVbusPin(getNumeric(defines, 'USB_VBUS_PIN'));

// Audio
setAudioPin(getNumeric(defines, 'AUDIO_PIN'));
setAudioPinAlt(getNumeric(defines, 'AUDIO_PIN_ALT'));
setAudioDriver(getNumeric(defines, 'AUDIO_DRIVER'));
setAudioVoices(getFlag(defines, 'AUDIO_VOICES'));
setAudioInitDelay(getFlag(defines, 'AUDIO_INIT_DELAY'));
} catch {
// Invalid config.h - leave defaults
}
Expand Down Expand Up @@ -280,6 +301,23 @@ export function ConfigHSettingsPanel(props: ConfigHSettingsPanelProps) {
setBool('LEADER_PER_KEY_TIMING', leaderPerKeyTiming);
setBool('LEADER_NO_TIMEOUT', leaderNoTimeout);

// Hardware
const setStr = (key: string, value: string) => {
if (value.trim()) {
defines.set(key, value.trim());
} else {
removedKeys.add(key);
}
};
setStr('USB_VBUS_PIN', usbVbusPin);

// Audio
setStr('AUDIO_PIN', audioPin);
setStr('AUDIO_PIN_ALT', audioPinAlt);
setStr('AUDIO_DRIVER', audioDriver);
setBool('AUDIO_VOICES', audioVoices);
setBool('AUDIO_INIT_DELAY', audioInitDelay);

return generateConfigH(props.configHContent, defines, removedKeys);
} catch {
return null;
Expand Down Expand Up @@ -318,6 +356,12 @@ export function ConfigHSettingsPanel(props: ConfigHSettingsPanelProps) {
leaderTimeout,
leaderPerKeyTiming,
leaderNoTimeout,
usbVbusPin,
audioPin,
audioPinAlt,
audioDriver,
audioVoices,
audioInitDelay,
]);

// Auto-apply form changes with debounce
Expand Down Expand Up @@ -435,6 +479,24 @@ export function ConfigHSettingsPanel(props: ConfigHSettingsPanelProps) {
alignItems: 'flex-start',
}}
/>
<Tab
label={t('Hardware')}
sx={{
minHeight: 36,
py: 0.5,
textTransform: 'none',
alignItems: 'flex-start',
}}
/>
<Tab
label={t('Audio')}
sx={{
minHeight: 36,
py: 0.5,
textTransform: 'none',
alignItems: 'flex-start',
}}
/>
</Tabs>
<div style={{ flex: 1, overflowY: 'auto', padding: '16px' }}>
{/* === Tap/Hold Tab === */}
Expand Down Expand Up @@ -832,6 +894,97 @@ export function ConfigHSettingsPanel(props: ConfigHSettingsPanelProps) {
</div>
</Stack>
)}

{/* === Hardware Tab === */}
{activeTab === 6 && (
<Stack spacing={3}>
<div>
<SectionHeader>{t('Hardware')}</SectionHeader>
<Stack spacing={2} sx={{ mt: 1 }}>
<TextField
label="USB_VBUS_PIN"
size="small"
fullWidth
value={usbVbusPin}
onChange={(e) => setUsbVbusPin(e.target.value)}
placeholder="GP19"
helperText={t(
'GPIO pin to detect USB VBUS for split keyboard host detection'
)}
/>
</Stack>
</div>
</Stack>
)}

{/* === Audio Tab === */}
{activeTab === 7 && (
<Stack spacing={3}>
<div>
<SectionHeader>{t('Audio')}</SectionHeader>
<Stack spacing={2} sx={{ mt: 1 }}>
<TextField
label="AUDIO_PIN"
size="small"
fullWidth
value={audioPin}
onChange={(e) => setAudioPin(e.target.value)}
placeholder="C6"
helperText={t('Primary audio output pin (e.g. C6, B5)')}
/>
<TextField
label="AUDIO_PIN_ALT"
size="small"
fullWidth
value={audioPinAlt}
onChange={(e) => setAudioPinAlt(e.target.value)}
placeholder="B5"
helperText={t(
'Secondary audio output pin for stereo or alternative output'
)}
/>
<Autocomplete
size="small"
freeSolo
options={[
'pwm_hardware',
'pwm_software',
'dac_basic',
'dac_additive',
]}
value={audioDriver}
onInputChange={(_e, value) => setAudioDriver(value)}
renderInput={(params) => (
<TextField
{...params}
label="AUDIO_DRIVER"
placeholder="pwm_hardware"
helperText={t(
'Audio driver (pwm_hardware, pwm_software, dac_basic, dac_additive)'
)}
/>
)}
/>
<SwitchField
label="AUDIO_VOICES"
checked={audioVoices}
onChange={setAudioVoices}
helperText={t(
'Enable multiple audio voices to play different sounds simultaneously'
)}
/>
<SwitchField
label="AUDIO_INIT_DELAY"
checked={audioInitDelay}
onChange={setAudioInitDelay}
helperText={t(
'Add a delay during audio initialization to avoid startup noise'
)}
/>
</Stack>
</div>
</Stack>
)}
</div>
</div>
</div>
Expand Down
Loading
Loading