| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | strncpy(config->luaScript, R"( | |||
| 2 | ||||
| 3 | hexstr = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F" } | |||
| 4 | ||||
| 5 | function toHexString(num) | |||
| 6 | if num == 0 then | |||
| 7 | return '0' | |||
| 8 | end | |||
| 9 | ||||
| 10 | local result = "" | |||
| 11 | while num > 0 do | |||
| 12 | local n = num % 16 | |||
| 13 | result = hexstr[n + 1] ..result | |||
| 14 | num = math.floor(num / 16) | |||
| 15 | end | |||
| 16 | return result | |||
| 17 | end | |||
| 18 | ||||
| 19 | function arrayToString(arr) | |||
| 20 | local str = "" | |||
| 21 | local index = 1 | |||
| 22 | while arr[index] ~= nil do | |||
| 23 | str = str.." "..toHexString(arr[index]) | |||
| 24 | index = index + 1 | |||
| 25 | end | |||
| 26 | return str | |||
| 27 | end | |||
| 28 | ||||
| 29 | function printPacket(bus, id, dlc, data) | |||
| 30 | print('Received ' .. arrayToString(data)) | |||
| 31 | end | |||
| 32 | ||||
| 33 | function onCanRx(bus, id, dlc, data) | |||
| 34 | end | |||
| 35 | ||||
| 36 | function onTick() | |||
| 37 | end | |||
| 38 | ||||
| 39 | )", efi::size(config->luaScript)); | |||
| 40 |