This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--This script broadcasts current GPS and IMU channels over CAN | |
setTickRate(20) | |
function sendCAN(can, id, data) | |
local res = txCAN(can, id, 0, data,100) | |
if res == 0 then println('send CAN res ' ..res) end | |
end | |
function split32(val) | |
return bit.band(val, 0xFF), bit.band(bit.rshift(val,8), 0xFF), bit.band(bit.rshift(val,16),0xFF),bit.band(bit.rshift(val,24),0xFF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Note, If 2.10.2 firmware, AccelX and AccelY need to be inverted in the RCP configuration. | |
tires = 4 | |
tireZones = 4 | |
tirePrefixes = {'TireTmpLF', 'TireTmpRF', 'TireTmpLR', 'TireTmpRR'} | |
tireValues = {} | |
tireIds = {} | |
minTireVal = 0 | |
maxTireVal = 300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--This example configured for E46 CAN | |
-- Automatically starts logging with engine 'on' (RPM triggered) | |
--how frequently we poll for CAN messages | |
tickRate = 30 | |
--the CAN baud rate | |
CAN_baud = 500000 | |
--CAN channel to listen on. 0=first CAN channel, 1=second | |
CAN_chan = 0 | |
--add your virtual channels here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Note, If 2.10.2 firmware, AccelX and AccelY need to be inverted in the RCP configuration. | |
tires = 4 | |
tireZones = 4 | |
tirePrefixes = {'TireTmpLF', 'TireTmpRF', 'TireTmpLR', 'TireTmpRR'} | |
tireValues = {} | |
tireIds = {} | |
minTireVal = 0 | |
maxTireVal = 300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); |
NewerOlder