From a9a7e4f4d239f125c483f5167f5ef2d3def8bc68 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 1 Oct 2022 12:00:11 +1000 Subject: [PATCH] AP_Scripting: delay getting EFI backend allow for AP_EFI startup after scripting --- libraries/AP_Scripting/drivers/EFI_HFE.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libraries/AP_Scripting/drivers/EFI_HFE.lua b/libraries/AP_Scripting/drivers/EFI_HFE.lua index 6f930a8749..65370ed2ba 100644 --- a/libraries/AP_Scripting/drivers/EFI_HFE.lua +++ b/libraries/AP_Scripting/drivers/EFI_HFE.lua @@ -62,11 +62,7 @@ if not driver1 then return end -local efi_backend = efi:get_backend(0) -if not efi_backend then - gcs:send_text(0, string.format("EFI_HFE: Failed to find EFI scripting backend")) - return -end +local efi_backend = nil -- Setup EFI Parameters assert(param:add_table(PARAM_TABLE_KEY, PARAM_TABLE_PREFIX, 5), 'could not add EFI_HFE param table') @@ -270,6 +266,13 @@ local engine1 = engine_control(driver1, 1) function update() now_s = get_time_sec() + if not efi_backend then + efi_backend = efi:get_backend(0) + if not efi_backend then + return + end + end + -- Parse Driver Messages engine1.update_telemetry() engine1.send_throttle()