From 74279d9b321b4fd58a023c342f36d7c097598a18 Mon Sep 17 00:00:00 2001 From: Bob Long Date: Sun, 1 Jan 2023 11:35:34 -0500 Subject: [PATCH] AP_Scripting: add fuel_pressure_status binding --- libraries/AP_Scripting/docs/docs.lua | 4 ++++ libraries/AP_Scripting/drivers/EFI_HFE.lua | 1 + libraries/AP_Scripting/generator/description/bindings.desc | 1 + 3 files changed, 6 insertions(+) diff --git a/libraries/AP_Scripting/docs/docs.lua b/libraries/AP_Scripting/docs/docs.lua index 7ba9897868..8d3f02918c 100644 --- a/libraries/AP_Scripting/docs/docs.lua +++ b/libraries/AP_Scripting/docs/docs.lua @@ -114,6 +114,10 @@ function EFI_State_ud:fuel_consumption_rate_cm3pm(value) end ---@param value number function EFI_State_ud:fuel_pressure(value) end +-- set field +---@param value integer +function EFI_State_ud:fuel_pressure_status(value) end + -- set field ---@param value number function EFI_State_ud:oil_temperature(value) end diff --git a/libraries/AP_Scripting/drivers/EFI_HFE.lua b/libraries/AP_Scripting/drivers/EFI_HFE.lua index aace6edac3..08a2872414 100644 --- a/libraries/AP_Scripting/drivers/EFI_HFE.lua +++ b/libraries/AP_Scripting/drivers/EFI_HFE.lua @@ -221,6 +221,7 @@ local function engine_control(_driver) efi_state:throttle_position_percent(math.floor((throttle_pos*100/255)+0.5)) efi_state:ignition_voltage(ecu_voltage) efi_state:fuel_pressure(fuel_press*0.001) + efi_state:fuel_pressure_status(1) -- Fuel_Pressure_Status::OK local gram_to_cm3 = EFI_HFE_FUEL_DTY:get() * 0.001 efi_state:fuel_consumption_rate_cm3pm((fuel_flow_gph/60.0) * gram_to_cm3) diff --git a/libraries/AP_Scripting/generator/description/bindings.desc b/libraries/AP_Scripting/generator/description/bindings.desc index 6ed7a89f06..13a7c2f955 100644 --- a/libraries/AP_Scripting/generator/description/bindings.desc +++ b/libraries/AP_Scripting/generator/description/bindings.desc @@ -637,6 +637,7 @@ userdata EFI_State field coolant_temperature float'skip_check write userdata EFI_State field oil_pressure float'skip_check write userdata EFI_State field oil_temperature float'skip_check write userdata EFI_State field fuel_pressure float'skip_check write +userdata EFI_State field fuel_pressure_status Fuel_Pressure_Status'enum write Fuel_Pressure_Status::NOT_SUPPORTED Fuel_Pressure_Status::ABOVE_NOMINAL userdata EFI_State field fuel_consumption_rate_cm3pm float'skip_check write userdata EFI_State field estimated_consumed_fuel_volume_cm3 float'skip_check write userdata EFI_State field throttle_position_percent uint8_t'skip_check write