Skip to content

Commit

Permalink
relocate mac_eq to AP_ODIDScanner to fix some build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoryeh committed Oct 23, 2024
1 parent 1c99d25 commit cbc2f51
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
9 changes: 0 additions & 9 deletions libraries/AP_Avoidance/AP_Avoidance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,6 @@ void AP_Avoidance::add_obstacle(const uint32_t obstacle_timestamp_ms,
}

#if AP_ODIDSCANNER_ENABLED
bool mac_eq(uint8_t a[6], uint8_t b[6]) {
return a[0] == b[0] &&
a[1] == b[1] &&
a[2] == b[2] &&
a[3] == b[3] &&
a[4] == b[4] &&
a[5] == b[5];
}

void AP_Avoidance::add_obstacle(uint32_t obstacle_timestamp_ms,
const MAV_COLLISION_SRC src,
uint8_t src_id[6],
Expand Down
4 changes: 4 additions & 0 deletions libraries/AP_Avoidance/AP_Avoidance.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include <AP_ADSB/AP_ADSB.h>
#include <AP_ODIDScanner/AP_ODIDScanner.h>

#if AP_ODIDSCANNER_ENABLED
extern bool mac_eq(uint8_t a[6], uint8_t b[6]);
#endif

#if HAL_ADSB_ENABLED

#define AP_AVOIDANCE_STATE_RECOVERY_TIME_MS 2000 // we will not downgrade state any faster than this (2 seconds)
Expand Down
9 changes: 9 additions & 0 deletions libraries/AP_ODIDScanner/AP_ODIDScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@

#define VEHICLE_TIMEOUT_MS 30000

bool mac_eq(uint8_t a[6], uint8_t b[6]) {
return a[0] == b[0] &&
a[1] == b[1] &&
a[2] == b[2] &&
a[3] == b[3] &&
a[4] == b[4] &&
a[5] == b[5];
}

// TODO: Random default for mav_port needs fix
AP_ODIDScanner::AP_ODIDScanner() : _mav_port(MAVLINK_PORT) {

Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_ODIDScanner/AP_ODIDScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define VEHICLE_TIMEOUT_MS 30000
#define MAVLINK_PORT 1

extern bool mac_eq(uint8_t a[6], uint8_t b[6]); // From AP_Avoidance
bool mac_eq(uint8_t a[6], uint8_t b[6]);

struct Loc : Location {

Expand Down

0 comments on commit cbc2f51

Please sign in to comment.