print CAN into default script
This commit is contained in:
parent
036b7f1ac1
commit
59d6ff9c99
|
@ -0,0 +1,36 @@
|
|||
strncpy(config->luaScript, R"(
|
||||
|
||||
hexstr = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F" }
|
||||
|
||||
function toHexString(num)
|
||||
if num == 0 then
|
||||
return '0'
|
||||
end
|
||||
|
||||
local result = ""
|
||||
while num > 0 do
|
||||
local n = num % 16
|
||||
result = hexstr[n + 1] ..result
|
||||
num = math.floor(num / 16)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function arrayToString(arr)
|
||||
local str = ""
|
||||
local index = 1
|
||||
while arr[index] ~= nil do
|
||||
str = str.." "..toHexString(arr[index])
|
||||
index = index + 1
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
function printPacket(bus, id, dlc, data)
|
||||
print('Received ' .. arrayToString(data))
|
||||
end
|
||||
|
||||
function onTick()
|
||||
end
|
||||
|
||||
)", efi::size(config->luaScript));
|
|
@ -629,7 +629,7 @@ static void setDefaultEngineConfiguration() {
|
|||
|
||||
engineConfiguration->isEngineControlEnabled = true;
|
||||
#endif // EFI_ENGINE_CONTROL
|
||||
strncpy(config->luaScript, "function onTick()\nend", efi::size(config->luaScript));
|
||||
#include "default_script.lua"
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RESET_SWITCH_PORT
|
||||
|
|
Loading…
Reference in New Issue