menu "Touch Button Sensor Configuration"

    config TOUCH_BUTTON_SENSOR_DEBUG
        bool "Enable touch button sensor debug mode"
        default n
        help
            Enable touch button sensor debug mode.

    config TOUCH_BUTTON_SENSOR_CALIBRATION_TIMES
        int "Calibration times"
        default 20
        range 10 1000
        help
            Number of readings used for initial calibration.

    config TOUCH_BUTTON_SENSOR_DEBOUNCE_INACTIVE
        int "Debounce inactive count"
        default 1 if IDF_TARGET_ESP32
        default 2
        range 1 50
        help
            Number of consecutive readings below threshold needed to confirm inactive state.

    config TOUCH_BUTTON_SENSOR_POLLING_INTERVAL
        int "Polling interval (ms)"
        default 20
        range 5 100
        depends on IDF_TARGET_ESP32
        help
            Interval between polling touch readings in milliseconds (for ESP32 only).

    config TOUCH_BUTTON_SENSOR_SMOOTH_COEF_X1000
        int "Smooth coefficient (/1000)"
        default 400
        range 0 1000
        help
            Coefficient for smooth filter, multiplied by 1000.
            For example, 200 means 0.2

    config TOUCH_BUTTON_SENSOR_BASELINE_COEF_X1000
        int "Baseline coefficient (/1000)"
        default 150 if IDF_TARGET_ESP32
        default 100
        range 0 1000
        help
            Coefficient for baseline filter, multiplied by 1000.
            For example, 100 means 0.1

    config TOUCH_BUTTON_SENSOR_MAX_P_X1000
        int "Maximum positive change ratio (/1000)"
        default 0
        range 0 1000
        help
            Maximum positive change ratio from baseline, multiplied by 1000.
            For example, 200 means 0.2. 0 means automatically set limit based on threshold.

    config TOUCH_BUTTON_SENSOR_MIN_N_X1000
        int "Minimum negative change ratio (/1000)"
        default 0
        range 0 1000
        help
            Minimum negative change ratio from baseline, multiplied by 1000.
            For example, 200 means 0.2. 0 means automatically set limit based on threshold.

    config TOUCH_BUTTON_SENSOR_NEGATIVE_LOGIC
        bool "Using negative logic to detect touch"
        default n
        help
            Using both positive and negative threshold to detect touch.

    config TOUCH_BUTTON_SENSOR_NOISE_P_SNR
        int "Positive noise SNR"
        default 4
        range 3 100
        help
            Signal-to-noise for positive Noise

    config TOUCH_BUTTON_SENSOR_NOISE_N_SNR
        int "Negative noise SNR"
        default 4
        range 2 100
        help
            Signal-to-noise for negative Noise

    config TOUCH_BUTTON_SENSOR_RESET_COVER
        int "Reset count from cover"
        default 1000
        range 0 5000
        help
            Reset count if cover is detected. 0 means no reset.

    config TOUCH_BUTTON_SENSOR_RESET_CALIBRATION
        int "Reset count from calibration error"
        default 3
        range 0 100
        help
            Reset count for negative threshold. 0 means no reset.

    config TOUCH_BUTTON_SENSOR_RAW_BUF_SIZE
        int "Raw buffer size"
        default 10
        range 5 100
        help
            Size of raw data buffer.

    config TOUCH_BUTTON_SENSOR_SCALE_FACTOR
        int "Scale factor"
        default 100 if !IDF_TARGET_ESP32
        default 1000
        range 10 1000
        help
            Scale factor for threshold calculation.

    config TOUCH_BUTTON_SENSOR_SIMULTANEOUS_TRIGGER_WINDOW_MS
        int "Simultaneous trigger window (ms)"
        default 40
        range 10 200
        help
            Time window in milliseconds for considering triggers as simultaneous.
            Multiple frequency triggers within this window will be considered as
            a single touch event. Smaller values make detection more strict,
            larger values make detection more tolerant to timing variations.

    config TOUCH_BUTTON_SENSOR_TRIGGER_CLEANUP_TIMEOUT_MS
        int "Trigger cleanup timeout (ms)"
        default 200
        range 50 1000
        help
            Timeout in milliseconds for cleaning up old trigger records.
            Trigger records older than this timeout will be automatically
            cleared to prevent memory accumulation and false detections.

endmenu
