AP_EFI: tidy AP_EFI defines

This commit is contained in:
Peter Barker 2023-03-16 10:05:59 +11:00 committed by Peter Barker
parent e76462f005
commit 593983df7a
8 changed files with 35 additions and 29 deletions

View File

@ -94,17 +94,17 @@ void AP_EFI::init(void)
backend = new AP_EFI_Serial_Lutan(*this); backend = new AP_EFI_Serial_Lutan(*this);
break; break;
case Type::NWPMU: case Type::NWPMU:
#if HAL_EFI_NWPWU_ENABLED #if AP_EFI_NWPWU_ENABLED
backend = new AP_EFI_NWPMU(*this); backend = new AP_EFI_NWPMU(*this);
#endif #endif
break; break;
case Type::DroneCAN: case Type::DroneCAN:
#if HAL_EFI_DRONECAN_ENABLED #if AP_EFI_DRONECAN_ENABLED
backend = new AP_EFI_DroneCAN(*this); backend = new AP_EFI_DroneCAN(*this);
#endif #endif
break; break;
case Type::CurrawongECU: case Type::CurrawongECU:
#if HAL_EFI_CURRAWONG_ECU_ENABLED #if AP_EFI_CURRAWONG_ECU_ENABLED
backend = new AP_EFI_Currawong_ECU(*this); backend = new AP_EFI_Currawong_ECU(*this);
#endif #endif
break; break;

View File

@ -21,7 +21,7 @@
#include "AP_EFI_Currawong_ECU.h" #include "AP_EFI_Currawong_ECU.h"
#if HAL_EFI_CURRAWONG_ECU_ENABLED #if AP_EFI_CURRAWONG_ECU_ENABLED
#include <AP_Param/AP_Param.h> #include <AP_Param/AP_Param.h>
#include <AP_PiccoloCAN/piccolo_protocol/ECUPackets.h> #include <AP_PiccoloCAN/piccolo_protocol/ECUPackets.h>
@ -103,4 +103,4 @@ bool AP_EFI_Currawong_ECU::handle_message(AP_HAL::CANFrame &frame)
return valid; return valid;
} }
#endif // HAL_EFI_CURRAWONG_ECU_ENABLED #endif // AP_EFI_CURRAWONG_ECU_ENABLED

View File

@ -21,15 +21,13 @@
#pragma once #pragma once
#include "AP_EFI_config.h"
#if AP_EFI_CURRAWONG_ECU_ENABLED
#include "AP_EFI.h" #include "AP_EFI.h"
#include "AP_EFI_Backend.h" #include "AP_EFI_Backend.h"
#ifndef HAL_EFI_CURRAWONG_ECU_ENABLED
#define HAL_EFI_CURRAWONG_ECU_ENABLED HAL_MAX_CAN_PROTOCOL_DRIVERS && (BOARD_FLASH_SIZE > 1024)
#endif
#if HAL_EFI_CURRAWONG_ECU_ENABLED
class AP_EFI_Currawong_ECU : public AP_EFI_Backend { class AP_EFI_Currawong_ECU : public AP_EFI_Backend {
public: public:
AP_EFI_Currawong_ECU(AP_EFI &_frontend); AP_EFI_Currawong_ECU(AP_EFI &_frontend);
@ -49,5 +47,5 @@ private:
friend class AP_PiccoloCAN; friend class AP_PiccoloCAN;
}; };
#endif // HAL_EFI_CURRAWONG_ECU_ENABLED #endif // AP_EFI_CURRAWONG_ECU_ENABLED

View File

@ -2,7 +2,7 @@
#include "AP_EFI_DroneCAN.h" #include "AP_EFI_DroneCAN.h"
#if HAL_EFI_DRONECAN_ENABLED #if AP_EFI_DRONECAN_ENABLED
#include <AP_CANManager/AP_CANManager.h> #include <AP_CANManager/AP_CANManager.h>
#include <AP_UAVCAN/AP_UAVCAN.h> #include <AP_UAVCAN/AP_UAVCAN.h>
@ -165,5 +165,5 @@ void AP_EFI_DroneCAN::handle_status(const uavcan::equipment::ice::reciprocating:
copy_to_frontend(); copy_to_frontend();
} }
#endif // HAL_EFI_DRONECAN_ENABLED #endif // AP_EFI_DRONECAN_ENABLED

View File

@ -3,7 +3,7 @@
#include "AP_EFI.h" #include "AP_EFI.h"
#include "AP_EFI_Backend.h" #include "AP_EFI_Backend.h"
#if HAL_EFI_DRONECAN_ENABLED #if AP_EFI_DRONECAN_ENABLED
#include <AP_UAVCAN/AP_UAVCAN.h> #include <AP_UAVCAN/AP_UAVCAN.h>
#include <uavcan/equipment/ice/reciprocating/Status.hpp> #include <uavcan/equipment/ice/reciprocating/Status.hpp>
@ -24,5 +24,5 @@ private:
// singleton for trampoline // singleton for trampoline
static AP_EFI_DroneCAN *driver; static AP_EFI_DroneCAN *driver;
}; };
#endif // HAL_EFI_DRONECAN_ENABLED #endif // AP_EFI_DRONECAN_ENABLED

View File

@ -13,6 +13,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "AP_EFI_config.h"
#if AP_EFI_NWPWU_ENABLED
#include <AP_HAL/AP_HAL.h> #include <AP_HAL/AP_HAL.h>
#include <AP_Common/AP_Common.h> #include <AP_Common/AP_Common.h>
@ -22,8 +26,6 @@
#include "AP_EFI_NWPMU.h" #include "AP_EFI_NWPMU.h"
#if HAL_EFI_NWPWU_ENABLED
extern const AP_HAL::HAL& hal; extern const AP_HAL::HAL& hal;
AP_EFI_NWPMU::AP_EFI_NWPMU(AP_EFI &_frontend) : AP_EFI_NWPMU::AP_EFI_NWPMU(AP_EFI &_frontend) :
@ -131,4 +133,4 @@ void AP_EFI_NWPMU::update()
copy_to_frontend(); copy_to_frontend();
} }
#endif // HAL_EFI_NWPWU_ENABLED #endif // AP_EFI_NWPWU_ENABLED

View File

@ -20,15 +20,12 @@
#pragma once #pragma once
#include "AP_EFI_config.h"
#if AP_EFI_NWPWU_ENABLED
#include "AP_EFI.h" #include "AP_EFI.h"
#include "AP_EFI_Backend.h" #include "AP_EFI_Backend.h"
#include <AP_CANManager/AP_CANSensor.h>
#ifndef HAL_EFI_NWPWU_ENABLED
#define HAL_EFI_NWPWU_ENABLED HAL_MAX_CAN_PROTOCOL_DRIVERS && BOARD_FLASH_SIZE > 1024
#endif
#if HAL_EFI_NWPWU_ENABLED
class AP_EFI_NWPMU : public CANSensor, public AP_EFI_Backend { class AP_EFI_NWPMU : public CANSensor, public AP_EFI_Backend {
public: public:
@ -111,5 +108,5 @@ private:
}; };
}; };
#endif // HAL_EFI_NWPWU_ENABLED #endif // AP_EFI_NWPWU_ENABLED

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <AP_HAL/AP_HAL_Boards.h> #include <AP_HAL/AP_HAL_Boards.h>
#include <AP_CANManager/AP_CANSensor.h>
#ifndef HAL_EFI_ENABLED #ifndef HAL_EFI_ENABLED
#define HAL_EFI_ENABLED !HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024 #define HAL_EFI_ENABLED !HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024
@ -10,8 +11,16 @@
#define AP_EFI_BACKEND_DEFAULT_ENABLED HAL_EFI_ENABLED #define AP_EFI_BACKEND_DEFAULT_ENABLED HAL_EFI_ENABLED
#endif #endif
#ifndef HAL_EFI_DRONECAN_ENABLED #ifndef AP_EFI_CURRAWONG_ECU_ENABLED
#define HAL_EFI_DRONECAN_ENABLED AP_EFI_BACKEND_DEFAULT_ENABLED && HAL_MAX_CAN_PROTOCOL_DRIVERS && BOARD_FLASH_SIZE > 1024 && HAL_CANMANAGER_ENABLED #define AP_EFI_CURRAWONG_ECU_ENABLED AP_EFI_BACKEND_DEFAULT_ENABLED && HAL_MAX_CAN_PROTOCOL_DRIVERS
#endif
#ifndef AP_EFI_DRONECAN_ENABLED
#define AP_EFI_DRONECAN_ENABLED AP_EFI_BACKEND_DEFAULT_ENABLED && HAL_MAX_CAN_PROTOCOL_DRIVERS && HAL_CANMANAGER_ENABLED
#endif
#ifndef AP_EFI_NWPWU_ENABLED
#define AP_EFI_NWPWU_ENABLED AP_EFI_BACKEND_DEFAULT_ENABLED && HAL_MAX_CAN_PROTOCOL_DRIVERS
#endif #endif
#ifndef AP_EFI_SCRIPTING_ENABLED #ifndef AP_EFI_SCRIPTING_ENABLED