Page 1 of 1
Some E36 scripts
Author Message
Some E36 scripts
Here are a couple scripts I wrote for my E36 M3. Having the speed sensor in the rear diff is handy. Change the constants to suit your diff ratio and tire size of course. Feel free to suggest how to improve them.

###### Code:
setTickRate(10) --10Hz

--virtual channels

--global constants
first = 4.20
second = 2.49
third = 1.66
fourth = 1.24
fifth = 1.00
final = 3.46
tirediameter = 24.7

--global variables
rpm = 0
rpm_diff = 0
speed = 0

rpm_diff = getTimerRpm(1)
speed = rpm_diff*tirediameter*0.002975
speed = speed + 0.5 -- round because 0 prec. truncates
setChannel(speeddiff_id, speed)
end

function updateGear()
rpm = getTimerRpm(0)
local gearErr = 0.15
local gear = 0

if speed > 2 then
ratio = rpm/(rpm_diff*final)
if ((first  - ratio)^2) < (gearErr^2) then gear = 1 end
if ((second - ratio)^2) < (gearErr^2) then gear = 2 end
if ((third  - ratio)^2) < (gearErr^2) then gear = 3 end
if ((fourth - ratio)^2) < (gearErr^2) then gear = 4 end
if ((fifth  - ratio)^2) < (gearErr^2) then gear = 5 end
end
setChannel(gear_id, gear)
end

function onTick()
updateGear()
end

Awesome, I'll add this to the Wiki under the E36 section. Thank you!

_________________
Brent Picasso
Founder, Autosport Labs

_________________
Brent Picasso
Founder, Autosport Labs

cool!

The diff speed signal is on a black w/ white stripe wire and can be found:
Pin 2 on connector X17 to the back of the gauge cluster
Pin 10 on connector X22 on the cruise control module behind the glove box

_________________
Brent Picasso
Founder, Autosport Labs

It should be mentioned in the wiki that it is assumed the differential input attached to the second RPM input.

-bj

Got it.

_________________
Brent Picasso
Founder, Autosport Labs

Hey Brent,

Since the latest software only supports alphanumerica characters for channel names, we should update this script to remove the underscores.

Actually, the latest 1.10.1 beta software supports underscores as well as spaces. That was a change I just made.

_________________
Brent Picasso
Founder, Autosport Labs

Ah that's good. I'm still confused as to whether i can overwrite existing channels or not so i like to put an underscore after all the ones that i make to keep things clear.

You need to define unique channel names. Having duplicate names will cause problems in dashboard and analysis.

In dashboard mode, the duplicate channels will both update the same gauge, causing erroneous readings.
In analysis, data is funneled into a single channel name, so you will have problems importing and displaying data.

Hope this resolves the confusion!

_________________
Brent Picasso
Founder, Autosport Labs

###### brentp wrote:
You need to define unique channel names. Having duplicate names will cause problems in dashboard and analysis.

In dashboard mode, the duplicate channels will both update the same gauge, causing erroneous readings.
In analysis, data is funneled into a single channel name, so you will have problems importing and displaying data.

Hope this resolves the confusion!

Ah, that does help. Is there anyway to delete or rename existing channels? In some ways it would be nice to have no predefined channels, only hardware or virtual channel resources that i could then name myself. But i guess that could get ugly.

For example, I would like to use "Speed" for my speed sensor and not the GPS speed as it is by default.

 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 Page 1 of 1
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou cannot download files in this forum Select a forum Autosport Labs----------------General DiscussionNews and AnnouncementsNew Project Suggestions CAN Devices----------------ShiftX2AnalogX RaceCapture App----------------RaceCapture App Operation and General Q&ARaceCapture App Bug Reporting / Feature Requests CAN bus and OBDII integration----------------CAN mapping discussionOBDII PIDs discussion RaceCapture/Pro | RaceCapture/Apex | PodiumConnect----------------RaceCapture/Pro introductionsRaceCapture/Pro General Q&ASensorsHardware and InstallationLua ScriptingTelemetryBug ReportingFeature Requests RaceCapture/Track----------------RaceCapture/Track IntroductionsRaceCapture/Track OperationRaceCapture/Track InstallationRaceCapture/Track Bug Reporting / Feature Requests Megajolt/E and Megajolt Lite Jr. (MJLJ)----------------Ignition Map LibraryPowered by Megajolt GalleryAssemblyInstallationOperationQ&AFuture UpgradesBug ReportingFixes/Patches/UpdatesHard Rev Limiter