AP_Scription: added CANF logging to Halo6000 EFI driver

allows for easier debugging
This commit is contained in:
Andrew Tridgell 2024-06-07 06:25:44 +10:00
parent 1c5c80d244
commit c783f632c1
2 changed files with 40 additions and 1 deletions

View File

@ -55,7 +55,7 @@ end
local efi_backend = nil
-- Setup EFI Parameters
assert(param:add_table(PARAM_TABLE_KEY, PARAM_TABLE_PREFIX, 6), 'could not add EFI_H6K param table')
assert(param:add_table(PARAM_TABLE_KEY, PARAM_TABLE_PREFIX, 10), 'could not add EFI_H6K param table')
--[[
// @Param: EFI_H6K_ENABLE
@ -102,6 +102,17 @@ local EFI_H6K_TELEM_RT = bind_add_param('TELEM_RT', 4, 2)
--]]
local EFI_H6K_FUELTOT = bind_add_param('FUELTOT', 5, 20)
--[[
// @Param: EFI_H6K_OPTIONS
// @DisplayName: Halo6000 options
// @Description: Halo6000 options
// @Bitmask: 0:LogAllCanPackets
// @User: Standard
--]]
local EFI_H6K_OPTIONS = bind_add_param('OPTIONS', 6, 0)
local OPTION_LOGALLFRAMES = 0x01
if EFI_H6K_ENABLE:get() == 0 then
return
end
@ -121,6 +132,20 @@ if not driver1 then
return
end
local frame_count = 0
--[[
frame logging - can be replayed with Tools/scripts/CAN/CAN_playback.py
--]]
local function log_can_frame(frame)
logger.write("CANF",'Id,DLC,FC,B0,B1,B2,B3,B4,B5,B6,B7','IBIBBBBBBBB',
frame:id(),
frame:dlc(),
frame_count,
frame:data(0), frame:data(1), frame:data(2), frame:data(3),
frame:data(4), frame:data(5), frame:data(6), frame:data(7))
frame_count = frame_count + 1
end
--[[
EFI Engine Object
@ -158,6 +183,10 @@ local function engine_control()
break
end
if EFI_H6K_OPTIONS:get() & OPTION_LOGALLFRAMES ~= 0 then
log_can_frame(frame)
end
-- All Frame IDs for this EFI Engine are in the 11-bit address space
if not frame:isExtended() then
self.handle_packet(frame)

View File

@ -31,6 +31,16 @@ control.
This is the rate in Hz at which NAMED_VALUE_FLOAT messages are used to
send additional telemetry data to the GCS for display to the operator.
## EFI_H6K_FUELTOT
This is the total fuel tank capacity in litres
## EFI_H6K_OPTIONS
This provides additional options. Currently just one option is
available. If you set EFI_H6K_OPTIONS to 1 then all CAN frames will be
logged in the message CANF.
# Operation
This driver should be loaded by placing the lua script in the