Touch filters

Updated: April 19, 2023

You can specify further configuration by specifying filters that pertain to each touch driver.

Touch Filters

Within the mtouch section, start a subsection with begin filter and ends with end filter to specify a filter. For example:

begin mtouch
    driver = focaltech
    options = generic_j6=1,interrupt=1002,i2c_slave_addr=0x38,i2c_devname=/dev/i2c0,protocol_ver=2

    begin filter
...    type
...    options
    end filter
end mtouch

Touch filter parameters

Touch filters provide a method of removing unwanted coordinates or coordinate-noise, depending on the filter type that you use. Some filters adjust the coordinate data or suppress them depending on the purpose of the filter. These are the touch filter parameters that are available:

Parameter Description Type Possible value(s)
type The series of filters that are applied to the touch coordinates. String
ballistic
Minimizes the noise normally seen on successive touch events that follow a low-speed ballistic trajectory. The lower the speed of the ballistic movement (e.g., a stationary finger), the more gain reduction is applied to the speed of the movement. By doing so, the result is a solid touch with no noise.
compression
Compresses the number of events sent to Screen. Duplicate events are removed and events within the specified threshold are compressed.
edge_swipe_detect
Detects the passing of a finger over the edge of the touch surface. This lets you get swipe gestures starting from outside the screen.
kalman
Minimizes the tracking noise of a moving finger on a given touch surface by use of the Kalman filter algorithm.
options

Filter-specific options. The available filter options depend on the filter type. The format for configuring the filter options is:

options = filter_option=value

where filter_option is one of the options listed under "Touch Filter options" and value is its associated value that you want to set it to. If there are multiple options to specify, then separate each option-value pair by a comma:

options = filter_option1=value,filter_option2=value

String

Based on your filter type, see below for the valid filter options.

Touch Filter options

Valid filter options for configuration depend on the filter type. See below for the filter options that are acceptable in the options parameter for the mtouch_filter section (begin mtouch_filter).

Ballistic filter (e.g., type = ballistic)

Filter option Description Default
scale FP scale factor 256
min_gain Minimal gain 8
low_speed Low speed threshold 32

Compression filter (e.g., type = compression)

Filter option Description Default
threshold Threshold is the maximum distance a coordinate can drift, from its starting point, before an event is sent 10
min_event_interval Minimum event interval in microseconds -1
num_coords_to_average Number of event coordinates to average 0

Edge-swipe filter (e.g., type = edge_swipe_detect)

These are the options for filter order:

Filter option Description Default
filter_order Filter Order 2

These are the options for left edge (e.g., when the x touch coordinate is 0):

Filter option Description Default
xl_enable Apply detection 1
xl_bezel Bezel width 50
xl_speed Speed threshold 25
xl_jitter Jitter control 0
xl_reject_physical_bezel Reject physical bezel 0

These are the options for right edge (e.g., when the x touch coordinate is at the maximum possible value):

Filter option Description Default
xh_enable Apply detection 1
xh_bezel Bezel width 50
xh_speed Speed threshold 25
xh_jitter Jitter control 0
xh_reject_physical_bezel Reject physical bezel 0

These are the options for the top edge (e.g., when the y touch coordinate is 0):

Filter option Description Default
yl_enable Apply detection 1
yl_bezel Bezel width 80
yl_speed Speed threshold 25
yl_jitter Jitter control 0
yl_reject_physical_bezel Reject physical bezel 0

These are the options for the bottom edge (e.g., when the y touch coordinate is at the maximum possible value):

Filter option Description Default
yh_enable Apply detection 1
yh_bezel Bezel width 50
yh_speed Speed threshold 25
yh_jitter Jitter control 0
yh_reject_physical_bezel Reject physical bezel 0
Note: The edge-swipe filter options nomenclature is:
  • xl: x-low border, near x=0;
  • xh: x-high border, near x=maximal X touch coordinate;
  • yl: y-low border, near y=0;
  • yh: y-high border, near y=maximal Y touch coordinate;

Kalman filter (e.g., type = kalman)

These are the options for Noise variance:

Filter option Description Default
proc_noise_x_var Process noise variance (X) 32
proc_noise_y_var Process noise variance (Y) 32
meas_noise_x_var Measurement noise variance(X) 100
meas_noise_y_var Measurement noise variance (Y) 100

These are the options for adaptive speed threshold:

Filter option Description Default
slot_threshold_1 Adaptive speed threshold 1 30
slot_threshold_2 Adaptive speed threshold 2 20
slot_threshold_3 Adaptive speed threshold 3 10
slot_threshold_4 Adaptive speed threshold 4 5