menu "TQ Cat Configuration" menu "Legacy LCD Driver Options" 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. endmenu 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. config TQ_TIME_SNTP_SERVER string "Wall-clock SNTP server" default "ntp.aliyun.com" help SNTP server used to establish wall-clock time after Wi-Fi obtains an IP address. config TQ_TIME_POSIX_TZ string "Wall-clock POSIX time zone" default "CST-8" help POSIX TZ string used for local wall-clock display and daily scheduling. For China Standard Time use "CST-8". endmenu menu "OTA Firmware Update" config TQ_OTA_ENABLE bool "Enable managed OTA firmware updates" default y depends on AUTH_V2_ENABLE select BOOTLOADER_APP_ROLLBACK_ENABLE config TQ_OTA_REPORT_URL string "OTA version report URL" default "https://gz.api.talkingq.com/ota/api/ota/versionInfoReport" depends on TQ_OTA_ENABLE config TQ_OTA_INTERNAL_AUTH_SECRET string "OTA internal-auth compatibility secret" default "" depends on TQ_OTA_ENABLE config TQ_OTA_POLL_INTERVAL_MS int "Normal OTA poll interval (ms)" default 21600000 range 10000 86400000 depends on TQ_OTA_ENABLE config TQ_OTA_CONFIRMATION_POLL_MS int "OTA confirmation recheck interval (ms)" default 21600000 range 2000 86400000 depends on TQ_OTA_ENABLE config TQ_OTA_HTTP_TIMEOUT_MS int "OTA report HTTP timeout (ms)" default 15000 range 1000 60000 depends on TQ_OTA_ENABLE config TQ_OTA_INSTALL_TIMEOUT_MS int "OTA download/install deadline (ms)" default 600000 range 30000 1800000 depends on TQ_OTA_ENABLE config TQ_OTA_RETRY_BASE_MS int "OTA retry backoff base (ms)" default 21600000 range 1000 86400000 depends on TQ_OTA_ENABLE config TQ_OTA_RETRY_MAX_MS int "OTA retry backoff cap (ms)" default 21600000 range 10000 86400000 depends on TQ_OTA_ENABLE config TQ_OTA_TASK_STACK_BYTES int "OTA worker stack (bytes)" default 16384 range 8192 32768 depends on TQ_OTA_ENABLE config TQ_OTA_MIN_FREE_INTERNAL_BYTES int "OTA HTTPS minimum free internal memory (bytes)" default 32768 range 16384 131072 depends on TQ_OTA_ENABLE config TQ_OTA_MIN_LARGEST_DMA_BYTES int "OTA HTTPS minimum largest DMA block (bytes)" default 4096 range 2048 32768 depends on TQ_OTA_ENABLE config TQ_OTA_MIN_BATTERY_PERCENT int "Minimum battery percentage to start OTA" default 20 range 0 100 depends on TQ_OTA_ENABLE && TQ_BATTERY_ENABLE help Defer an approved OTA update while the latest valid battery percentage is below this threshold. Forced updates do not bypass this safety gate. Once installation starts, percentage changes do not cancel the in-progress update. config TQ_OTA_POWER_RETRY_MS int "OTA low-battery recheck interval (ms)" default 60000 range 10000 3600000 depends on TQ_OTA_ENABLE && TQ_BATTERY_ENABLE help Delay before reporting the version again after an approved OTA update is deferred because battery status is low, unavailable, or stale. A fresh report also refreshes expiring download URLs. endmenu menu "Mini Program Wi-Fi Provisioning" config TQ_MINI_PROGRAM_PROVISIONING_ENABLE bool "Enable mini-program BLE-assisted Wi-Fi provisioning" depends on BT_NIMBLE_ENABLED default y help Advertise the fixed TalkingQ GATT service when no usable Wi-Fi credentials exist. No SoftAP fallback is started. config TQ_MINI_PROGRAM_PROVISIONING_CONNECT_TIMEOUT_MS int "Provisioning Wi-Fi connection timeout (ms)" depends on TQ_MINI_PROGRAM_PROVISIONING_ENABLE default 30000 range 5000 120000 config TQ_MINI_PROGRAM_PROVISIONING_RECONNECT_FAILURES int "Runtime reconnect failures before BLE reprovisioning" depends on TQ_MINI_PROGRAM_PROVISIONING_ENABLE default 2 range 1 10 config TQ_MINI_PROGRAM_PROVISIONING_MIN_FREE_INTERNAL_BYTES int "Minimum free internal memory before BLE provisioning" depends on TQ_MINI_PROGRAM_PROVISIONING_ENABLE default 49152 range 16384 131072 help BLE controller initialization requires internal DMA-capable memory even when the NimBLE host uses external RAM. Runtime reprovisioning performs a controlled recovery boot when free internal memory remains below this threshold after teardown. config TQ_MINI_PROGRAM_PROVISIONING_MIN_LARGEST_DMA_BYTES int "Minimum largest DMA block before BLE provisioning" depends on TQ_MINI_PROGRAM_PROVISIONING_ENABLE default 12288 range 4096 65536 help Minimum contiguous DMA-capable block required before entering the BLE controller. This headroom prevents the controller ROM from asserting after a late allocation failure. 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 Run a low-impact task monitor with a PSRAM-preferred worker stack and PSRAM-only snapshots. Periodic summaries report the lowest stack headroom; a full task table is emitted less often. config TQ_TASK_MONITOR_INTERVAL_MS int "Task monitor log interval (ms)" default 30000 range 1000 600000 depends on TQ_TASK_MONITOR_ENABLE help Interval for task summaries. The complete table is emitted on the first sample and every five samples after that. 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_MEMORY_MONITOR_ENABLE bool "Enable runtime heap watermark monitor" default y help Track internal RAM, DMA-capable RAM, and PSRAM watermarks. Allocation failures and low contiguous DMA memory are logged together with the current voice-session state. config TQ_MEMORY_MONITOR_SAMPLE_INTERVAL_MS int "Memory monitor sample interval (ms)" default 1000 range 100 60000 depends on TQ_MEMORY_MONITOR_ENABLE help Sampling interval for heap watermarks. Periodic reports are emitted less frequently to avoid flooding the log. config TQ_MEMORY_MONITOR_REPORT_INTERVAL_MS int "Memory monitor periodic report interval (ms)" default 30000 range 5000 600000 depends on TQ_MEMORY_MONITOR_ENABLE help Interval for normal heap watermark reports. Pressure changes and allocation failures are reported immediately. config TQ_MEMORY_MONITOR_INTERNAL_WARN_BYTES int "Internal RAM warning threshold (bytes)" default 16384 range 4096 262144 depends on TQ_MEMORY_MONITOR_ENABLE help Emit a pressure warning when free 8-bit internal RAM falls below this value. config TQ_MEMORY_MONITOR_DMA_LARGEST_WARN_BYTES int "Largest DMA block warning threshold (bytes)" default 4096 range 1024 65536 depends on TQ_MEMORY_MONITOR_ENABLE help Emit a pressure warning when the largest contiguous DMA-capable allocation falls below this value. config TQ_NETWORK_DIAGNOSTICS_ENABLE bool "Enable detailed network diagnostics" default y help Collect detailed DNS, Wi-Fi, heap, ping, and cached-endpoint TCP probe data when HTTPS name resolution fails. The probes can add up to roughly two seconds to a failed DNS attempt, so disable this option for production builds after diagnosis. config TQ_MULTIMODAL_DIAGNOSTICS_ENABLE bool "Enable detailed multimodal session diagnostics" default y help Log multimodal session generations, transport cleanup stages, and network failure streaks. Functional recovery warnings remain visible when disabled. config TQ_NETWORK_AUTO_REASSOCIATION_ENABLE bool "Enable automatic Wi-Fi reassociation after HTTPS failures" default y help After the first multimodal HTTPS connection failure, disconnect and reconnect the Wi-Fi station before retrying. This interrupts all device network traffic while reassociation is in progress. Field testing confirmed that this recovers a stale STA data path which remains associated but cannot reach DNS, the gateway, or a cached HTTPS endpoint. 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 6144 range 2048 8192 depends on TQ_SYSTEM_EVENT_ENABLE help Stack size in bytes for the control-plane system event task. endmenu menu "Power Saving & Light Standby" config TQ_LIGHT_STANDBY_ENABLE bool "Enable light-standby state coordinator" default y help Track a single device-wide inactivity deadline and expose ACTIVE, ENTERING, STANDBY, and WAKING states. Hardware power actions are attached to these transitions separately. config TQ_LIGHT_STANDBY_IDLE_TIMEOUT_MS int "Light-standby inactivity timeout (ms)" default 300000 range 1000 3600000 depends on TQ_LIGHT_STANDBY_ENABLE help Time without key, local-wake, or voice interaction before entering light standby. The production default is 5 minutes. config TQ_LIGHT_STANDBY_DIM_BACKLIGHT bool "Dim LCD backlight in light standby" default y depends on TQ_LIGHT_STANDBY_ENABLE && TQ_SCREEN_ENABLE config TQ_LIGHT_STANDBY_BACKLIGHT_PERCENT int "Light-standby backlight brightness (percent)" default 10 range 1 100 depends on TQ_LIGHT_STANDBY_DIM_BACKLIGHT help Backlight brightness while the LCD render loop continues. The minimum remains visible so the base expression persists. config TQ_LIGHT_STANDBY_PROMPT_ENABLE bool "Play a prompt before entering light standby" default y depends on TQ_LIGHT_STANDBY_ENABLE help Play the configured prompt to completion before applying standby policies such as disabling the speaker amplifier. config TQ_LIGHT_STANDBY_PROMPT_FILE string "Light-standby entry prompt file" default "standby_5min.opus" depends on TQ_LIGHT_STANDBY_PROMPT_ENABLE help Prompt file in the LittleFS audio_prompts directory. config TQ_LIGHT_STANDBY_DISABLE_SPEAKER_OUTPUT bool "Disable speaker output in light standby" default y depends on TQ_LIGHT_STANDBY_ENABLE help Mute codec output and disable the speaker power amplifier while preserving microphone capture for local wake words. config TQ_LIGHT_STANDBY_RELEASE_MOTOR_HOLD bool "Release stepper holding current in light standby" default y depends on TQ_LIGHT_STANDBY_ENABLE help De-energize the stepper coils. A later movement automatically restores motor drive before stepping. config TQ_LIGHT_STANDBY_WIFI_POWER_SAVE bool "Enable Wi-Fi modem power save in light standby" default y depends on TQ_LIGHT_STANDBY_ENABLE help Keep the STA and WebSocket connected while enabling minimum modem sleep. Active mode restores the configured Wi-Fi policy. config TQ_LIGHT_STANDBY_BATTERY_INTERVAL_SEC int "Battery standby sample interval (seconds)" default 300 range 30 3600 depends on TQ_LIGHT_STANDBY_ENABLE && TQ_BATTERY_ENABLE help Charge-state GPIO edges still request an immediate sample. config TQ_LIGHT_STANDBY_MEMORY_SAMPLE_INTERVAL_MS int "Memory monitor standby sample interval (ms)" default 10000 range 1000 600000 depends on TQ_LIGHT_STANDBY_ENABLE && TQ_MEMORY_MONITOR_ENABLE config TQ_LIGHT_STANDBY_MEMORY_REPORT_INTERVAL_MS int "Memory monitor standby report interval (ms)" default 300000 range 10000 3600000 depends on TQ_LIGHT_STANDBY_ENABLE && TQ_MEMORY_MONITOR_ENABLE config TQ_LIGHT_STANDBY_TASK_STACK_BYTES int "Light-standby task stack size (bytes)" default 4096 range 2048 8192 depends on TQ_LIGHT_STANDBY_ENABLE config TQ_LIGHT_STANDBY_TASK_PRIORITY int "Light-standby task priority" default 3 range 1 10 depends on TQ_LIGHT_STANDBY_ENABLE endmenu menu "Buttons & Input" 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, SW1, SW2, and the optional Wi-Fi reset button. SW1 remains the turntable calibration input and is also reported for post-boot button diagnostics. 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. config TQ_RESET_BUTTON_ENABLE bool "Enable Wi-Fi reset button" default n depends on TQ_KEY_INPUT_ENABLE help Enable a dedicated reset button. Holding the button for the configured duration clears saved Wi-Fi credentials and then restarts the device. Other persisted data is not changed. config TQ_RESET_BUTTON_GPIO int "Wi-Fi reset button GPIO" default 14 range 0 48 depends on TQ_RESET_BUTTON_ENABLE help GPIO used for the dedicated Wi-Fi reset button when enabled. GPIO14 is unassigned on the current board revision. config TQ_RESET_BUTTON_ACTIVE_LEVEL int "Wi-Fi reset button active level" default 0 range 0 1 depends on TQ_RESET_BUTTON_ENABLE help Logic level that means the Wi-Fi reset button is pressed. config TQ_RESET_BUTTON_PULLUP bool "Enable Wi-Fi reset button pull-up" default y depends on TQ_RESET_BUTTON_ENABLE help Enable the internal pull-up for active-low wiring. config TQ_RESET_BUTTON_PULLDOWN bool "Enable Wi-Fi reset button pull-down" default n depends on TQ_RESET_BUTTON_ENABLE help Enable the internal pull-down for active-high wiring. config TQ_RESET_BUTTON_LONG_PRESS_MS int "Wi-Fi reset button hold duration (ms)" default 5000 range 1000 15000 depends on TQ_RESET_BUTTON_ENABLE help Continuous press duration required before saved Wi-Fi credentials are cleared and the device restarts. 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 "Display & 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_LCD_RENDER_TASK_STACK_BYTES int "LCD render task stack (bytes)" default 8192 range 8192 16384 depends on TQ_SCREEN_ENABLE help Stack size in bytes for the control-plane LCD render worker. 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_BACKLIGHT_BRIGHTNESS_PERCENT int "Default backlight brightness (percent)" default 100 range 0 100 depends on TQ_SCREEN_ENABLE help Initial LCD backlight PWM duty after screen initialization. Set 0 to turn the backlight off or 100 for full brightness. 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 "Slot Machine" config TQ_SLOT_SWITCH_GPIO int "Slot feature switch GPIO" default 13 range 0 48 help GPIO used by the input that triggers the slot machine feature. 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. 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 "Motor & 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 Button 1 on the SW1/IO12 net and for turntable direction calibration. 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 "Power & Battery" config TQ_POWER_HOLD_GPIO int "Power hold GPIO (-1 to disable)" default -1 range -1 48 help GPIO used to keep board power enabled after boot. The current battery-sensing board uses IO9 as an ADC input and therefore disables the legacy power-hold output by default. 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. config TQ_BATTERY_ENABLE bool "Enable battery monitoring" default y config TQ_BATTERY_ADC_GPIO int "Battery voltage ADC GPIO" default 9 range 0 48 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_CHARGE_GPIO int "TP4057 charge status GPIO (-1 to disable)" default 10 range -1 48 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_CHARGE_ACTIVE_LEVEL int "TP4057 charging active level" default 0 range 0 1 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_FULL_MIN_VOLTAGE_MV int "Minimum voltage for charge-complete prompt (mV)" default 4150 range 4000 4200 depends on TQ_BATTERY_ENABLE help The TP4057 status pin cannot distinguish charge termination from charger removal. Require at least this filtered battery voltage before inferring that charging has completed. config TQ_BATTERY_FULL_MIN_PERCENT int "Minimum level for charge-complete prompt (percent)" default 95 range 90 100 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_FULL_CONFIRM_SEC int "Charge-complete stable confirmation time (seconds)" default 30 range 5 300 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_DIVIDER_HIGH_OHM int "Battery divider resistance from VBAT to ADC (ohm)" default 100000 range 1 10000000 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_DIVIDER_LOW_OHM int "Battery divider resistance from ADC to ground (ohm)" default 100000 range 1 10000000 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_CALIBRATION_GAIN_PPM int "Board battery voltage calibration gain (ppm)" default 1000000 range 800000 1200000 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_CALIBRATION_OFFSET_MV int "Board battery voltage calibration offset (mV)" default 0 range -500 500 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_SAMPLE_INTERVAL_SEC int "Battery monitoring interval (seconds)" default 10 range 1 3600 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_LOAD_COOLDOWN_SEC int "Battery sampling cooldown after high load (seconds)" default 5 range 0 60 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_LOW_ENTER_PERCENT int "Low battery entry threshold (percent)" default 20 range 1 99 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_LOW_EXIT_PERCENT int "Low battery recovery threshold (percent)" default 25 range 1 100 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_CRITICAL_ENTER_PERCENT int "Critical battery entry threshold (percent)" default 5 range 0 99 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_CRITICAL_EXIT_PERCENT int "Critical battery recovery threshold (percent)" default 10 range 1 100 depends on TQ_BATTERY_ENABLE config TQ_BATTERY_CONTROLLED_SHUTDOWN_ENABLE bool "Enable controlled shutdown at critically low battery" default y depends on TQ_BATTERY_ENABLE config TQ_BATTERY_SHUTDOWN_VOLTAGE_MV int "Controlled shutdown voltage threshold (mV)" default 3450 range 3000 4200 depends on TQ_BATTERY_CONTROLLED_SHUTDOWN_ENABLE config TQ_BATTERY_EMERGENCY_VOLTAGE_MV int "Emergency shutdown voltage threshold (mV)" default 3350 range 3000 4200 depends on TQ_BATTERY_CONTROLLED_SHUTDOWN_ENABLE config TQ_BATTERY_WAKE_RECOVERY_VOLTAGE_MV int "Minimum voltage after deep-sleep wake (mV)" default 3550 range 3000 4200 depends on TQ_BATTERY_CONTROLLED_SHUTDOWN_ENABLE config TQ_BATTERY_SHUTDOWN_WAKE_BUTTON_GPIO int "Optional active-low deep-sleep wake button GPIO (-1 to disable)" default -1 range -1 48 depends on TQ_BATTERY_CONTROLLED_SHUTDOWN_ENABLE config TQ_BATTERY_SHUTDOWN_PROMPT_FILE string "Critical-battery shutdown prompt file" default "/littlefs/audio_prompts/shutdown_power_empty.opus" depends on TQ_BATTERY_CONTROLLED_SHUTDOWN_ENABLE endmenu menu "Network Identity & 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 "Cloud transport connect timeout (ms)" default 10000 help Timeout for multimodal HTTP and WebSocket connection attempts. config TQ_WIFI_CONNECT_CYCLE_TIMEOUT_MS int "Wi-Fi candidate connection cycle timeout (ms)" default 20000 range 5000 120000 help Total time allowed for one scan and connection cycle across visible saved Wi-Fi candidates. Failed cycles continue through the runtime reconnect backoff policy. 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 & User Configuration" 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_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 "Voice, Authentication & Multimodal" config ENABLE_MULTIMODAL_INTERACTION bool "Enable multimodal interaction module" default y help Master switch for multimodal WebSocket interaction features. config TQ_MULTIMODAL_WATCHDOG_TASK_STACK_BYTES int "Multimodal watchdog task stack (bytes)" default 6144 range 4096 12288 depends on ENABLE_MULTIMODAL_INTERACTION help Stack size in bytes for the multimodal session watchdog task. menu "Credentials & Device Authentication" 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 TQ_FACTORY_CLI_ENABLE bool "Enable serial factory provisioning CLI" depends on AUTH_V2_ENABLE default y help Start the managed serial worker used by the factory tool for device identity provisioning, public-key retrieval, and on-device challenge signing. config TQ_FACTORY_CLI_TASK_STACK_BYTES int "Factory CLI task stack (bytes)" default 7168 range 7168 16384 depends on TQ_FACTORY_CLI_ENABLE help Stack size in bytes for the serial factory provisioning worker. 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. endmenu menu "Interaction & Local Wake" 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. config MULTIMODAL_PTT_BUTTON_ACTIVE_LEVEL int "Push-to-talk button active level" default 0 range 0 1 help Logic level that means the push-to-talk button is pressed. config MULTIMODAL_PTT_BUTTON_PULLUP bool "Enable push-to-talk button pull-up" default y help Enable the internal pull-up when required by the button wiring. config MULTIMODAL_PTT_BUTTON_PULLDOWN bool "Enable push-to-talk button pull-down" default n help Enable the internal pull-down when required by the button wiring. config TQ_LOCAL_WAKE_ENABLE bool "Enable local wake-word listener" default y help Use the on-device Chinese MultiNet model to detect 喵掌柜. The physical PTT button remains enabled as a parallel entry. config TQ_LOCAL_WAKE_RESPONSE_PROMPT_ENABLE bool "Enable local wake response prompt" depends on TQ_LOCAL_WAKE_ENABLE default y help Play a short acknowledgement after 喵掌柜 is detected and before the normal single-turn dialog starts. config TQ_LOCAL_WAKE_RESPONSE_PROMPT_FILE string "Local wake response prompt file" depends on TQ_LOCAL_WAKE_ENABLE default "local_wake_response.opus" help Prompt filename relative to /littlefs/audio_prompts. Absolute LittleFS paths are also supported. config TQ_LOCAL_WAKE_RETRY_MS int "Local wake startup retry delay (ms)" depends on TQ_LOCAL_WAKE_ENABLE default 5000 range 500 60000 config TQ_LOCAL_WAKE_READY_TIMEOUT_MS int "Local wake network readiness timeout (ms)" depends on TQ_LOCAL_WAKE_ENABLE default 10000 range 1000 30000 help Maximum time to prepare the multimodal transport and reach the server Listening state before the local wake turn is aborted. The acknowledgement prompt is played only after readiness. config TQ_LOCAL_WAKE_STOP_WAIT_MS int "Local wake lifecycle wait (ms)" depends on TQ_LOCAL_WAKE_ENABLE default 1000 range 100 5000 config TQ_LOCAL_WAKE_TASK_STACK_BYTES int "Local wake control task stack (bytes)" depends on TQ_LOCAL_WAKE_ENABLE default 6144 range 4096 32768 config TQ_LOCAL_WAKE_TASK_PRIORITY int "Local wake control task priority" depends on TQ_LOCAL_WAKE_ENABLE default 4 range 1 10 config TQ_LOCAL_WAKE_TASK_CORE int "Local wake control task core (-1 for no affinity)" depends on TQ_LOCAL_WAKE_ENABLE default 0 range -1 1 config TQ_LOCAL_COMMAND_TASK_STACK_BYTES int "MultiNet inference task stack (bytes)" depends on TQ_LOCAL_WAKE_ENABLE default 8192 range 6144 32768 config TQ_LOCAL_COMMAND_TASK_PRIORITY int "MultiNet inference task priority" depends on TQ_LOCAL_WAKE_ENABLE default 7 range 1 10 config TQ_LOCAL_COMMAND_TASK_CORE int "MultiNet inference task core (-1 for no affinity)" depends on TQ_LOCAL_WAKE_ENABLE default 0 range -1 1 config TQ_LOCAL_COMMAND_CONTROL_TIMEOUT_MS int "MultiNet control acknowledgement timeout (ms)" depends on TQ_LOCAL_WAKE_ENABLE default 1000 range 100 5000 config TQ_LOCAL_COMMAND_DETECTION_TIMEOUT_MS int "MultiNet utterance detection timeout (ms)" depends on TQ_LOCAL_WAKE_ENABLE default 6000 range 1000 15000 config TQ_LOCAL_COMMAND_DETECTION_THRESHOLD_X10000 int "MultiNet detection threshold (x10000)" depends on TQ_LOCAL_WAKE_ENABLE default 1200 range 1 9999 help Initial threshold is 0.12 and must be tuned with device audio. endmenu menu "Session & Opus Codec" 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 16 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 endmenu menu "Audio Codec & Streaming" 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 2 range 2 2 help Two physical ES8311 slots are captured: microphone and DAC playback reference. The external Opus contract remains mono. 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_ACTIVE_STALL_MUTE_MS int "Downstream active response stall timeout (ms)" default 3000 range 500 10000 help Abort the current playback generation when neither audio output nor downstream response packets advance for this long. The output is muted first so a stalled response cannot leave stale DMA audio audible indefinitely. config MULTIMODAL_AUDIO_DOWNSTREAM_PREBUFFER_MS int "Downstream playback prebuffer (ms)" default 160 range 0 1000 help Audio accumulated before initial playback. This adds a small first-audio delay in exchange for absorbing normal Wi-Fi and server delivery jitter. config MULTIMODAL_AUDIO_DOWNSTREAM_REBUFFER_GAP_MS int "Downstream underrun detection delay (ms)" default 120 range 20 500 help Continuous empty-queue interval that mutes the output and returns playback to buffering instead of restarting on every isolated packet. config MULTIMODAL_AUDIO_DOWNSTREAM_MAX_REBUFFER_MS int "Maximum adaptive downstream recovery buffer (ms)" default 640 range 160 2000 help Maximum audio accumulated after repeated queue underruns. The recovery target grows from twice the initial prebuffer up to this limit for an unstable response. config MULTIMODAL_AUDIO_DOWNSTREAM_DIAGNOSTICS_ENABLE bool "Enable downstream audio diagnostics" default n help Collect and report low-rate downstream audio timing, queue depth, queue starvation, enqueue failure, and playback failure statistics. Active responses also report a once-per-second wait snapshot when no audio advances. Disabled by default to avoid diagnostic logging and per-packet accounting in production builds. 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_AEC_REFERENCE_CHANNEL int "AEC playback reference channel" default 1 range 0 1 help Interleaved ES8311 slot carrying the DAC playback reference. It must differ from the microphone channel. config MULTIMODAL_AUDIO_AEC_FILTER_LENGTH int "AEC filter length" default 4 range 1 8 help ESP-SR synchronous AEC filter length. Four is the recommended starting point for ESP32-S3. 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 menu "Downstream TTS" 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 2000 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. endmenu menu "WebSocket Transport" 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 endmenu