Compare Input » History » Version 1
Adam Klama, 06/21/2026 02:14 PM
| 1 | 1 | Adam Klama | # Compare Input |
|---|---|---|---|
| 2 | |||
| 3 | ## Overview |
||
| 4 | A **Compare Input** produces a **boolean** by comparing a source input against a |
||
| 5 | value. The result follows the standard convention: **true = 1024, false = 0**. Use |
||
| 6 | it to turn a measurement into an on/off condition — for example "oil pressure is |
||
| 7 | below the warning limit" or "speed is inside the shift window" — that other logic, |
||
| 8 | outputs or maps can act on. |
||
| 9 | |||
| 10 | ## Prerequisites |
||
| 11 | You need: |
||
| 12 | - A **source input** to compare — any existing input, referenced by its alias. |
||
| 13 | - The **value** to compare against. This can be a fixed number, or you can point |
||
| 14 | the source/value at a [Constant Value Input](Constant-Value-Input.md) if you |
||
| 15 | want a tunable threshold. |
||
| 16 | |||
| 17 | ## Add it in the app |
||
| 18 | 1. Add a new input and choose **Compare Input** as the type. |
||
| 19 | 2. Choose the **source input**. |
||
| 20 | 3. Give it a clear **alias** (e.g. `Low Oil Pressure`). |
||
| 21 | 4. Set the **compare mode**, the **value**, and a **deviation** for hysteresis. |
||
| 22 | 5. Enable the **filter** and set the debounce timings if the result still chatters. |
||
| 23 | |||
| 24 | ## Settings reference |
||
| 25 | > Schema: `config/CompareInput.proto`. |
||
| 26 | |||
| 27 | | Setting | Meaning | Unit | Range / values | Notes | |
||
| 28 | |---|---|---|---|---| |
||
| 29 | | **Source input** | The input being compared | — | an existing input (by alias) | The value tested against **Value**. | |
||
| 30 | | **Compare mode** | How the comparison is made | — | `Equal`, `LessThan`, `GreaterThan`, `WindowCompare` | See below. Result is `1024` (true) or `0` (false). | |
||
| 31 | | **Value** | The value to compare against | source's unit | int32 | The threshold/reference point for the comparison. | |
||
| 32 | | **Deviation** | Hysteresis band around the threshold | source's unit | int32 | Adds hysteresis so the result doesn't chatter as the source crosses **Value** — it switches at one edge of the band and clears at the other. (In `WindowCompare` it also sets the half-width of the in-range window.) | |
||
| 33 | | **Enable filter** | Turns on debounce of the boolean result | — | on / off | Recommended when the source hovers near the threshold. The three timings below apply when on. | |
||
| 34 | | **Delay** | Time the new result must be stable before it is accepted | ms | sint32 | Suppresses brief flips around the threshold. | |
||
| 35 | | **Hold** | Minimum time a result is held once accepted | ms | sint32 | Stops rapid re-triggering. | |
||
| 36 | | **Interspace** | Minimum gap between result changes | ms | sint32 | Ignores changes that arrive closer together than this. | |
||
| 37 | |||
| 38 | **Compare modes:** `Equal`, `LessThan` and `GreaterThan` test the source against |
||
| 39 | **Value**. `WindowCompare` is true while the source sits **within `Value ± |
||
| 40 | Deviation`** — handy for "in range" checks. |
||
| 41 | |||
| 42 | **Hysteresis vs debounce:** **Deviation** is the first defence against chatter — |
||
| 43 | it gives the threshold a dead-band so the result doesn't flip rapidly as the source |
||
| 44 | hovers around **Value**. The **Delay / Hold / Interspace** debounce timings are a |
||
| 45 | time-based backup if the result still chatters. |
||
| 46 | |||
| 47 | ## Common settings |
||
| 48 | Compare Input also uses the shared setting — alias. See [Common IO Settings](../Common-IO-Settings.md). |
||
| 49 | |||
| 50 | ## Example — low oil-pressure warning |
||
| 51 | 1. Type **Compare Input**, alias `Low Oil Pressure`. |
||
| 52 | 2. **Source input** = your `Oil Pressure` input. |
||
| 53 | 3. **Compare mode** `LessThan`, **Value** `100` (your low-pressure limit), |
||
| 54 | **Deviation** `10` so it trips below 90 and clears above 110 (hysteresis). |
||
| 55 | 4. Optionally **Enable filter**, **Delay** `200`, **Hold** `500` so a momentary dip |
||
| 56 | does not trip the warning. |
||
| 57 | |||
| 58 | The input now reads `1024` (true) whenever oil pressure is below the limit, `0` |
||
| 59 | otherwise. |
||
| 60 | |||
| 61 | ## Troubleshooting |
||
| 62 | - **Result chatters on/off:** increase **Deviation** for more hysteresis; if it |
||
| 63 | still flips, enable the **filter** and raise **Delay** / **Interspace**. |
||
| 64 | - **Always true or always false:** check the **compare mode** and that **Value** |
||
| 65 | is in the same units as the source input. |
||
| 66 | - **Window Compare never true:** **Deviation** is too small, or **Value** is not |
||
| 67 | the centre of the band you expect. |
||
| 68 | |||
| 69 | ## Related |
||
| 70 | - [Constant Value Input](Constant-Value-Input.md) — a tunable threshold to compare against. |
||
| 71 | - [Math / Divide Input](Math-Divide-Input.md) — derive a value to compare. |
||
| 72 | - [Counter Input](Counter-Input.md) — count how often a compare result fires. |