Diff locks: per-board polarity ('Inverted' switch in the Settings row, 'difflock invert on|off', NVS difflock_inv) - in the car the lock wires carry 12 V while unlocked
Firmware / build (push) Successful in 7m6s

This commit is contained in:
2026-09-29 15:18:23 +02:00
parent 0254bf19e9
commit b431cdfa16
10 changed files with 88 additions and 18 deletions
+4
View File
@@ -222,3 +222,7 @@ The "Sleep when the car is off" switch and both power managers are gone: code, S
## [2026-09-29] update | Diff-lock inputs on DI0 / DI1
The user wants the two Patrol diff locks (+12 V while locked; the front only locks after the rear) shown on the Main CTRL. From the schematic: DI0 = CH422G EXIO0, DI1 = EXIO5, active low behind PC814. The CH422G's IO0-7 are one all-in/all-out bank shared with touch reset, backlight and LCD reset, so the firmware flips the bank to input for about 0.1 ms per read, 4 Hz. It is behind a Settings switch, default OFF, until tried on the bench for flicker. New page [[diff-lock-inputs]]; the schematic source page now carries the input circuit and the EXIO net table.
## [2026-09-29] update | Diff-lock polarity is inverted in the car
In the car the Driveline showed locked while unlocked and open while locked; the bench (12 V = locked) had been right. The likely cause is the ground-switched dash lamps (unverified). Added a per-board polarity setting: the "Inverted" switch in the Settings diff-lock row and `difflock invert on|off`, NVS `difflock_inv`. [[diff-lock-inputs]] is corrected.
+8 -3
View File
@@ -6,14 +6,19 @@ updated: 2026-09-29
# Diff-lock inputs (DI0 rear, DI1 front)
The Patrol has two differential locks. Their switches put **+12 V on a wire while a diff is locked** (source: user, 2026-09-29). The front can only be locked after the rear, so the valid states are: none, rear only, rear + front (source: user). The Main CTRL shows them on the Driveline screen from its two isolated inputs.
The Patrol has two differential locks. The user first described the wires as carrying **+12 V while a diff is locked**. In the car, the screen then showed the opposite (verified by the user, 2026-09-29): the wires carry current while unlocked and none once locked.
> [!warning] Polarity in the car is inverted
> On the bench, 12 V on DI0 showed locked (verified). In the car, the same firmware showed locked while unlocked and open while locked (verified, 2026-09-29). The likely cause is the usual lamp wiring: the dash lamp is fed +12 V and the diff's position switch grounds it on lock. A wire tapped between the lamp and the switch then sits at about 12 V through the lamp filament while unlocked, and at 0 V once the switch closes `(unverified: wiring not traced)`. Fix: the per-board **Inverted** switch (Settings → System, diff-lock row) or `difflock invert on` `(repo)`. With it on, a broken wire reads as *locked*, which shows up as amber, not as a silent "open".
The front can only be locked after the rear, so the valid states are: none, rear only, rear + front (source: user). The Main CTRL shows them on the Driveline screen from its two isolated inputs.
## Wiring
| Terminal (16-way block) | Connect to |
|---|---|
| `DI0` | rear diff-lock wire (+12 V = locked) |
| `DI1` | front diff-lock wire (+12 V = locked) |
| `DI0` | rear diff-lock wire (in the car: 12 V = UNlocked, so turn Inverted on) |
| `DI1` | front diff-lock wire (same) |
| `DI_COM` | vehicle ground (chassis, same ground as the board's `GND`) |
This is Waveshare's "PNP wet input / high-level trigger" wiring: `DI_COM` to the negative pole, 5–36 V DC on the input (source: [[esp32-s3-touch-lcd-5b-waveshare-wiki]]). Tap the wires in parallel with whatever the Patrol already drives with them (dash lamp); each input draws only ~3 mA.