Skip to content

Instantly share code, notes, and snippets.

@brentpicasso
brentpicasso / ShiftX3_test.lua
Created October 10, 2018 14:45
Disco lights + 7 segment + button test
sxCan = 1
sxId=0
tickRate=30
sxBright=0
disp = 0
function rndc()
return math.random(0,255)
end
@brentpicasso
brentpicasso / test_virtual_channels.lua
Created October 4, 2018 16:48
Test virtual channels (EngineTemp and OilTemp)
maxEt = 300
maxOt = 300
etId = addChannel("EngineTemp", 10, 0, 0, maxEt)
otId = addChannel("OilTemp", 10, 0, 0, maxOt)
et = 0
ot = 0
setTickRate(50)
function onTick()
et=et+1
@brentpicasso
brentpicasso / SmartyCAM_GPS_mapping.lua
Last active July 26, 2018 16:28
SmartyCAM GPS CAN mapping research
--SmartyCAM GPS channels research
--Latitude / Longitude are confirmed
--GPS Satellite and GPS DOP (dilution of precision) are somewhat confident
--Need GPS lock status
--Need UTC / Timestamp
latId = addChannel('SC_GPSLat', 10, 6, -180, 180)
lonId = addChannel('SC_GPSLon', 10, 6, -180, 180)
gsat1Id = addChannel('SC_GPSSats', 10, 0, 0, 20)
gpsdopId = addChannel('SC_GPSDOP', 10, 0, 0, 10)
@brentpicasso
brentpicasso / RX8_manual_PID_query_engine_temp_fuel_level.lua
Last active July 12, 2018 22:46
Manual PID query with delay between PIDs to deal with RX8 ecu that cannot process rapid OBDII queries.
--Implements a simple OBDII engine in lua scripting, with a configurable delay between PIDs.
-- IMPORTANT: Ensure built-in OBDII is turned off in Setup
--
--500K baud. set your baud rate here.
initCAN(0, 500000)
--standard 11 bit PID request 0x7DF
--extended 29 bit PID request 0x18DB33F1
--standard 11 bit PID response 0x7E8
--extended 29 bit PID response 0x18DAF110
@brentpicasso
brentpicasso / pred_time_simulator_time_delta.lua
Created June 21, 2018 15:25
Predicted time simulator + alternating TimeDelta, for testing UI
setTickRate(2)
delta = 0
dir = 0.05
did = addChannel('TimeDelta2', 50, 2, -10, 10, 'sec')
pid = addChannel('PredTime', 10, 4, 0, 5, 'min')
clid = addChannel('CurrentLap', 50, 0)
lcid = addChannel('LapCount', 50, 0)
@brentpicasso
brentpicasso / manual_OBDII.lua
Last active April 19, 2018 15:19
Manual OBDII query
--Implements a simple OBDII engine in lua scripting, with a configurable delay between PIDs.
-- IMPORTANT: Ensure built-in OBDII is turned off in Setup
--
--500K baud. set your baud rate here.
initCAN(0, 500000)
--standard 11 bit PID request 0x7DF
--extended 29 bit PID request 0x18DB33F1
--standard 11 bit PID response 0x7E8
--extended 29 bit PID response 0x18DAF110
@brentpicasso
brentpicasso / RT_serial_integration.lua
Last active April 5, 2018 17:06
RaceTechnology DL1 serial integration
-----------------------------------------------------------------
--Race Technology Serial Data stream interface for PodiumConnect
--Customize your analog and rpm channels in setup()
--GPS position, altitude, speed, and accelerometer channels
--are built-in
--https://www.race-technology.com/wiki/index.php/General/SerialDataFormat
-----------------------------------------------------------------
--set to true for metric speed and altitude units
metric = false
@brentpicasso
brentpicasso / lapping_simulator_with_pit_stops.lua
Last active November 3, 2017 16:07
Lapping simulator with pit stops
--this script adequately simulates varying speeds and periodic pit stops
--disable all GPS channels
--disable lap timing
dist = 0
speed = 30
speedDir = 0
maxSpeedDir = 2
minSpeedDir = -2
lapCount = 0
currentLap = 1
@brentpicasso
brentpicasso / lap_simulator.lua
Created October 6, 2017 17:49
Lap simulator script. generates laps based on elapsed distance - useful in a non-circuit environment
--Lap simulator script
--Ensure GPS Distance channel is disabled
--Ensure Race Timing is disabled
--Requires a GPS lock for proper operation
--sets the length of the lap desired, in miles.
lapLength = 1
setTickRate(10)
@brentpicasso
brentpicasso / 29_bit_obdii.lua
Created June 30, 2017 00:52
29 bit OBDII simulator
--500K baud. set your baud rate here.
initCAN(0, 500000)
--standard 11 bit PID request 0x7DF
--extended 29 bit PID request 0x18DB33F1
--standard 11 bit PID response 0x7E8
--extended 29 bit PID response 0x18DAF110
standard = false
--this function drains all pending CAN messages