Skip to content

Commit

Permalink
AP_EFI: fixed build on boards without EFI support Currawong and DroneCAN
Browse files Browse the repository at this point in the history
  • Loading branch information
loki077 committed Nov 21, 2023
1 parent df55f0a commit 9a9f5fa
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 22 deletions.
8 changes: 5 additions & 3 deletions libraries/AP_EFI/AP_EFI_Currawong_ECU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
* Author: Reilly Callaway / Currawong Engineering Pty Ltd
*/

#include "AP_EFI_Currawong_ECU.h"
#include "AP_EFI_config.h"


#if HAL_EFI_CURRAWONG_ECU_ENABLED
#if HAL_EFI_ENABLED && HAL_EFI_CURRAWONG_ECU_ENABLED

#include "AP_EFI_Currawong_ECU.h"
#include <AP_Param/AP_Param.h>
#include <AP_PiccoloCAN/piccolo_protocol/ECUPackets.h>
#include <AP_Math/definitions.h>
Expand Down Expand Up @@ -103,4 +105,4 @@ bool AP_EFI_Currawong_ECU::handle_message(AP_HAL::CANFrame &frame)
return valid;
}

#endif // HAL_EFI_CURRAWONG_ECU_ENABLED
#endif // HAL_EFI_CURRAWONG_ECU_ENABLED && HAL_EFI_ENABLED
10 changes: 4 additions & 6 deletions libraries/AP_EFI/AP_EFI_Currawong_ECU.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@

#pragma once

#include "AP_EFI.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
#include "AP_EFI_config.h"

#if HAL_EFI_CURRAWONG_ECU_ENABLED

#include "AP_EFI.h"
#include "AP_EFI_Backend.h"

class AP_EFI_Currawong_ECU : public AP_EFI_Backend {
public:
AP_EFI_Currawong_ECU(AP_EFI &_frontend);
Expand Down
11 changes: 4 additions & 7 deletions libraries/AP_EFI/AP_EFI_DroneCAN.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include <AP_HAL/AP_HAL.h>
#include "AP_EFI_config.h"

#if HAL_EFI_ENABLED
#include "AP_EFI_DroneCAN.h"

#if HAL_EFI_DRONECAN_ENABLED
#if HAL_EFI_ENABLED && HAL_EFI_DRONECAN_ENABLED

#include <AP_HAL/AP_HAL.h>
#include "AP_EFI_DroneCAN.h"
#include <AP_CANManager/AP_CANManager.h>
#include <AP_UAVCAN/AP_UAVCAN.h>

Expand Down Expand Up @@ -167,5 +165,4 @@ void AP_EFI_DroneCAN::handle_status(const uavcan::equipment::ice::reciprocating:
copy_to_frontend();
}

#endif // HAL_EFI_DRONECAN_ENABLED
#endif // HAL_EFI_ENABLED
#endif // HAL_EFI_DRONECAN_ENABLED && HAL_EFI_ENABLED
9 changes: 3 additions & 6 deletions libraries/AP_EFI/AP_EFI_DroneCAN.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#pragma once

#include "AP_EFI.h"
#include "AP_EFI_Backend.h"

#ifndef HAL_EFI_DRONECAN_ENABLED
#define HAL_EFI_DRONECAN_ENABLED HAL_MAX_CAN_PROTOCOL_DRIVERS && BOARD_FLASH_SIZE > 1024 && HAL_CANMANAGER_ENABLED
#endif
#include "AP_EFI_config.h"

#if HAL_EFI_DRONECAN_ENABLED
#include "AP_EFI.h"
#include "AP_EFI_Backend.h"
#include <AP_UAVCAN/AP_UAVCAN.h>
#include <uavcan/equipment/ice/reciprocating/Status.hpp>

Expand Down
28 changes: 28 additions & 0 deletions libraries/AP_EFI/AP_EFI_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,31 @@
#ifndef AP_EFI_THROTTLE_LINEARISATION_ENABLED
#define AP_EFI_THROTTLE_LINEARISATION_ENABLED AP_EFI_SERIAL_HIRTH_ENABLED
#endif

#ifndef HAL_EFI_CURRAWONG_ECU_ENABLED
#define HAL_EFI_CURRAWONG_ECU_ENABLED HAL_MAX_CAN_PROTOCOL_DRIVERS && (BOARD_FLASH_SIZE > 1024)
#endif

#ifndef HAL_EFI_DRONECAN_ENABLED
#define HAL_EFI_DRONECAN_ENABLED HAL_MAX_CAN_PROTOCOL_DRIVERS && BOARD_FLASH_SIZE > 1024 && HAL_CANMANAGER_ENABLED
#endif

#ifndef AP_EFI_MAV_ENABLED
#define AP_EFI_MAV_ENABLED AP_EFI_BACKEND_DEFAULT_ENABLED
#endif

#ifndef AP_EFI_NWPWU_ENABLED
#define AP_EFI_NWPWU_ENABLED AP_EFI_BACKEND_DEFAULT_ENABLED && HAL_MAX_CAN_PROTOCOL_DRIVERS
#endif

#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

0 comments on commit 9a9f5fa

Please sign in to comment.