Skip to content

Accuracy

TriggerGate puts two presses in order when they are more than 50 µs apart on an ESP32 board, and more than about 0.16 ms apart on an Advantech card with interrupts. The figure depends on the platform, because each one learns about a press in a different way: from a hardware interrupt, from a poll of its inputs, or from a USB report. This page gives the figure to expect on each platform and explains where it comes from. It also describes how TriggerGate handles presses closer than that: it identifies them, chooses their order without favoring any button, and leaves the show to decide whether that order stands. Use it to choose hardware for a show and to know what a close result means.

What the figures mean

  • Ordered means TriggerGate reports the presses in the order they happened, with different faceoff times.
  • Tied means the presses were closer than the platform's limit. The tied entries share one faceoff time, their order is chosen at random, and the web page marks them with "≈". The input number and the order the presses arrived in never decide it. The show can keep the random ordern order or treat the entries as a tie; see Closer than that. The exact rule is in Triggers and faceoffs.
  • A guard or discrimination period (D) is the comparison limit TriggerGate applies to the timestamps of interrupt entries: entries stamped more than D apart are ordered, closer ones are tied. It applies to the timestamps, not to the physical presses. Input circuits, cable and switch differences, and the time the hardware takes to signal an interrupt all shift a stamp a little, so presses whose physical gap is close to D can still tie.
  • A timer's resolution is not its accuracy. A stamp counted in microseconds can still be tens of microseconds away from the instant the contact closed.

The figures below are for clean electrical edges. A real button's bounce and wiring add their own uncertainty, which the button health check can help you measure.

At a glance

Platform Expect presses to be ordered when they are more than about Closer presses are tied because
Advantech card on Windows, interrupt faceoff 0.16 ms The guard is 150 µs
Advantech card on Windows, polled faceoff 10 ms One 10 ms poll finds them together, with no order between them
ESP32 board 50 µs between stamps The guard is 50 µs; simultaneous presses can be stamped up to about 50 µs apart
X-keys XK-12 Switch Interface 1 ms The keypad reports every millisecond; presses in one report tie
X-keys XK-12 Jog & Shuttle 30 ms The keypad spaces its key reports about 30 ms apart
Other X-keys models The model's report interval, at best Presses in one report tie
Advantech UNO, Native read, 400 kHz I²C and pinned core clock 100 µs at tested gaps on one device Presses found by one read tie; different reads are ordered. No guard interval applies

Each server also tells its clients its own figure for each kind of faceoff, as the ordering resolution in its configuration. The web page shows it in the tooltip of the Wall clock entry. It is null where the platform does not know it (the Uno), and the ESP32 does not send it.

Closer than that: a fair result, not a hidden bias

Every timing system has a smallest gap it can resolve. The limit comes from the hardware: a switch's contacts bounce before they settle, each input circuit and cable delays its edge by a slightly different amount, interrupts take time to arrive and are handled one after another, and a poll or a USB report finds all its changes at once.

A system that ignores this still produces an order for presses inside that gap. The order comes from whatever the system happens to process first: the input number, the position in a scan, the order in which it handles interrupts. Nobody chose that bias and nobody is told about it, yet it can favor the same button in every close call.

TriggerGate handles these presses deliberately:

  • It identifies them. Entries found by the same read, or stamped within the guard D of each other in an interrupt faceoff, form a tied group, and every entry of the group reports the same faceoff time. Within a faceoff, distinct groups never share a time, so equal faceoff times mean a tie.
  • It chooses their order at random, favoring no button. The order is chosen with a cryptographic random number generator on Windows and the Uno, and with the board's hardware random number generator on the ESP32. The input number, the wiring and the order the presses arrived in never decide it. In an interrupt group, entries stamped more than D apart keep their stamp order, and each order that respects this is equally likely. Triggers and faceoffs gives the exact rule, including the one case, a tight chain of well over 16 entries, where the order is random but not every allowed order is equally likely.
  • It tells the show. The web page marks each tied place with "≈" and the tooltip "Too close to call: the order was drawn at random". A client finds tied entries by comparing faceoff times: in .NET, FaceoffTies.FindTiedInputs applies the rule to a list of entries, and the client library sets IsTied on each tied trigger. The Windows and Uno services write each tie to their log, and an ESP32 board keeps it in its device log.

The show keeps the decision. It can accept the random order: the places stand, and no button was favored in reaching them. Or it can call a true tie, because it knows exactly which entries were tied. Trigger actions that the server runs itself follow the random order (in a tie for first place, only the entry placed first runs its winner actions; see Trigger actions), so a show that calls ties handles them in its own application. How a client reads a tie is in Hub API and .NET client library.

Advantech card on Windows

Interrupt faceoffs are the most precise way to run a faceoff on Windows. When a participant's input changes, the card raises an interrupt and the service stamps it at once, in native code that the rest of the service cannot hold up. Entries stamped more than the discrimination period D apart are ordered, and closer ones are tied. D is 150 µs by default, chosen so that a pair of interrupts the card reports in the wrong order always falls inside it. It can be changed with TriggerGate:InterruptDiscriminationMicroseconds; a smaller D orders closer presses but risks reporting a wrong order with confidence, and a larger D treats more close presses as ties.

The other factor is the processor. A processor in a deep idle state takes time to wake when the interrupt arrives, so the first interrupt after a quiet spell can be stamped late. With idle states disabled, presses more than about 0.16 ms apart are ordered; with Windows' default power settings, only from about 0.36 ms. For this reason the service disables processor idle states in the active power scheme while any faceoff or pre-faceoff is armed, and puts them back a few seconds after the last one ends, unless TriggerGate:FaceoffIdleStates is set to LeaveAlone. The change is made in the background when a faceoff is armed and takes about 200 ms to take effect, so arm a faceoff at least that long before the presses that matter. The setting is listed in Install on Windows, and how the change is made and undone is in Processor idle states during faceoffs.

Polled faceoffs read every input every 10 ms. Presses found by the same read are tied, so the resolution is about 10 ms: presses almost 10 ms apart can tie, and presses much closer are ordered when a read happens to fall between them. Polling works on every input of every card, including inputs that cannot raise interrupts.

ESP32 board

The ESP32 stamps every edge in its GPIO interrupt handler with a timer that counts microseconds. Entries stamped more than the 50 µs guard apart are ordered; closer ones are tied. The guard is set at that size because two inputs pressed at exactly the same instant can be stamped up to about 50 µs apart: the input circuits switch at slightly different moments, and the interrupts are handled one after another. A guard smaller than that spread would turn some simultaneous presses into a confident order that favors whichever input switched or was handled first.

So expect entries stamped more than 50 µs apart to be ordered. Because each stamp can be shifted by tens of microseconds, presses whose physical gap is only a little more than 50 µs can still tie. The figure applies to inputs wired as described in ESP32 input wiring; a different input circuit or a heavily loaded board can change it.

A group is decided 300 µs after its last entry, so its results reach clients a fraction of a millisecond after the presses.

X-keys keypads

An X-keys keypad has no interrupts: it sends the host a USB report of its keys, and the service orders presses by report. Presses in the same report are tied. How often a model reports is therefore its resolution:

  • The XK-12 Switch Interface reports every millisecond, so presses within about a millisecond can tie.
  • The XK-12 Jog & Shuttle spaces its key reports about 30 ms apart, much more than its USB polling interval suggests. Two keys pressed close together arrive in one report or in consecutive reports about 30 ms apart, so expect ties at that scale.
  • For other models, the USB polling interval is the best the model can do, and its firmware may space key reports further apart. The service reports the best figure it knows for the connected model.

A faceoff always runs on one keypad; presses on two keypads are never compared.

Advantech UNO

The UNO reads all eight inputs from an I²C port expander in a continuous loop. It has no guard interval: presses found by one read tie, while presses found by different reads are ordered. The service reports its ordering resolution as unknown because the read interval and occasional stalls are not a fixed limit. The figures below are observed boundaries at the generator's tested gaps, not a promise that every physical gap above them will be resolved. Sources in this repository are dev/reports/uno-validation-20261125.md (original bus settings), dev/reports/uno-validation-phase3-20261125.md (read modes and new press-rules confirmation), and dev/reports/uno-crackle-health-20261126.md (new-rules results and limits).

Read condition on the same UNO-220 Observed ordering boundary Read interval and sample
Original two-transfer read, nominal 100 kHz I²C and shipped ondemand core clock Every two-input trial ordered from 1,000 µs (872 trials); every comparison including bursts from 1,500 µs (848 trials) Mean 961.6 µs across 3,690,630 reads; the core clock varied, so the actual bus speed varied too
Original two-transfer read, 400 kHz I²C with core_freq_min=500 Two-input trials from 150 µs (2,416 trials); bursts from 600 µs (1,528 trials) Mean 134.0 µs across 26,291,337 reads
Managed SingleTransfer, 400 kHz I²C with core_freq_min=500, same-build old press rules Two-input trials from 100 µs (2,616 trials); every comparison including bursts from 2,500 µs (464 trials) Approximate mean 67.06 µs across 52,994,759 reads in selected telemetry windows; stalls still widened some ties
Default Native reader at real-time FIFO priority 50, 400 kHz I²C with core_freq_min=500, new press rules Every comparison, including bursts, at tested gaps of 100 µs and above was ordered: 7,272/7,272 comparisons in 1,512 trials; the largest gap tied was 50 µs Weighted mean 59.7 µs across 29,877,020 reads in selected main-round telemetry windows

The new-rules Native run had 0/7,552 wrong confident orders at nonzero gaps and 0/30,360 separated zero-gap comparisons, including 0/1,000 eight-input simultaneous trials split. The earlier old-rules Native comparison also ordered every tested gap from 100 µs, with 8,952/8,952 comparisons in 3,192 trials; it had 0/9,792 wrong confident orders and 0/2,000 eight-input simultaneous trials split. The same-build managed SingleTransfer comparison had 0/9,792 wrong confident orders, but one false separation of nominally simultaneous inputs in 2,000 eight-input trials (seven correlated separated comparisons out of 56,000). Native is now the default; if it cannot start, the service falls back to SingleTransfer. These modes and the older two-transfer mode must not be treated as the same timing condition.

All these campaigns used one UNO-220, one pulse generator that was not calibrated against an oscilloscope or logic analyzer, one wiring arrangement with the UNO's internal pull-ups, and mostly idle network conditions. The gaps are programmed generator offsets; terminal arrival skew was not independently measured. Zero observed errors is not a zero-error guarantee. The new-rules Native confirmation included an SSH monitor in some rounds, but no verified sustained-load qualification or second device. A read stall can still widen a tie, and short presses that begin and end between reads can be missed. The UNO-220's real-time clock has no driver under the tested Raspberry Pi OS kernel, so its wall clock depends on network time after a power cut; see Clocks and time.

Report delivery is separate from ordering

How precisely TriggerGate orders presses is one question; how quickly a client hears about them is another. A faceoff's order and faceoff times are decided on the device from its own stamps, so network delay never changes who won. It only changes when the client finds out.

  • Interrupt faceoff results are held back until their group is decided: 2D after the group's last entry on an Advantech card (300 µs by default), and 300 µs on the ESP32. Every other report is sent at once.
  • With an Advantech card on a wired network, expect a report to reach a client on another computer in about a millisecond, and within a few milliseconds almost always; an occasional report takes up to about 15 ms. TriggerGate states no delivery figure for the other platforms.
  • The first report after a client connects is slower, around 10 ms. Connect clients well before the faceoff matters.
  • The service measures, on its own clock, how long each faceoff report took from its stamp to leaving the service. It logs a warning when that exceeds TriggerGate:EdgeHandoffWarnMilliseconds in appsettings.json (default 5 ms; 0 turns the warning off), so a slow result can be put down to the service or to the network and client.
  • The web page redraws its input tiles at most ten times a second and its log four times a second. It is a monitor, not a timing reference: use the faceoff times and places it shows, not when they appear.

Times from more than one device

Each edge report carries its own monotonic stamp, for ordering events from the same device since it started, and the same instant in UTC. A faceoff is always decided on one device, from its own stamps; TriggerGate does not combine contestants across devices.

Comparing UTC times from two machines is only as good as their clocks: both must follow a common time source, and the comparison is only good to within both clocks' stated errors. The ESP32 reports UTC only while its NTP or PTP mapping is fresh, and its software PTP reports observations of its clock, not a guaranteed error bound. How to keep clocks synchronized, and what the clock entries on the web page tell you, is in Clocks and time.

v2.0.62