diff --git a/libraries/AP_EFI/AP_EFI.cpp b/libraries/AP_EFI/AP_EFI.cpp
index cd796a82e3..3bd6b542f2 100644
--- a/libraries/AP_EFI/AP_EFI.cpp
+++ b/libraries/AP_EFI/AP_EFI.cpp
@@ -87,12 +87,16 @@ void AP_EFI::init(void)
switch ((Type)type.get()) {
case Type::NONE:
break;
+#if AP_EFI_SERIAL_MS_ENABLED
case Type::MegaSquirt:
backend = new AP_EFI_Serial_MS(*this);
break;
+#endif
+#if AP_EFI_SERIAL_LUTAN_ENABLED
case Type::Lutan:
backend = new AP_EFI_Serial_Lutan(*this);
break;
+#endif
case Type::NWPMU:
#if AP_EFI_NWPWU_ENABLED
backend = new AP_EFI_NWPMU(*this);
diff --git a/libraries/AP_EFI/AP_EFI_Serial_Lutan.cpp b/libraries/AP_EFI/AP_EFI_Serial_Lutan.cpp
index 3812c69abd..c45931478f 100644
--- a/libraries/AP_EFI/AP_EFI_Serial_Lutan.cpp
+++ b/libraries/AP_EFI/AP_EFI_Serial_Lutan.cpp
@@ -12,18 +12,20 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
+
+#include "AP_EFI_config.h"
+
+#if AP_EFI_SERIAL_LUTAN_ENABLED
+
#include
-#include "AP_EFI_Serial_Lutan.h"
#include
-
-#if HAL_EFI_ENABLED
-
-#include
-
#include
#include
+#include "AP_EFI_Serial_Lutan.h"
+
+#include
+
// RPM Threshold for fuel consumption estimator
#define RPM_THRESHOLD 100
@@ -107,4 +109,4 @@ void AP_EFI_Serial_Lutan::send_request(void)
port->write((const uint8_t *)&crc2, sizeof(crc2));
}
-#endif // HAL_EFI_ENABLED
+#endif // AP_EFI_SERIAL_LUTAN_ENABLED
diff --git a/libraries/AP_EFI/AP_EFI_Serial_Lutan.h b/libraries/AP_EFI/AP_EFI_Serial_Lutan.h
index 51832d65b6..0541bef0a4 100644
--- a/libraries/AP_EFI/AP_EFI_Serial_Lutan.h
+++ b/libraries/AP_EFI/AP_EFI_Serial_Lutan.h
@@ -17,6 +17,10 @@
*/
#pragma once
+#include "AP_EFI_config.h"
+
+#if AP_EFI_SERIAL_LUTAN_ENABLED
+
#include "AP_EFI.h"
#include "AP_EFI_Backend.h"
@@ -81,3 +85,5 @@ private:
uint32_t last_request_ms;
uint32_t last_recv_ms;
};
+
+#endif // AP_EFI_SERIAL_LUTAN_ENABLED
diff --git a/libraries/AP_EFI/AP_EFI_Serial_MS.cpp b/libraries/AP_EFI/AP_EFI_Serial_MS.cpp
index d5e144e654..9ddbafc1ee 100644
--- a/libraries/AP_EFI/AP_EFI_Serial_MS.cpp
+++ b/libraries/AP_EFI/AP_EFI_Serial_MS.cpp
@@ -12,14 +12,17 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
-#include
-#include "AP_EFI_Serial_MS.h"
-#if HAL_EFI_ENABLED
+#include "AP_EFI_config.h"
+
+#if AP_EFI_SERIAL_MS_ENABLED
+
+#include
#include
#include
+#include "AP_EFI_Serial_MS.h"
+
extern const AP_HAL::HAL &hal;
AP_EFI_Serial_MS::AP_EFI_Serial_MS(AP_EFI &_frontend):
@@ -230,4 +233,4 @@ uint32_t AP_EFI_Serial_MS::CRC32_compute_byte(uint32_t crc, uint8_t data)
return crc;
}
-#endif // HAL_EFI_ENABLED
+#endif // AP_EFI_SERIAL_MS_ENABLED
diff --git a/libraries/AP_EFI/AP_EFI_Serial_MS.h b/libraries/AP_EFI/AP_EFI_Serial_MS.h
index f72701d3b6..533d2dab93 100644
--- a/libraries/AP_EFI/AP_EFI_Serial_MS.h
+++ b/libraries/AP_EFI/AP_EFI_Serial_MS.h
@@ -14,6 +14,10 @@
*/
#pragma once
+#include "AP_EFI_config.h"
+
+#if AP_EFI_SERIAL_MS_ENABLED
+
#include "AP_EFI.h"
#include "AP_EFI_Backend.h"
@@ -108,3 +112,5 @@ private:
RT_LAST_OFFSET = FUEL_PRESSURE_LSB
};
};
+
+#endif // AP_EFI_SERIAL_MS_ENABLED
diff --git a/libraries/AP_EFI/AP_EFI_config.h b/libraries/AP_EFI/AP_EFI_config.h
index d54e71c5eb..29f07638f7 100644
--- a/libraries/AP_EFI/AP_EFI_config.h
+++ b/libraries/AP_EFI/AP_EFI_config.h
@@ -26,3 +26,11 @@
#ifndef AP_EFI_SCRIPTING_ENABLED
#define AP_EFI_SCRIPTING_ENABLED (AP_EFI_BACKEND_DEFAULT_ENABLED && AP_SCRIPTING_ENABLED)
#endif
+
+#ifndef AP_EFI_SERIAL_MS_ENABLED
+#define AP_EFI_SERIAL_MS_ENABLED AP_EFI_BACKEND_DEFAULT_ENABLED
+#endif
+
+#ifndef AP_EFI_SERIAL_LUTAN_ENABLED
+#define AP_EFI_SERIAL_LUTAN_ENABLED AP_EFI_BACKEND_DEFAULT_ENABLED
+#endif