From 21ac8d801c976f3578f50cb96ba5f41f652f804d Mon Sep 17 00:00:00 2001 From: Reilly Callaway Date: Tue, 15 Mar 2022 12:12:55 +1100 Subject: [PATCH] AP_EFI: Add ECU density parameter for Currawong fuel flow calculations --- libraries/AP_EFI/AP_EFI.cpp | 10 ++++++++++ libraries/AP_EFI/AP_EFI.h | 2 ++ libraries/AP_EFI/AP_EFI_Backend.cpp | 4 ++++ libraries/AP_EFI/AP_EFI_Backend.h | 1 + 4 files changed, 17 insertions(+) diff --git a/libraries/AP_EFI/AP_EFI.cpp b/libraries/AP_EFI/AP_EFI.cpp index 7583090bf5..476b7e1f9e 100644 --- a/libraries/AP_EFI/AP_EFI.cpp +++ b/libraries/AP_EFI/AP_EFI.cpp @@ -17,10 +17,12 @@ #if HAL_EFI_ENABLED +#define HAL_EFI_CURRAWONG_ECU_ENABLED 1 #include "AP_EFI_Serial_MS.h" #include "AP_EFI_Serial_Lutan.h" #include "AP_EFI_NWPMU.h" #include "AP_EFI_DroneCAN.h" +#include "AP_EFI_Currawong_ECU.h" #include #if HAL_MAX_CAN_PROTOCOL_DRIVERS @@ -53,6 +55,14 @@ const AP_Param::GroupInfo AP_EFI::var_info[] = { // @User: Advanced AP_GROUPINFO("_COEF2", 3, AP_EFI, coef2, 0), + // @Param: ECU_DN + // @DisplayName: ECU Fuel Density + // @Description: Used to calculate fuel consumption + // @Units: kg/m/m/m + // @Range: 0 10000 + // @User: Advanced + AP_GROUPINFO("_ECU_DN", 4, AP_EFI, ecu_dn, 0.), + AP_GROUPEND }; diff --git a/libraries/AP_EFI/AP_EFI.h b/libraries/AP_EFI/AP_EFI.h index 42800264fb..562758d728 100644 --- a/libraries/AP_EFI/AP_EFI.h +++ b/libraries/AP_EFI/AP_EFI.h @@ -98,6 +98,8 @@ protected: AP_Float coef1; AP_Float coef2; + AP_Float ecu_dn; + EFI_State state; private: diff --git a/libraries/AP_EFI/AP_EFI_Backend.cpp b/libraries/AP_EFI/AP_EFI_Backend.cpp index 924830e64a..674f9a3730 100644 --- a/libraries/AP_EFI/AP_EFI_Backend.cpp +++ b/libraries/AP_EFI/AP_EFI_Backend.cpp @@ -47,4 +47,8 @@ HAL_Semaphore &AP_EFI_Backend::get_sem(void) return frontend.sem; } +float AP_EFI_Backend::get_ecu_dn(void) const +{ + return frontend.ecu_dn; +} #endif // HAL_EFI_ENABLED diff --git a/libraries/AP_EFI/AP_EFI_Backend.h b/libraries/AP_EFI/AP_EFI_Backend.h index 0f56205d3b..d2d5ab0b15 100644 --- a/libraries/AP_EFI/AP_EFI_Backend.h +++ b/libraries/AP_EFI/AP_EFI_Backend.h @@ -41,6 +41,7 @@ protected: int8_t get_uavcan_node_id(void) const; float get_coef1(void) const; float get_coef2(void) const; + float get_ecu_dn(void) const; HAL_Semaphore &get_sem(void);