Project

General

Profile

Compare Input » History » Version 3

Adam Klama, 06/21/2026 03:05 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 2 Adam Klama
  the source/value at a [Constant Value Input](Constant_Value_Input) if you
15 1 Adam Klama
  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
26
| Setting | Meaning | Unit | Range / values | Notes |
27
|---|---|---|---|---|
28
| **Source input** | The input being compared | — | an existing input (by alias) | The value tested against **Value**. |
29
| **Compare mode** | How the comparison is made | — | `Equal`, `LessThan`, `GreaterThan`, `WindowCompare` | See below. Result is `1024` (true) or `0` (false). |
30
| **Value** | The value to compare against | source's unit | int32 | The threshold/reference point for the comparison. |
31
| **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.) |
32
| **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. |
33
| **Delay** | Time the new result must be stable before it is accepted | ms | sint32 | Suppresses brief flips around the threshold. |
34
| **Hold** | Minimum time a result is held once accepted | ms | sint32 | Stops rapid re-triggering. |
35
| **Interspace** | Minimum gap between result changes | ms | sint32 | Ignores changes that arrive closer together than this. |
36
37
**Compare modes:** `Equal`, `LessThan` and `GreaterThan` test the source against
38
**Value**. `WindowCompare` is true while the source sits **within `Value ±
39
Deviation`** — handy for "in range" checks.
40
41
**Hysteresis vs debounce:** **Deviation** is the first defence against chatter —
42
it gives the threshold a dead-band so the result doesn't flip rapidly as the source
43
hovers around **Value**. The **Delay / Hold / Interspace** debounce timings are a
44
time-based backup if the result still chatters.
45
46
## Common settings
47 2 Adam Klama
Compare Input also uses the shared setting — alias. See [Common IO Settings](Common_IO_Settings).
48 1 Adam Klama
49
## Example — low oil-pressure warning
50
1. Type **Compare Input**, alias `Low Oil Pressure`.
51
2. **Source input** = your `Oil Pressure` input.
52
3. **Compare mode** `LessThan`, **Value** `100` (your low-pressure limit),
53
   **Deviation** `10` so it trips below 90 and clears above 110 (hysteresis).
54
4. Optionally **Enable filter**, **Delay** `200`, **Hold** `500` so a momentary dip
55
   does not trip the warning.
56
57
The input now reads `1024` (true) whenever oil pressure is below the limit, `0`
58
otherwise.
59
60
## Troubleshooting
61
- **Result chatters on/off:** increase **Deviation** for more hysteresis; if it
62
  still flips, enable the **filter** and raise **Delay** / **Interspace**.
63
- **Always true or always false:** check the **compare mode** and that **Value**
64
  is in the same units as the source input.
65
- **Window Compare never true:** **Deviation** is too small, or **Value** is not
66
  the centre of the band you expect.
67
68
## Related
69 2 Adam Klama
- [Constant Value Input](Constant_Value_Input) — a tunable threshold to compare against.
70 3 Adam Klama
- [Math Input](Math_Divide_Input) — derive a value to compare.
71 2 Adam Klama
- [Counter Input](Counter_Input) — count how often a compare result fires.