menu "Example Configuration" choice LCD_TYPE prompt "LCD module type" default LCD_TYPE_AUTO help The type of LCD on the evaluation board. config LCD_TYPE_AUTO bool "Auto detect" config LCD_TYPE_ST7789V bool "ST7789V (WROVER Kit v2 or v3)" config LCD_TYPE_ILI9341 bool "ILI9341 (WROVER Kit v1 or DevKitJ v1)" endchoice config LCD_OVERCLOCK bool prompt "Run LCD at higher clock speed than allowed" default "n" help The ILI9341 and ST7789 specify that the maximum clock speed for the SPI interface is 10MHz. However, in practice the driver chips work fine with a higher clock rate, and using that gives a better framerate. Select this to try using the out-of-spec clock rate. menu "Wi-Fi Stability" config TQ_WIFI_STA_POWER_SAVE bool "Enable STA modem power save after connection" default n help Enable only for battery-first operation. TQ_cat keeps a realtime WebSocket/audio session open, so the default disables station modem sleep to reduce beacon timeout risk. config TQ_WIFI_STA_INACTIVE_TIME_SEC int "STA beacon inactive timeout (seconds)" default 15 range 3 60 help ESP-IDF disconnects the station when no beacon is received within this interval. The ESP-IDF default is 6 seconds; this firmware uses a longer timeout to tolerate brief beacon loss on crowded 2.4 GHz networks. endmenu menu "Runtime Diagnostics" config TQ_BOOT_SEQUENCE_DRY_RUN bool "Run Plan A boot sequence as event log only" default n help Use the Plan A startup order as a dry-run orchestration log. Only the event observer runtime is started. Business modules such as LCD, Wi-Fi, WebSocket, fortune, LAN HTTP, calibration, and boot audio are not actually triggered. config TQ_BOOT_SOUND_TIMEOUT_MS int "Boot sound timeout (ms)" default 3000 range 100 10000 help Maximum caller-visible time budget for the Plan A boot sound stage. The current prompt backend may return ESP_ERR_NOT_SUPPORTED before this timeout. config TQ_BOOT_SOUND_FILE string "Boot sound file" default "" help Optional boot sound file path for the voice prompt backend. Leave empty to use the semantic connecting prompt fallback. config TQ_NETWORK_TASK_CORE int "Network task core (-1 for no affinity)" default 0 range -1 1 help Core used for control-plane and platform network workers such as WebSocket wait, Wi-Fi state, LAN HTTP, and fortune refresh. config TQ_LOCAL_TASK_CORE int "Local task core (-1 for no affinity)" default 1 range -1 1 help Core used for local device workers such as LCD rendering, key input, system events, direction console, and diagnostics. config TQ_TASK_MONITOR_ENABLE bool "Enable periodic FreeRTOS task monitor log" default y help Periodically print a compact FreeRTOS task table to the log. config TQ_TASK_MONITOR_INTERVAL_MS int "Task monitor log interval (ms)" default 10000 range 1000 600000 depends on TQ_TASK_MONITOR_ENABLE help Interval for periodic task table logging. config TQ_TASK_MONITOR_MAX_TASKS int "Task monitor max task entries" default 64 range 16 128 depends on TQ_TASK_MONITOR_ENABLE help Maximum FreeRTOS task entries captured per report. config TQ_SYSTEM_EVENT_ENABLE bool "Enable control-plane system event task" default y help Start the staged system event dispatcher task. config TQ_SYSTEM_EVENT_QUEUE_LEN int "System event queue length" default 32 range 8 128 depends on TQ_SYSTEM_EVENT_ENABLE help Maximum number of queued control-plane system events. config TQ_SYSTEM_EVENT_TASK_STACK int "System event task stack size" default 4096 range 2048 8192 depends on TQ_SYSTEM_EVENT_ENABLE help Stack size in bytes for the control-plane system event task. menu "Remote Logging" config TQ_REMOTE_LOG_ENABLE bool "Enable remote log upload" default n help Capture ESP-IDF logs, persist them to the LittleFS-backed queue, and upload batches to the configured HTTPS server. config TQ_REMOTE_LOG_ENDPOINT string "Remote log endpoint URL" default "https://gz.api.talkingq.com/log/batch" depends on TQ_REMOTE_LOG_ENABLE config TQ_REMOTE_LOG_AUTH_TOKEN string "Remote log bearer token" default "" depends on TQ_REMOTE_LOG_ENABLE help Optional bearer token sent as Authorization: Bearer . Leave empty for unauthenticated test receivers. config TQ_REMOTE_LOG_MIN_LEVEL int "Minimum remote log level" default 2 range 0 4 depends on TQ_REMOTE_LOG_ENABLE help 0=NONE, 1=ERROR, 2=WARN, 3=INFO, 4=DEBUG. config TQ_REMOTE_LOG_PRESERVE_LOCAL_OUTPUT bool "Preserve existing local log output" default y depends on TQ_REMOTE_LOG_ENABLE help Keep the original ESP-IDF vprintf output while also enqueueing logs for server upload. config TQ_REMOTE_LOG_QUEUE_LEN int "Remote log memory queue length" default 128 range 16 512 depends on TQ_REMOTE_LOG_ENABLE config TQ_REMOTE_LOG_ENTRY_MAX_BYTES int "Remote log entry max bytes" default 256 range 128 1024 depends on TQ_REMOTE_LOG_ENABLE config TQ_REMOTE_LOG_BATCH_MAX_ENTRIES int "Remote log batch max entries" default 30 range 5 100 depends on TQ_REMOTE_LOG_ENABLE config TQ_REMOTE_LOG_FLUSH_INTERVAL_MS int "Remote log flush interval" default 5000 range 1000 60000 depends on TQ_REMOTE_LOG_ENABLE config TQ_REMOTE_LOG_UPLOAD_TIMEOUT_MS int "Remote log upload timeout" default 8000 range 3000 30000 depends on TQ_REMOTE_LOG_ENABLE config TQ_REMOTE_LOG_MAX_FILES int "Remote log persisted file count" default 32 range 4 128 depends on TQ_REMOTE_LOG_ENABLE config TQ_REMOTE_LOG_FILE_MAX_BYTES int "Remote log persisted file max bytes" default 16384 range 4096 65536 depends on TQ_REMOTE_LOG_ENABLE endmenu config TQ_KEY_INPUT_ENABLE bool "Enable interrupt-driven key input task" default y help Start the staged GPIO interrupt key input task for PTT and SW2. SW1 is reserved as the turntable limit switch and is not emitted as a normal key event. config TQ_KEY_INPUT_TASK_STACK int "Key input task stack size" default 4096 range 2048 8192 depends on TQ_KEY_INPUT_ENABLE help Stack size in bytes for the key input state-machine task. config TQ_KEY_IRQ_QUEUE_LEN int "Key GPIO interrupt queue length" default 16 range 4 64 depends on TQ_KEY_INPUT_ENABLE help Maximum number of queued raw GPIO-change events from ISR context. config TQ_KEY_INPUT_POLL_MS int "Key input timer poll interval (ms)" default 20 range 5 100 depends on TQ_KEY_INPUT_ENABLE help Maximum timer polling delay used for debounce, long press, and click decisions. config TQ_KEY_DEBOUNCE_INTERVAL_MS int "Key debounce interval (ms)" default 20 range 5 200 depends on TQ_KEY_INPUT_ENABLE help Stable-level interval required before a raw GPIO change becomes a key event. config TQ_KEY_LONG_PRESS_MS int "Key long-press threshold (ms)" default 800 range 100 5000 depends on TQ_KEY_INPUT_ENABLE help Press duration required before emitting a long-press-start event. config TQ_KEY_DOUBLE_CLICK_MS int "Key double-click threshold (ms)" default 450 range 100 1000 depends on TQ_KEY_INPUT_ENABLE help Maximum gap between short clicks before emitting a double-click event. config TQ_KEY_POST_DOUBLE_CLICK_SUPPRESS_MS int "Key post-double-click suppress interval (ms)" default 450 range 0 1000 depends on TQ_KEY_INPUT_ENABLE help Ignore raw GPIO chatter briefly after a double-click has been emitted. choice TQ_PTT_INTERACTION_MODE prompt "PTT interaction mode" default TQ_PTT_MODE_CLICK_TO_TALK depends on TQ_KEY_INPUT_ENABLE help Select how the PTT key controls multimodal speech input. config TQ_PTT_MODE_CLICK_TO_TALK bool "Click-to-talk" help A short press opens one bounded speech-input window. Double-click remains available for the PTT double-click expression and does not start speech input. config TQ_PTT_MODE_HOLD_TO_TALK bool "Hold-to-talk" help Preserve the original behavior: press and hold starts speech input, release stops speech input. endchoice config TQ_PTT_CLICK_CAPTURE_TIMEOUT_MS int "PTT click-to-talk capture timeout (ms)" default 8000 range 1000 60000 depends on TQ_KEY_INPUT_ENABLE && TQ_PTT_MODE_CLICK_TO_TALK help Maximum microphone capture window started by one PTT short press. When it expires, uplink capture is stopped and StopSpeech is sent. endmenu menu "TQ Screen" config TQ_SCREEN_ENABLE bool "Enable LCD screen runtime" default y help Disable when the connected display hardware does not match this firmware's LCD driver. config TQ_SCREEN_COLOR_ORDER_BGR bool "Use BGR color order" default n help Disabled means RGB color order. config TQ_SCREEN_INVERT_COLOR bool "Invert panel color" default y config TQ_SCREEN_SWAP_COLOR_BYTES bool "Swap RGB565 color bytes on bus" default y config TQ_SCREEN_BACKLIGHT_ACTIVE_HIGH bool "Backlight active high" default y config TQ_SCREEN_MIRROR_X bool "Mirror panel in X direction" default y config TQ_SCREEN_SWAP_XY bool "Swap panel X/Y axes" default y config TQ_SCREEN_X_GAP int "Panel X gap" default 0 range 0 320 config TQ_SCREEN_Y_GAP int "Panel Y gap" default 0 range 0 320 config TQ_SCREEN_RESET_PIN int "Panel reset GPIO (-1 to disable hardware reset)" default 17 range -1 48 help The 2026-07-24 board maps the ST7789P3 RES signal to IO17. Use -1 only when panel reset is physically not connected. config TQ_SCREEN_SPI_MISO_GPIO int "LCD SPI MISO GPIO (-1 to disable)" default -1 range -1 48 help LCD SPI MISO GPIO. Use -1 when the panel does not connect MISO. config TQ_SCREEN_SPI_MOSI_GPIO int "LCD SPI MOSI GPIO" default 18 range 0 48 help LCD SPI MOSI GPIO. config TQ_SCREEN_SPI_CLK_GPIO int "LCD SPI clock GPIO" default 8 range 0 48 help LCD SPI clock GPIO. config TQ_SCREEN_SPI_CS_GPIO int "LCD SPI CS GPIO" default 15 range 0 48 help LCD SPI chip-select GPIO. config TQ_SCREEN_DC_GPIO int "LCD D/C GPIO" default 16 range 0 48 help LCD data/command GPIO. config TQ_SCREEN_BACKLIGHT_GPIO int "LCD backlight GPIO" default 7 range 0 48 help LCD backlight control GPIO. config TQ_SCREEN_SPI_PIXEL_CLOCK_HZ int "LCD SPI pixel clock (Hz)" default 20000000 range 10000000 40000000 help SPI pixel clock for the ST7789 panel. Use 20000000 as the conservative production default; validate color stability and tearing on real hardware before trying 40000000. config TQ_SCREEN_COLOR_AUTOTEST bool "Enable color auto-test loop" default n help Periodically switches panel color-related parameters at runtime and logs active profile for manual color debugging. config TQ_SCREEN_COLOR_AUTOTEST_INTERVAL_MS int "Color auto-test switch interval (ms)" default 3000 range 500 60000 depends on TQ_SCREEN_COLOR_AUTOTEST help Interval for color profile switching in milliseconds. endmenu menu "TQ Slot Machine" config TQ_SLOT_SWITCH_GPIO int "Slot feature switch GPIO" default 13 range 0 48 help GPIO used for the slot machine feature switch. Default from docs/gpio-map.md (SW2 on IO13). config TQ_SLOT_SWITCH_ACTIVE_LEVEL int "Slot feature switch active level" default 0 range 0 1 help Logic level that means the slot machine feature switch is active. Default from docs/gpio-map.md (SW_2 is active-low). config TQ_SLOT_SWITCH_PULLUP bool "Enable slot feature switch pull-up" default y help Enable the internal pull-up for the default active-low slot switch wiring. config TQ_SLOT_SWITCH_PULLDOWN bool "Enable slot feature switch pull-down" default n help Leave disabled for the default active-low slot switch wiring. config TQ_SLOT_SWITCH_ENABLE bool "Enable slot feature switch worker" default y help Disable when the slot switch GPIO is unavailable or assigned to another board function. endmenu menu "TQ Calibration" config TQ_STEPPER_ENABLE bool "Enable turntable stepper driver" default y help Disable when the turntable stepper wiring is not present. config TQ_BOOT_TURNTABLE_CALIBRATION_ENABLE bool "Run turntable calibration at boot" default y help Run a bounded motor and KEY1/SW1 test before Wi-Fi bootstrap. The motor searches for the active-low switch and stops after the configured calibration sweep if the switch is not pressed. config TQ_STEPPER_IN1_GPIO int "Turntable stepper IN1 GPIO" default 45 range 0 48 help GPIO connected to the turntable stepper driver IN1 input. config TQ_STEPPER_IN2_GPIO int "Turntable stepper IN2 GPIO" default 48 range 0 48 help GPIO connected to the turntable stepper driver IN2 input. config TQ_STEPPER_IN3_GPIO int "Turntable stepper IN3 GPIO" default 47 range 0 48 help GPIO connected to the turntable stepper driver IN3 input. config TQ_STEPPER_IN4_GPIO int "Turntable stepper IN4 GPIO" default 21 range 0 48 help GPIO connected to the turntable stepper driver IN4 input. config TQ_CALIBRATION_SWITCH_GPIO int "Direction calibration switch GPIO" default 12 range 0 48 help GPIO used for the turntable direction calibration switch. config TQ_CALIBRATION_SWITCH_ACTIVE_LEVEL int "Direction calibration switch active level" default 0 range 0 1 help Logic level that means the calibration switch is active. config TQ_CALIBRATION_SWITCH_PULLUP bool "Enable direction calibration switch pull-up" default y help Enable the internal pull-up for the default active-low wiring. config TQ_CALIBRATION_SWITCH_PULLDOWN bool "Enable direction calibration switch pull-down" default n help Leave disabled for the default active-low wiring. endmenu menu "TQ Power" config TQ_POWER_HOLD_GPIO int "Power hold GPIO (-1 to disable)" default 9 range -1 48 help GPIO used to keep board power enabled after boot. The 2026-07-24 board maps the Power net to IO9. Set to -1 only when no external power-hold circuit is connected. config TQ_POWER_HOLD_ACTIVE_LEVEL int "Power hold active level" default 1 range 0 1 help Logic level that keeps the external power-hold circuit active. endmenu menu "Wi-Fi Provisioning" config MULTIMODAL_WIFI_SSID string "Seed Wi-Fi SSID" default "" help Optional seed SSID written to NVS when no saved credentials exist. config MULTIMODAL_WIFI_PASSWORD string "Seed Wi-Fi password" default "" help Password for the seed SSID. config MULTIMODAL_CONNECT_TIMEOUT_MS int "Wi-Fi connect timeout (ms)" default 10000 help Timeout for Wi-Fi STA connection attempts in milliseconds. config VOICE_PROMPT_WIFI_SUCCESS_FILE string "Wi-Fi success prompt file" default "" help Optional file path for the Wi-Fi connected semantic prompt. config VOICE_PROMPT_AFTER_WIFI_SUCCESS_FILE string "Post Wi-Fi success prompt file" default "" help Optional file path for the prompt played after Wi-Fi success. config VOICE_PROMPT_WIFI_CONNECTING_FILE string "Wi-Fi connecting prompt file" default "" help Optional file path for the Wi-Fi connecting semantic prompt. config VOICE_PROMPT_WIFI_FAILED_FILE string "Wi-Fi failed prompt file" default "" help Optional file path for the Wi-Fi failed semantic prompt. config VOICE_PROMPT_WIFI_CONFIG_FILE string "Wi-Fi config prompt file" default "" help Optional file path for the Wi-Fi configuration semantic prompt. config MULTIMODAL_DEVICE_ID string "Device ID (optional)" default "" help Optional device ID used by device-side services. config MULTIMODAL_SERIAL_NUMBER string "Serial number (optional)" default "" help Optional serial number used by device-side services. endmenu menu "Daily Fortune" config FORTUNE_ENABLE bool "Enable device-side daily fortune refresh" default y help Persist a provisioned birth profile, fetch the daily fortune after network/time synchronization, and refresh it at local midnight. config FORTUNE_API_URL string "Daily fortune API URL" depends on FORTUNE_ENABLE default "https://gz.api.talkingq.com/token/api/device/fortune/daily-wealth" help HTTPS endpoint used for the daily fortune POST request. config FORTUNE_TIMEZONE string "Fortune request time zone" depends on FORTUNE_ENABLE default "Asia/Shanghai" help IANA time-zone name sent to the fortune API. config FORTUNE_SNTP_SERVER string "SNTP server" depends on FORTUNE_ENABLE default "ntp.aliyun.com" help SNTP server used to establish wall-clock time before daily scheduling starts. config FORTUNE_CONNECT_TIMEOUT_MS int "Fortune HTTP timeout (ms)" depends on FORTUNE_ENABLE default 10000 range 1000 60000 help Connection and response timeout for one fortune HTTP request. config FORTUNE_USE_DEVICE_JWT bool "Attach cached device JWT to fortune requests" depends on FORTUNE_ENABLE && AUTH_V2_ENABLE default n help Add the cached device JWT as an Authorization Bearer token. Leave disabled while the fortune endpoint uses deviceId only. config FORTUNE_USER_CONFIG_HTTP_PORT int "LAN user configuration HTTP port" depends on FORTUNE_ENABLE default 80 range 1 65535 help TCP port for the device-hosted user profile and fortune page. config FORTUNE_USER_CONFIG_MDNS_HOSTNAME string "LAN user configuration mDNS hostname" depends on FORTUNE_ENABLE default "tq-cat" help Host label advertised through mDNS. The default page URL is http://tq-cat.local/. endmenu menu "WebSocket / Multimodal" config ENABLE_MULTIMODAL_INTERACTION bool "Enable multimodal interaction module" default y help Master switch for multimodal WebSocket interaction features. config MULTIMODAL_USE_STATIC_CREDENTIALS bool "Use static WebSocket credentials (skip token request)" default n help When enabled, multimodal auth uses the configured API key and workspace ID directly and does not request a temporary device token. config MULTIMODAL_AUTH_BYPASS_TOKEN_SERVICE bool "Bypass token service and force static credentials (debug)" default n help When enabled, token HTTP auth flow is bypassed at compile time. WebSocket auth uses API key/workspace/app fields directly. if MULTIMODAL_USE_STATIC_CREDENTIALS || MULTIMODAL_AUTH_BYPASS_TOKEN_SERVICE config MULTIMODAL_API_KEY string "WebSocket API key (Bearer token)" default "" help API key used as Authorization Bearer token for WebSocket connection. config MULTIMODAL_WORKSPACE_ID string "Workspace ID" default "" help Workspace identifier sent in Start directive payload. config MULTIMODAL_APP_ID string "App ID (required)" default "" help Required app ID sent in Start directive payload. config MULTIMODAL_VOICE_ID string "Voice ID (optional)" default "" help Optional voice ID for downstream TTS selection. endif config MULTIMODAL_DEVICE_TOKEN_URL string "Device token URL" default "https://gz.api.talkingq.com/token/api/device/token" help URL to request a temporary device token. Request body contains deviceId / serialNumber in JSON. config MULTIMODAL_WS_URI string "WebSocket URI" default "wss://dashscope.aliyuncs.com/api-ws/v1/inference" help WebSocket endpoint for multimodal inference. config AUTH_V2_ENABLE bool "Enable Auth V2 device-JWT challenge/response auth" default y help When enabled, the device proves possession of an on-board P-256 key via a challenge/response signature against AUTH_REGISTER_BASE_URL to mint a short-lived device JWT, which is then used as the Authorization Bearer when requesting the temporary multimodal token. Requires the device identity to be registered server-side. Leave disabled to use the static API key / bypass path. config AUTH_REGISTER_BASE_URL string "Auth V2 registration base URL" depends on AUTH_V2_ENABLE default "https://gz.api.talkingq.com/register" help HTTPS base URL of the device registration / challenge-response backend. The engine appends /api/auth/challenge, /api/auth/response and /api/auth/rotate to this base. config AUTH_CHALLENGE_PATH string "Auth challenge path" depends on AUTH_V2_ENABLE default "/api/auth/challenge" help Path appended to AUTH_REGISTER_BASE_URL for the challenge request. config AUTH_RESPONSE_PATH string "Auth response path" depends on AUTH_V2_ENABLE default "/api/auth/response" help Path appended to AUTH_REGISTER_BASE_URL for the response request. config AUTH_ROTATE_PATH string "Auth rotate path" depends on AUTH_V2_ENABLE default "/api/auth/rotate" help Path appended to AUTH_REGISTER_BASE_URL for the key-rotate request. config AUTH_HTTP_TIMEOUT_MS int "Auth HTTP timeout in milliseconds" depends on AUTH_V2_ENABLE default 8000 help Per-request timeout for device-auth HTTP calls. config AUTH_JWT_REFRESH_MARGIN_SEC int "Device JWT refresh margin in seconds" depends on AUTH_V2_ENABLE default 90 help Refresh the device JWT this many seconds before expiry. config AUTH_BACKOFF_BASE_MS int "Auth retry backoff base in milliseconds" depends on AUTH_V2_ENABLE default 500 help Base delay for exponential auth retry backoff. config AUTH_BACKOFF_CAP_MS int "Auth retry backoff cap in milliseconds" depends on AUTH_V2_ENABLE default 60000 help Maximum delay for auth retry backoff. config AUTH_BACKOFF_JITTER_MS int "Auth retry backoff jitter in milliseconds" depends on AUTH_V2_ENABLE default 200 help Random jitter added to each auth retry backoff. config MULTIMODAL_UPSTREAM_MODE string "Upstream mode for Start directive" default "push2talk" help Fixed to push2talk. Other upstream modes are intentionally not supported by this firmware runtime. config MULTIMODAL_PTT_BUTTON_GPIO int "Push-to-talk button GPIO" default 3 range 0 48 help GPIO used for the push-to-talk button. Default from docs/gpio-map.md (TTP223 touch output on IO3). config MULTIMODAL_PTT_BUTTON_ACTIVE_LEVEL int "Push-to-talk button active level" default 1 range 0 1 help Logic level that means the push-to-talk button is pressed. Default from docs/gpio-map.md (TTP223 output is active-high). config MULTIMODAL_PTT_BUTTON_PULLUP bool "Enable push-to-talk button pull-up" default n help The TTP223 provides a driven digital output, so no internal pull-up is required on the default board. config MULTIMODAL_PTT_BUTTON_PULLDOWN bool "Enable push-to-talk button pull-down" default n help The TTP223 provides a driven digital output, so no internal pull-down is required on the default board. config MULTIMODAL_HEARTBEAT_INTERVAL_MS int "Heartbeat interval (ms)" default 50000 range 1000 120000 help Interval for HeartBeat directive to keep session alive. config MULTIMODAL_NO_RESPONSE_TIMEOUT_MS int "No downstream response timeout (ms)" default 60000 range 1000 300000 help Timeout without downstream frames before Stop(NoResponseTimeout). config MULTIMODAL_DIALOG_IDLE_TIMEOUT_MS int "Dialog idle timeout (ms)" default 60000 range 1000 300000 help Reserved idle timeout for higher-level dialog policy. config MULTIMODAL_AUDIO_CHUNK_SIZE int "Upstream audio chunk size (bytes)" default 1920 range 256 8192 help Upstream raw PCM bytes per local Opus frame before encoding. For 16kHz/16-bit mono PCM with 60ms frames, use 1920 bytes. config MULTIMODAL_OPUS_FRAME_DURATION_MS int "Opus frame duration (ms)" default 60 range 60 60 help Fixed at 60 ms. The multimodal voice runtime uses 60 ms frames end-to-end for both upstream and downstream raw-opus. config MULTIMODAL_OPUS_BITRATE_KBPS int "Opus bitrate (kbps)" default 24 range 6 510 help raw-opus bit_rate field in Start downstream/upstream codec target. config MULTIMODAL_OPUS_COMPLEXITY int "Opus encoder complexity" default 0 range 0 10 help Lower values reduce CPU and memory pressure. config MULTIMODAL_OPUS_ENABLE_VBR bool "Enable Opus VBR" default n config MULTIMODAL_OPUS_ENABLE_DTX bool "Enable Opus DTX (uplink)" default n config MULTIMODAL_OPUS_ENABLE_FEC bool "Enable Opus FEC (uplink)" default n config MULTIMODAL_OPUS_DEC_SELF_DELIMITED bool "Enable self-delimited raw-opus decode" default n menu "Runtime ES8311 Audio Path" config MULTIMODAL_AUDIO_ENABLE_CODEC_PATH bool "Enable runtime ES8311 init/capture/playback" default y help Enable ES8311 codec initialization at runtime and bind microphone capture/downstream playback to multimodal WS. config MULTIMODAL_AUDIO_CODEC_SAMPLE_RATE int "Codec sample rate (Hz)" default 16000 range 16000 16000 help Fixed at 16000 Hz for mic capture, local Opus, Start upstream sample_rate, Start downstream sample_rate, and speaker playback. config MULTIMODAL_AUDIO_CODEC_CHANNELS int "Codec channels" default 1 range 1 1 help Fixed at 1 for the raw-opus 16kHz mono voice contract. config MULTIMODAL_AUDIO_CODEC_BITS_PER_SAMPLE int "Codec bits per sample" default 16 range 16 32 help PCM bit depth on codec I/O path. config MULTIMODAL_AUDIO_CHANNEL_PROBE_ON_INIT bool "Probe MIC/DAC-ref channel mapping during audio init" default n help Legacy diagnostic option. Current project uses a fixed ES8311 routing assumption: ch0 is microphone and ch1 is DAC playback reference. config MULTIMODAL_AUDIO_CHANNEL_PROBE_DURATION_MS int "Channel probe duration (ms)" default 800 range 200 3000 depends on MULTIMODAL_AUDIO_CHANNEL_PROBE_ON_INIT help Probe capture/playback duration used for MIC vs DAC-ref correlation scoring. config MULTIMODAL_AUDIO_OUT_VOLUME int "Codec output volume (0-100)" default 60 range 0 100 config MULTIMODAL_AUDIO_DOWNSTREAM_IDLE_MUTE_MS int "Downstream idle output mute delay (ms)" default 250 range 50 2000 help Delay after the last downstream audio write before muting the ES8311 output path. This keeps the PA control behavior unchanged while suppressing idle speaker noise. config MULTIMODAL_AUDIO_DOWNSTREAM_PLAYBACK_TASK_STACK int "Downstream playback task stack (bytes)" default 12288 range 8192 65536 help Stack size for the task that decodes downstream Opus and writes PCM to the codec. WebSocket binary workers only enqueue packets to this task. config MULTIMODAL_AUDIO_DOWNSTREAM_PLAYBACK_QUEUE_LEN int "Downstream playback queue length" default 1024 range 16 1024 help Queue depth between the WebSocket binary worker and the downstream audio playback task. The queue item itself is small and packet payloads are allocated PSRAM-first, so the default can absorb bursty TTS delivery while playback drains at realtime PCM speed. config MULTIMODAL_AUDIO_DOWNSTREAM_PLAYBACK_MAX_PACKET_BYTES int "Downstream playback max Opus packet bytes" default 2048 range 256 8192 help Max raw Opus packet size accepted by the downstream playback queue. config MULTIMODAL_AUDIO_IN_GAIN_DB int "Codec input gain (dB)" default 30 range 0 42 config MULTIMODAL_AUDIO_MIC_CHANNEL int "Microphone capture channel" default 0 range 0 1 help Interleaved ES8311 input channel that carries microphone speech. Use 0 for the default left/first channel, or 1 if level logs show speech energy on raw_ch1 instead of raw_ch0. config MULTIMODAL_AUDIO_LOG_UPLINK_LEVELS bool "Log microphone uplink audio levels" default n help Log low-rate raw capture and uplink level statistics while microphone uplink is active. This is useful for diagnosing NoSpeechRecognized errors, muted capture, and swapped channels. config MULTIMODAL_AUDIO_UPLINK_TASK_STACK int "Mic uplink task stack (bytes)" default 32768 range 16384 65536 help Stack size for microphone capture/upload task. config MULTIMODAL_AUDIO_UPLINK_SEND_TASK_STACK int "Mic uplink send task stack (bytes)" default 12288 range 8192 65536 help Stack size for uplink send task that forwards Opus packets to WebSocket transport. config MULTIMODAL_AUDIO_UPLINK_SEND_QUEUE_LEN int "Mic uplink send queue length" default 24 range 2 48 help Queue depth between capture/encode and WebSocket send task. config MULTIMODAL_AUDIO_UPLINK_SEND_TIMEOUT_MS int "Mic uplink queue send timeout (ms)" default 5 range 0 20 help Max time the capture task may block when the uplink queue is full before it drops or replaces old packets. Lower values keep microphone DMA service responsive under network stalls and reduce end-to-end latency build-up. config MULTIMODAL_AUDIO_UPLINK_MAX_PACKET_BYTES int "Mic uplink max Opus packet bytes" default 1024 range 160 2048 help Max encoded 60 ms raw-opus packet size accepted by send queue. config MULTIMODAL_AUDIO_INIT_RETRY_COUNT int "Audio init retry count per trigger" default 1 range 1 5 help Keep this low under memory pressure to avoid fragmentation. config MULTIMODAL_AUDIO_PREWARM_OPUS_BEFORE_WS bool "Prewarm Opus runtime before WebSocket connect" default y help Initializes Opus encoder/decoder before TLS/WebSocket tasks allocate fragmented heap blocks, reducing `esp_opus_enc_open` alloc failures. config MULTIMODAL_AUDIO_INIT_MIN_LARGEST_DMA int "Skip audio init if largest DMA block below (bytes)" default 4096 range 0 65536 help Set 0 to disable this guard. config MULTIMODAL_AUDIO_INIT_MIN_LARGEST_INTERNAL int "Skip audio init if largest internal block below (bytes)" default 6144 range 0 65536 help Set 0 to disable this guard. config MULTIMODAL_AUDIO_I2C_PORT int "I2C port for ES8311 control" range 0 1 default 0 config MULTIMODAL_AUDIO_I2C_SCL_GPIO int "I2C SCL GPIO" default 2 help Default from docs/gpio-map.md (ES8311 control SCL on GPIO2). config MULTIMODAL_AUDIO_I2C_SDA_GPIO int "I2C SDA GPIO" default 1 help Default from docs/gpio-map.md (ES8311 control SDA on GPIO1). config MULTIMODAL_AUDIO_I2C_ADDR hex "ES8311 I2C address" default 0x18 help Accepts either 7-bit (0x18) or 8-bit (0x30) address formats. config MULTIMODAL_AUDIO_I2S_PORT int "I2S port for ES8311 data" range 0 1 default 0 config MULTIMODAL_AUDIO_I2S_MCLK_GPIO int "I2S MCLK GPIO" default 38 help Default from docs/gpio-map.md (I2S_MCLK on GPIO38). config MULTIMODAL_AUDIO_I2S_BCLK_GPIO int "I2S BCLK GPIO" default 39 help Default from docs/gpio-map.md (I2S_SCLK on GPIO39). config MULTIMODAL_AUDIO_I2S_WS_GPIO int "I2S WS GPIO" default 41 help Default from docs/gpio-map.md (I2S_LRCK on GPIO41). config MULTIMODAL_AUDIO_I2S_DOUT_GPIO int "I2S DOUT GPIO" default 40 help Default from docs/gpio-map.md (MCU output to ES8311 DSDIN on GPIO40). config MULTIMODAL_AUDIO_I2S_DIN_GPIO int "I2S DIN GPIO" default 42 help Default from docs/gpio-map.md (MCU input from ES8311 ASDOUT on GPIO42). config MULTIMODAL_AUDIO_USE_MCLK bool "Use external MCLK" default y config MULTIMODAL_AUDIO_PA_GPIO int "PA enable GPIO (-1 to disable)" default 11 help Default from docs/gpio-map.md (PA_CTRL on IO11). config MULTIMODAL_AUDIO_I2S_DMA_DESC_NUM int "I2S DMA descriptor count" default 4 range 2 8 help Number of DMA descriptors per I2S direction. For the default 16 kHz / 16-bit / stereo voice path, 4 descriptors with 160 frames each provide about 40 ms of buffering, which is a good compromise between Wi-Fi jitter tolerance and RAM usage. config MULTIMODAL_AUDIO_I2S_DMA_FRAME_NUM int "I2S DMA frames per descriptor" default 160 range 24 240 help Frames stored in each DMA descriptor. With the default 16 kHz / stereo / 16-bit format, 160 frames is about 10 ms per descriptor, which keeps I2S interrupt cadence moderate while remaining responsive for voice capture. config MULTIMODAL_AUDIO_TASK_CORE int "Pin audio tasks to CPU core (-1 = no affinity)" default 1 range -1 1 help Pin audio capture, encode, decode and playback tasks to a specific CPU core. On ESP32-S3, core 0 runs the WiFi/BT protocol stack by default. Pinning audio to core 1 avoids interference from network processing. -1 = no affinity (scheduler decides) 0 = Core 0 (PRO_CPU) 1 = Core 1 (APP_CPU) menu "Audio Debug Dump (UDP)" depends on MULTIMODAL_AUDIO_ENABLE_CODEC_PATH config MULTIMODAL_AUDIO_DEBUG_DUMP bool "Enable audio debug dump over UDP" default n help Stream microphone mono PCM and/or encoded Opus packets over UDP to a PC for offline analysis. Disabled by default; enable only for debugging. config MULTIMODAL_AUDIO_DEBUG_DUMP_TARGET_IP string "Target PC IP address" default "192.168.1.100" depends on MULTIMODAL_AUDIO_DEBUG_DUMP help IPv4 address of the PC receiving audio streams. config MULTIMODAL_AUDIO_DEBUG_DUMP_PCM_PORT int "UDP port for microphone mono PCM" default 7200 range 1024 65535 depends on MULTIMODAL_AUDIO_DEBUG_DUMP help Port on which the PC listens for raw s16le PCM at 16kHz mono (~32 KB/s). config MULTIMODAL_AUDIO_DEBUG_DUMP_OPUS_ENABLE bool "Also stream encoded Opus packets" default n depends on MULTIMODAL_AUDIO_DEBUG_DUMP help Additionally stream each Opus packet to a separate UDP port for protocol-level debugging. config MULTIMODAL_AUDIO_DEBUG_DUMP_OPUS_PORT int "UDP port for Opus packets" default 7201 range 1024 65535 depends on MULTIMODAL_AUDIO_DEBUG_DUMP_OPUS_ENABLE help Port on which the PC listens for raw Opus frames. endmenu endmenu config MULTIMODAL_TTS_VOICE string "Default downstream TTS voice" default "" help Used when token/static credential does not provide voice ID. config MULTIMODAL_TTS_SPEECH_RATE int "Downstream TTS speech rate" default 110 range 50 200 help Speech rate percentage used in Start downstream parameters. config MULTIMODAL_DOWNSTREAM_INTERMEDIATE_TEXT string "Downstream intermediate text streams" default "transcript,dialog" help Comma-separated intermediate_text value sent in Start downstream parameters. The DashScope default is transcript only; include dialog so RespondingContent carries assistant response text and command metadata. config MULTIMODAL_DOWNSTREAM_RATE_LIMIT int "Downstream transmit rate limit (bytes/s)" default 3000 range 0 200000 help Optional downstream raw-opus transmit rate limit. The runtime clamps non-zero values to the configured Opus bitrate budget, and treats 0 as the same bitrate budget instead of omitting the field, so server delivery stays close to realtime playback and does not arrive as large TTS bursts followed by long gaps. config MULTIMODAL_DOWNSTREAM_INCREMENTAL_RESPONSE bool "Enable downstream incremental response" default n help Request incremental model text chunks in the Start downstream parameters. Audio downlink is still streamed through binary WebSocket frames when this is disabled. config MULTIMODAL_WEBSOCKET_TASK_STACK_BYTES int "WebSocket task stack (bytes)" default 32768 help Stack size for the esp_websocket_client task. config MULTIMODAL_WEBSOCKET_TASK_PRIORITY int "WebSocket task priority" default 8 range 5 12 help Priority for the esp_websocket_client RX/TX task. Keep this above local audio playback workers so downstream frames are received even while PCM is being written to the codec. config MULTIMODAL_WS_BUFFER_SIZE int "WebSocket transport buffer size (bytes)" default 2048 range 1024 8192 help Rx/Tx buffer size used by esp_websocket_client. Larger value reduces frame fragmentation at the cost of extra RAM. config MULTIMODAL_WS_PING_INTERVAL_SEC int "WebSocket transport ping interval (seconds)" default 20 range 5 120 help Interval for websocket ping/pong keepalive on transport layer. This is independent from application HeartBeat directives. config MULTIMODAL_WS_PINGPONG_TIMEOUT_SEC int "WebSocket pong timeout (seconds)" default 120 range 30 600 help Disconnect transport if no pong is received within this period. config MULTIMODAL_WS_ENABLE_TCP_KEEPALIVE bool "Enable WebSocket TCP keepalive" default y help Enable TCP keepalive probes on the websocket socket. config MULTIMODAL_WS_TCP_KEEPALIVE_IDLE_SEC int "TCP keepalive idle time (seconds)" default 30 range 5 600 depends on MULTIMODAL_WS_ENABLE_TCP_KEEPALIVE config MULTIMODAL_WS_TCP_KEEPALIVE_INTERVAL_SEC int "TCP keepalive interval (seconds)" default 10 range 1 120 depends on MULTIMODAL_WS_ENABLE_TCP_KEEPALIVE config MULTIMODAL_WS_TCP_KEEPALIVE_COUNT int "TCP keepalive retry count" default 3 range 1 10 depends on MULTIMODAL_WS_ENABLE_TCP_KEEPALIVE config MULTIMODAL_WS_REALTIME_LOCK_WAIT_MS int "Realtime audio send lock wait (ms)" default 80 range 1 1000 help Max wait to acquire websocket send lock for realtime uplink. config MULTIMODAL_WS_REALTIME_SEND_TIMEOUT_MS int "Realtime audio websocket send timeout (ms)" default 300 range 50 5000 help Send timeout for each realtime binary uplink packet. config MULTIMODAL_WS_DISPATCH_TASK_STACK_BYTES int "WS ordered dispatch task stack (bytes)" default 4096 range 4096 65536 help Legacy minimum stack size for the ordered WS dispatch task. The runtime uses the largest of dispatch, JSON, and Opus stack settings because text events and binary audio frames share one worker to preserve wire order. config MULTIMODAL_WS_JSON_TASK_STACK_BYTES int "WS JSON processing stack floor (bytes)" default 8192 range 8192 65536 help Stack floor for JSON event parsing/reassembly inside the ordered WS worker. config MULTIMODAL_WS_OPUS_TASK_STACK_BYTES int "WS binary processing stack floor (bytes)" default 12288 range 12288 65536 help Stack floor for downstream binary raw-opus frame dispatch inside the ordered WS worker. Local Opus decode/playback is handled by the audio playback task. config MULTIMODAL_WS_MSG_QUEUE_LEN int "WS ingress queue length" default 512 range 16 512 help Queue depth for the ordered WS frame ingress. Text and binary frames share this queue so protocol events and downstream audio are dispatched in wire order. config MULTIMODAL_RECONNECT_DELAY_MS int "WebSocket reconnect delay (ms)" default 2000 help Delay between reconnect attempts if auto-reconnect is enabled. endmenu endmenu