Skip to content

Commit 99a6053

Browse files
committed
2 parents 1f34c93 + 5c7a45b commit 99a6053

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+328
-102
lines changed

.github/workflows/lint.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ jobs:
1010
steps:
1111
- name: Check out repo
1212
uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 2
1315

1416
- name: Install Markdownlint-cli
1517
run: |
1618
npm install -g markdownlint-cli
1719
1820
- name: Lint
1921
run: |
20-
markdownlint -i _* --disable MD033 MD034 MD013 MD024 MD036 -- .
22+
bash ./wiki-tools/lint.sh

Adaptive-Suspension.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Adaptive Suspension
22

3-
[Shock Dyno](Shock-Dyno.md)
3+
[Shock Dyno](Shock-Dyno)
44

55
[ArsTechnica: DSC Sport’s active shocks in action](https://arstechnica.com/cars/2015/07/the-future-of-car-suspension-is-here-dsc-sports-active-shocks-in-action/)
66
"Normally, a car's weight transfers from front to back as it brakes and accelerates, and from side to side as it corners. As the force on each corner changes, so does the grip available to that wheel; less weight equals less grip. Active shocks control this by varying the degree to which each spring's compresses and extends (as the springs are passive, these systems are sometimes known as semi-active)."

B6-temp-mim.md

Lines changed: 217 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ canMotorInfo1= { 0x99, 0x14, 0x00, 0x7F, 0x00, 0xF0, 0x47, 0x01 }
3939
canMotorInfo3= { 0x9B, 0x14, 0x00, 0x11, 0x1F, 0xE0, 0x0C, 0x46 }
4040
motor7Data = { 0x1A, 0x66, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00 }
4141

42+
canMotorInfoTotalCounter = 0
43+
4244
VWTP_OUT = 0x200
4345
VWTP_IN = 0x202
4446
VWTP_TESTER = 0x300
@@ -53,15 +55,78 @@ ECU_BUS = 1
5355
-- really 'not ECU'
5456
TCU_BUS = 2
5557

58+
fakeTorque = 0
59+
rpm = 0
60+
tps = 0
61+
62+
function xorChecksum(data, targetIndex)
63+
local index = 1
64+
local result = 0
65+
while data[index] ~= nil do
66+
if index ~= targetIndex then
67+
result = result ~ data[index]
68+
end
69+
index = index + 1
70+
end
71+
data[targetIndex] = result
72+
return result
73+
end
74+
75+
function setBitRange(data, totalBitIndex, bitWidth, value)
76+
local byteIndex = totalBitIndex >> 3
77+
local bitInByteIndex = totalBitIndex - byteIndex * 8
78+
if (bitInByteIndex + bitWidth > 8) then
79+
bitsToHandleNow = 8 - bitInByteIndex
80+
setBitRange(data, totalBitIndex + bitsToHandleNow, bitWidth - bitsToHandleNow, value >> bitsToHandleNow)
81+
bitWidth = bitsToHandleNow
82+
end
83+
mask = (1 << bitWidth) - 1
84+
data[1 + byteIndex] = data[1 + byteIndex] & (~(mask << bitInByteIndex))
85+
maskedValue = value & mask
86+
shiftedValue = maskedValue << bitInByteIndex
87+
data[1 + byteIndex] = data[1 + byteIndex] | shiftedValue
88+
end
89+
5690
function relayFromECU(bus, id, dlc, data)
5791
totalEcuMessages = totalEcuMessages + 1
5892
-- print("Relaying to TCU " .. id)
5993
txCan(TCU_BUS, id, 0, data) -- relay non-TCU message to TCU
6094
end
6195

96+
function sendMotor1()
97+
engineTorque = fakeTorque * 0.9
98+
innerTorqWithoutExt = fakeTorque
99+
torqueLoss = 20
100+
requestedTorque = fakeTorque
101+
102+
motor1Data[2] = engineTorque / 0.39
103+
setTwoBytes(motor1Data, 2, rpm / 0.25)
104+
motor1Data[5] = innerTorqWithoutExt / 0.4
105+
motor1Data[6] = tps / 0.4
106+
motor1Data[7] = torqueLoss / 0.39
107+
motor1Data[8] = requestedTorque / 0.39
108+
109+
txCan(TCU_BUS, MOTOR_1, 0, motor1Data)
110+
end
111+
112+
function onMotor1(bus, id, dlc, data)
113+
totalEcuMessages = totalEcuMessages + 1
114+
rpm = getBitRange(data, 16, 16) * 0.25
115+
if rpm == 0 then
116+
canMotorInfoTotalCounter = 0
117+
end
118+
119+
tps = getBitRange(data, 40, 8) * 0.4
120+
121+
fakeTorque = interpolate(0, 6, 100, 60, tps)
122+
123+
-- sendMotor1()
124+
relayFromECU(bus, id, dlc, data)
125+
end
126+
62127
function relayFromECUAndEcho(bus, id, dlc, data)
63128
totalEcuMessages = totalEcuMessages + 1
64-
-- print("Relaying to TCU " .. id)
129+
print("Relaying to TCU " .. id)
65130
txCan(TCU_BUS, id, 0, data) -- relay non-TCU message to TCU
66131
end
67132

@@ -76,8 +141,34 @@ end
76141
local payLoadIndex = 0
77142

78143
function relayTpPayloadFromTCU(bus, id, dlc, data)
144+
totalTcuMessages = totalTcuMessages + 1
145+
-- print("Relaying TP ECU " ..id ..arrayToString(data))
146+
txCan(ECU_BUS, id, 0, data) -- relay non-ECU message to ECU
147+
148+
149+
if data[1] == 0xA3 then
150+
-- print ("Keep-alive")
151+
return
152+
end
153+
154+
if data[1] == 0xA1 then
155+
print ("Happy 300 packet")
156+
return
157+
end
158+
159+
if data[1] == 0xA8 then
160+
print ("They said Bye-Bye")
161+
return
162+
end
163+
164+
if data[1] == 0x10 and dlc == 5 then
165+
-- print ("Sending ACK B1 ")
166+
return
167+
end
168+
79169
top4 = math.floor(data[1] / 16)
80170
if top4 == 0xB then
171+
-- ACK
81172
return
82173
end
83174

@@ -103,21 +194,79 @@ function relayTpPayloadFromTCU(bus, id, dlc, data)
103194
if top4 == 1 then
104195
payLoadIndex = 0
105196
end
106-
197+
return
107198
end
108199

109-
totalTcuMessages = totalTcuMessages + 1
110-
-- print("Relaying to ECU " ..id ..arrayToString(data))
111-
txCan(ECU_BUS, id, 0, data) -- relay non-ECU message to ECU
200+
print('Got unexpected ' ..arrayToString(data))
112201
end
113202

114203
function drop(bus, id, dlc, data)
115204
end
116205

206+
motorBreCounter = 0
207+
function onMotorBre(bus, id, dlc, data)
208+
motorBreCounter = (motorBreCounter + 1) % 16
209+
210+
setBitRange(motorBreData, 8, 4, motorBreCounter)
211+
xorChecksum(motorBreData, 1)
212+
213+
txCan(TCU_BUS, MOTOR_BRE, 0, motorBreData)
214+
end
215+
216+
217+
motor5FuelCounter = 0
218+
function onMotor5(bus, id, dlc, data)
219+
setBitRange(motor5Data, 5, 9, motor5FuelCounter)
220+
xorChecksum(motor5Data, 8)
221+
txCan(TCU_BUS, MOTOR_5, 0, motor5Data)
222+
end
223+
224+
counter16 = 0
225+
function onMotor6(bus, id, dlc, data)
226+
counter16 = (counter16 + 1) % 16
227+
228+
-- engineTorque = getBitRange(data, 8, 8) * 0.39
229+
-- actualTorque = getBitRange(data, 16, 8) * 0.39
230+
-- feedbackGearbox = getBitRange(data, 40, 8) * 0.39
231+
engineTorque = fakeTorque * 0.9
232+
actualTorque = fakeTorque
233+
feedbackGearbox = 255
234+
235+
motor6Data[2] = math.floor(engineTorque / 0.39)
236+
motor6Data[3] = math.floor(actualTorque / 0.39)
237+
motor6Data[6] = math.floor(feedbackGearbox / 0.39)
238+
setBitRange(motor6Data, 60, 4, counter16)
239+
240+
xorChecksum(motor6Data, 1)
241+
txCan(TCU_BUS, MOTOR_6, 0, motor6Data)
242+
end
243+
117244
function onMotor7(bus, id, dlc, data)
118245
txCan(TCU_BUS, MOTOR_7, 0, motor7Data)
119246
end
120247

248+
249+
canMotorInfoCounter = 0
250+
function onMotorInfo(bus, id, dlc, data)
251+
canMotorInfoTotalCounter = canMotorInfoTotalCounter + 1
252+
canMotorInfoCounter = (canMotorInfoCounter + 1) % 16
253+
-- canMotorInfoCounter = getBitRange(data, 0, 4)
254+
255+
baseByte = canMotorInfoTotalCounter < 6 and 0x80 or 0x90
256+
canMotorInfo[1] = baseByte + (canMotorInfoCounter)
257+
canMotorInfo1[1] = baseByte + (canMotorInfoCounter)
258+
canMotorInfo3[1] = baseByte + (canMotorInfoCounter)
259+
mod4 = canMotorInfoCounter % 4
260+
261+
if (mod4 == 0 or mod4 == 2) then
262+
txCan(TCU_BUS, MOTOR_INFO, 0, canMotorInfo)
263+
elseif (mod4 == 1) then
264+
txCan(TCU_BUS, MOTOR_INFO, 0, canMotorInfo1)
265+
else
266+
txCan(TCU_BUS, MOTOR_INFO, 0, canMotorInfo3)
267+
end
268+
end
269+
121270
hexstr = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F" }
122271

123272
function toHexString(num)
@@ -149,12 +298,62 @@ totalEcuMessages = 0
149298
canRxAdd(ECU_BUS, MOTOR_7, drop)
150299
--canRxAdd(ECU_BUS, ACC_GRA, drop)
151300

301+
-- kombi 3
302+
canRxAdd(ECU_BUS, 1312, relayFromECU)
303+
-- Soll_Verbauliste_neu
304+
canRxAdd(ECU_BUS, 1500, relayFromECU)
305+
-- power steering
306+
canRxAdd(ECU_BUS, 208, relayFromECU)
307+
-- REQUIRED GRA_Neu
308+
canRxAdd(ECU_BUS, 906, relayFromECU)
309+
canRxAdd(ECU_BUS, AIRBAG, relayFromECU)
310+
-- brake 1
311+
canRxAdd(ECU_BUS, 416, relayFromECU)
312+
-- brake 8
313+
canRxAdd(ECU_BUS, 428, relayFromECU)
314+
-- brake 3
315+
canRxAdd(ECU_BUS, 1184, relayFromECU)
316+
-- brake 5
317+
canRxAdd(ECU_BUS, 1192, relayFromECU)
318+
-- brake 2
319+
canRxAdd(ECU_BUS, 1440, relayFromECU)
320+
-- steering
321+
canRxAdd(ECU_BUS, 194, drop)
322+
-- kombi
323+
canRxAdd(ECU_BUS, 800, relayFromECU)
324+
-- ps
325+
canRxAdd(ECU_BUS, 976, drop)
326+
-- ps
327+
canRxAdd(ECU_BUS, 978, drop)
328+
-- klima
329+
canRxAdd(ECU_BUS, 1504, drop)
330+
-- EPB_1
331+
canRxAdd(ECU_BUS, 1472, drop)
332+
canRxAdd(ECU_BUS, 1478, relayFromECU)
333+
-- Gate_Komf_1
334+
canRxAdd(ECU_BUS, 912, relayFromECU)
335+
-- Systeminfo_1
336+
canRxAdd(ECU_BUS, 1488, relayFromECU)
337+
-- Kombi_2
338+
canRxAdd(ECU_BUS, 1056, relayFromECU)
339+
-- BSG_Last
340+
canRxAdd(ECU_BUS, 1392, relayFromECU)
341+
-- Airbag_2
342+
canRxAdd(ECU_BUS, 1360, relayFromECU)
343+
-- ZAS_1
344+
canRxAdd(ECU_BUS, 1394, relayFromECU)
345+
-- Ident
346+
canRxAdd(ECU_BUS, 1490, relayFromECU)
347+
-- Diagnose_1
348+
canRxAdd(ECU_BUS, 2000, relayFromECU)
349+
152350
canRxAdd(ECU_BUS, MOTOR_1, relayFromECU)
153351
canRxAdd(ECU_BUS, MOTOR_BRE, relayFromECU)
154352
canRxAdd(ECU_BUS, MOTOR_2, relayFromECU)
155353
canRxAdd(ECU_BUS, MOTOR_3, relayFromECU)
354+
canRxAdd(ECU_BUS, MOTOR_5, relayFromECU)
156355
canRxAdd(ECU_BUS, MOTOR_6, relayFromECU)
157-
canRxAdd(ECU_BUS, MOTOR_7, relayFromECU)
356+
--canRxAdd(ECU_BUS, MOTOR_7, relayFromECU)
158357
canRxAdd(ECU_BUS, ACC_GRA, relayFromECU)
159358
canRxAdd(ECU_BUS, MOTOR_INFO, relayFromECU)
160359

@@ -164,11 +363,22 @@ canRxAdd(ECU_BUS, 0x760, relayFromECU)
164363
canRxAdd(TCU_BUS, VWTP_IN, relayFromTCU)
165364
canRxAdd(TCU_BUS, VWTP_TESTER, relayTpPayloadFromTCU)
166365

167-
canRxAddMask(ECU_BUS, 0, 0, relayFromECUAndEcho)
366+
canRxAddMask(ECU_BUS, 0, 0, drop)
168367
--canRxAddMask(ECU_BUS, 0, 0, relayFromECU)
169368
canRxAddMask(TCU_BUS, 0, 0, relayFromTCU)
170369

370+
everySecondTimer = Timer.new()
371+
171372
function onTick()
172373
onMotor7(0, 0, 0, nil)
173374

375+
if everySecondTimer : getElapsedSeconds() > 1 then
376+
everySecondTimer : reset()
377+
print("Total from ECU " ..totalEcuMessages)
378+
motor5FuelCounter = motor5FuelCounter + 20
379+
380+
--onMotorInfo(0, 0, 0, nil)
381+
end
382+
383+
174384
end

Breakout-Module.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Uses breakout module noted [here](http://rusefi.com/forum/viewtopic.php?f=4&t=45
1313
* Cut OEM harness for the crank angle wire(s), put the leads to the breakout module, use the fuse to simple pass the signal through the breakout module, and verify that the OEM engine is operational.
1414
* Connect rusEFI cam and/or crank to breakout module.
1515
* Install 2nd fuse to connect both OEM control unit and rusEFI. Take note that VR signals may be loaded and may be problematic at low RPM with this approach. Or it may simply work. Give it a try and see what happens. If it doesn't start with both connected, try starting the engine with rusEFI jumper removed, then after started install rusEFI jumper.
16-
* Capture crank signals via [dev console](Console.md).
16+
* Capture crank signals via [dev console](Console).
1717
* Either configure rusEFI to use the proper crank decoder, or get a decoder developed from the dev console logs, then configure rusEFI to use the proper decoder.
1818
* See reliable RPM values displayed on the gauge, and noise free crank signals.
1919

D-is-for-DISTRACTION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ It is due to these distractions (and the fact that some times out Devs also have
99

1010
What this means is we politely request that people try not to ask easily answered questions to the Devs and keep feature requests to a minimum for now.
1111

12-
There are details of our plans for fuel strategy improvements [at this link](Roadmap-Fuel) as well as a comprehensive list of existing features and ones that are in development [here](Dev-Status.md)
12+
There are details of our plans for fuel strategy improvements [at this link](Roadmap-Fuel) as well as a comprehensive list of existing features and ones that are in development [here](Dev-Status)
1313
If your idea does not already appear there then consider making a Github ticket but please have a think if that feature would really add to rusEFI and if it needs to be done ASAP. If not then please tag the ticket as a future feature and low priority.
1414

1515
Most simple questions can be answered by [searching the wiki](HOWTO-Search-on-rusEFI-wiki) or by [searching the forum](https://rusefi.com/forum/search.php)

Debug-Mode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Debug fields is an advanced troubleshooting feature allowing one to monitor the
88

99
In TunerStudio, select "Base Engine Settings -> Debug Mode" and use the gauges from "Debug" category.
1010

11-
See [Debug Fields](Debug-Fields.md)
11+
See [Debug Fields](Debug-Fields)

Dev-Hardware-Guidelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Resistors should be listed like this 100R or 2k2
5858

5959
## PCB design rules
6060

61-
- See [PCB Design Rules](PCB-Design-Rules.md)
61+
- See [PCB Design Rules](PCB-Design-Rules)
6262

6363
---
6464

Discovery-Based-Board-Setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ orange LED: warning: blinking in case of trigger input decoding warning or other
3737

3838
microUSB channel is more sensitive to noise but it's faster
3939

40-
See also [Tunerstudio Connectivity](Tunerstudio-Connectivity.md)
40+
See also [Tunerstudio Connectivity](Tunerstudio-Connectivity)
4141

4242
### Configuration reset
4343

4444
Grounding PD6 resets saved configuration to default state - see [this forum post](http://rusefi.com/forum/viewtopic.php?f=5&t=373&p=9571&hilit=PD6#p9571)
4545

4646
### Board Testing mode
4747

48-
Grounding PB0 enables board testing mode. See [Hardware Test Mode](Hardware-Test-Mode.md)
48+
Grounding PB0 enables board testing mode. See [Hardware Test Mode](Hardware-Test-Mode)

FAQ-Basic-Wiring-and-Connections.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Unipolar stepper valves are not supported by any hardware variants at this time.
5151

5252
### Drive by Wire support
5353

54-
Logic exists in the firmware to control a drive by wire throttle body, including using it to idle. A single H-bridge is required to control a single DBW throttle body. Multiple DBW throttle bodies can be simultaneously controlled as long as sufficient H-bridge drivers exist to control them. A drive by wire pedal (Accelerator Pedal Position / APP) is generally used to provide input from the driver. Want to know more? here is a [HOWTO](HOWTO-electronic-throttle-body) you should read.
54+
Logic exists in the firmware to control a drive by wire throttle body, including using it to idle. A single H-bridge is required to control a single DBW throttle body. Multiple DBW throttle bodies can be simultaneously controlled as long as sufficient H-bridge drivers exist to control them. A drive by wire pedal (Accelerator Pedal Position / APP) is generally used to provide input from the driver. Want to know more? here is a [guide](Electronic-Throttle-Body-Configuration-Guide) you should read.
5555

5656
### Main Relay support
5757

FAQ-Ignition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ There is some information on known smart coils and how to work out if you have a
6666

6767
Great - same as the smart coils, please double check your coils are actually simple coils without built in ignition modules.
6868
You will need to source an external ignition module to go between the ECU and the coils.
69-
These are generally quite cheap and can be found on some cars in the junk yard. We also made our own simple module [here](fix link)
69+
These are generally quite cheap and can be found on some cars in the junk yard. We also made our own simple module [here](https://rusefi.com/forum/viewtopic.php?t=286)
7070

7171
There are some tested Ignition modules on the Ignition components list and some can be found by [**searching the forum.**](https://rusefi.com/forum/search.php)
7272
[List of ignition components](Vault-Of-Ignition-Parts)

0 commit comments

Comments
 (0)