Commit 1625dd2
committed
Fix: Initialize lastGearValue to prevent unwanted setResistance on init (#4018)
Problem:
- lastGearValue was initialized to -1 (default)
- During init, it was not set to the current gears() value
- On first update after init, the condition "lastGearValue != gears()"
was always true (-1 != 0)
- This caused an unwanted setResistance command (0x40 0x5b 0x3f) to be
sent immediately after setSimMode
Solution:
- Initialize lastGearValue = gears() during init (line 264)
- This prevents false gear change detection on first update
- setResistance is now only sent when there's an actual gear change
Fixes issue #4018 - Resistance Changes when Virtual Shifting1 parent bb16ecc commit 1625dd2
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
264 | 265 | | |
265 | 266 | | |
266 | 267 | | |
| |||
0 commit comments