Skip to content

Instantly share code, notes, and snippets.

Brent Picasso brentpicasso

View GitHub Profile
View racecapture_CAN_loopback.lua
val = 0
-- transmit on CAN1 and receive on CAN2
function onTick()
--transmit value on CAN1
txCAN(0, 1234, 0, {val})
--receive on CAN2
id, e, data = rxCAN(1)
@brentpicasso
brentpicasso / pct_gsum_max_calculator.lua
Created Jun 17, 2019
Percentage of Max Gsum calculator
View pct_gsum_max_calculator.lua
-- Calculates and tracks how much of your maximum grip you are using, in real-time
setTickRate(25)
maxGsumId = addChannel("MaxGsum", 25, 2, -2.0, 2.0)
pctGsumMaxId = addChannel("PctMaxGsum", 25, 0, 0, 100)
maxGsum = 0
function updateGsumStats()
local gsum = getChannel("Gsum")
if gsum ~= nil and gsum > 0 then
@brentpicasso
brentpicasso / shiftx3_controlling_secondary.lua
Last active Apr 16, 2019
ShiftX3 with control of alternate ShiftX2/3
View shiftx3_controlling_secondary.lua
setTickRate(30)
-- Set ShiftX3 configuration parameters with default parameters
-- orientation: 0=normal, 1=inverted (display above LED bar)
-- brightness: 0-100%, 0 = auto brightness
-- can bus: 0=CAN1, 1=CAN2
sxSetConfig(0,0,1)
--create gear channel
gearId = addChannel("Gear", 10, 0, 0, 6)
View ShiftX3_simulator_with_virtual_channels.lua
setTickRate(30)
-- Set ShiftX3 configuration parameters with default parameters
-- orientation: 0=normal, 1=inverted (display above LED bar)
-- brightness: 0-100%, 0 = auto brightness
-- can bus: 0=CAN1, 1=CAN2
sxSetConfig(0,0,1)
--config shift light
sxCfgLinearGraph(0,0,0,10000) --left to right graph, smooth style, 0 - 7000 RPM range
View gist:488a78d8f558c223e1634226dd8f07b6
// Prevent sleep
[NSTimer scheduledTimerWithTimeInterval:2.0 repeats:YES block: ^(NSTimer * _Nonnull timer) {
[UIApplication sharedApplication].idleTimerDisabled = NO;
[UIApplication sharedApplication].idleTimerDisabled = YES;
NSLog(@"idle timer");
}];
NSLog(@"Initializing python");
Py_Initialize();
@brentpicasso
brentpicasso / RaceCapture_simple_Lua_CAN_bus_analyzer.lua
Last active Dec 27, 2018
Simple CAN bus analyzer for RaceCapture using Lua scripting
View RaceCapture_simple_Lua_CAN_bus_analyzer.lua
-- Simple CAN bus analyzer
-- This script is useful for reverse engineering CAN bus data
-- and detecting patterns.
--
-- Up to 100 individual 8 bit channels can be created. Additional channels will not be tracked.
-- CAN bus data will appear in the data stream with the channel name: <CAN ID>_<OFFSET>
-- Once script is running, you can monitor the data under Dashboard / Raw Channels View.
----------------------------------------
--Configuration
@brentpicasso
brentpicasso / ShiftX3_test.lua
Created Oct 10, 2018
Disco lights + 7 segment + button test
View ShiftX3_test.lua
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 Oct 4, 2018
Test virtual channels (EngineTemp and OilTemp)
View test_virtual_channels.lua
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 / RX8_manual_PID_query_engine_temp_fuel_level.lua
Last active Jul 12, 2018
Manual PID query with delay between PIDs to deal with RX8 ecu that cannot process rapid OBDII queries.
View RX8_manual_PID_query_engine_temp_fuel_level.lua
--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 Jun 21, 2018
Predicted time simulator + alternating TimeDelta, for testing UI
View pred_time_simulator_time_delta.lua
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)
You can’t perform that action at this time.