From 49dfccbcee10f050459f049ddfa59ed33552100e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 25 May 2018 08:56:15 +1000 Subject: [PATCH] AP_UAVCAN: fixed build of example on px4 --- .../AP_UAVCAN/examples/UAVCAN_sniffer/README.md | 6 +++++- .../examples/UAVCAN_sniffer/UAVCAN_sniffer.cpp | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/libraries/AP_UAVCAN/examples/UAVCAN_sniffer/README.md b/libraries/AP_UAVCAN/examples/UAVCAN_sniffer/README.md index 3d052267a4..44f3e1c5b4 100644 --- a/libraries/AP_UAVCAN/examples/UAVCAN_sniffer/README.md +++ b/libraries/AP_UAVCAN/examples/UAVCAN_sniffer/README.md @@ -4,12 +4,15 @@ be received by another node. To build and upload for a Pixhawk style board run this: - ./waf configure --board fmuv3 +``` + ./waf configure --board fmuv3 ./waf --target examples/UAVCAN_sniffer --upload +``` then connect on the USB console. You will see 1Hz packet stats like this: +``` uavcan.equipment.air_data.StaticPressure: 29 uavcan.equipment.air_data.StaticTemperature: 29 uavcan.equipment.ahrs.MagneticFieldStrength: 20 @@ -18,6 +21,7 @@ uavcan.equipment.gnss.Fix: 10 uavcan.equipment.gnss.Auxiliary: 1 uavcan.equipment.actuator.ArrayCommand: 45 uavcan.equipment.esc.RawCommand: 368 +``` note that the code requires you to add new msg types you want to see. Look for the MSG_CB() and START_CB() macros in the code diff --git a/libraries/AP_UAVCAN/examples/UAVCAN_sniffer/UAVCAN_sniffer.cpp b/libraries/AP_UAVCAN/examples/UAVCAN_sniffer/UAVCAN_sniffer.cpp index ba0749a052..2f1a922bf8 100644 --- a/libraries/AP_UAVCAN/examples/UAVCAN_sniffer/UAVCAN_sniffer.cpp +++ b/libraries/AP_UAVCAN/examples/UAVCAN_sniffer/UAVCAN_sniffer.cpp @@ -4,7 +4,7 @@ #include #include -#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX +#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS #include @@ -301,4 +301,17 @@ void loop(void) AP_HAL_MAIN(); +#else + +#include + +const AP_HAL::HAL& hal = AP_HAL::get_HAL(); + +static void loop() { } +static void setup() +{ + printf("Board not currently supported\n"); +} + +AP_HAL_MAIN(); #endif