Last active
August 29, 2015 14:17
-
-
Save jesseproudman/044a2dde9e6a6ee7638c to your computer and use it in GitHub Desktop.
P1302.lua
This file contains hidden or 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
-- Add data channel to log misfire count | |
channel = addChannel("Misfire Count", 1) | |
misfire_count = 0 | |
-- Sample every 1/2 second | |
setTickRate(2) | |
function onTick() | |
-- Request the trouble codes | |
data = readOBD2(03) | |
if data ~= nil then | |
-- Debugging line... Remove when functional. | |
println("ODB Output:" .. data) | |
-- According to... http://en.wikipedia.org/wiki/OBD-II_PIDs--Mode_3_.28no_PID_required.29 | |
-- P1302 should translate to: 0001001100000010 | |
if string.find(data, "0001001100000010") then | |
-- P1302 is lit. Log it... | |
println("ODB-II Code P1302 Found, Cycling Codes. Full code output is:"... data) | |
-- And clear the codes... Forget you Limp mode! BUahahahahah | |
txCAN(0, 1, 0, 04) | |
-- Increment misfire count | |
misfire_count += 1 | |
setChannel(channel, misfire_count) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment