@@ -85,6 +85,7 @@ bool cliMode = false;
85
85
#include "flight/pid.h"
86
86
#include "flight/servos.h"
87
87
88
+ #include "io/adsb.h"
88
89
#include "io/asyncfatfs/asyncfatfs.h"
89
90
#include "io/beeper.h"
90
91
#include "io/flashfs.h"
@@ -2690,6 +2691,44 @@ static void cliFeature(char *cmdline)
2690
2691
}
2691
2692
}
2692
2693
2694
+ #ifdef USE_ADSB
2695
+ static void cliAdsbVehicles (char * cmdLine )
2696
+ {
2697
+ UNUSED (cmdLine );
2698
+
2699
+ adsbVehicle_t * adsbVehicle ;
2700
+ adsbVehicle_t * adsbTheClosestVehicle = findVehicleClosest ();
2701
+ cliPrintf ("%-10s%-10s%-10s%-10s%-10s%-16s%-16s%-10s%-14s%-10s%-20s\n" , "#" , "callsign" , "icao" , "lat" , "lon" , " alt (m)" , " dist (km)" , "dir" , "vert dist (m)" , "tslc" , "ttl" , "note" );
2702
+
2703
+ for (uint8_t i = 0 ; i < MAX_ADSB_VEHICLES ; i ++ ){
2704
+ adsbVehicle = findVehicle (i );
2705
+ if (adsbVehicle != NULL && adsbVehicle -> ttl > 0 ){
2706
+
2707
+ cliPrintf ("%-10d%-10s%-10d%-10u%-10d%-16f%-16f%-10d%-14f%-10d%-10d%-20s \n" ,
2708
+ i ,
2709
+ adsbVehicle -> vehicleValues .callsign ,
2710
+ adsbVehicle -> vehicleValues .icao ,
2711
+ adsbVehicle -> vehicleValues .lat ,
2712
+ adsbVehicle -> vehicleValues .lon ,
2713
+ (double )CENTIMETERS_TO_METERS (adsbVehicle -> vehicleValues .alt ),
2714
+ (double )CENTIMETERS_TO_METERS (adsbVehicle -> calculatedVehicleValues .dist ) / 1000 ,
2715
+ adsbVehicle -> calculatedVehicleValues .dir ,
2716
+ (double )CENTIMETERS_TO_METERS (adsbVehicle -> calculatedVehicleValues .verticalDistance ),
2717
+ adsbVehicle -> vehicleValues .tslc ,
2718
+ adsbVehicle -> ttl ,
2719
+ adsbTheClosestVehicle != NULL && adsbTheClosestVehicle -> vehicleValues .icao == adsbVehicle -> vehicleValues .icao ? "the closest" : ""
2720
+ );
2721
+ }
2722
+ }
2723
+
2724
+ cliPrintf ("Messages count from device: %d\n" , getAdsbStatus ()-> vehiclesMessagesTotal );
2725
+
2726
+ if (!enviromentOkForCalculatingDistaceBearing ()){
2727
+ cliPrintErrorLine ("No GPS FIX, can't calculate distance and direction" );
2728
+ }
2729
+ }
2730
+ #endif
2731
+
2693
2732
#ifdef USE_BLACKBOX
2694
2733
static void printBlackbox (uint8_t dumpMask , const blackboxConfig_t * config , const blackboxConfig_t * configDefault )
2695
2734
{
@@ -3997,6 +4036,9 @@ const clicmd_t cmdTable[] = {
3997
4036
#if defined(USE_BOOTLOG )
3998
4037
CLI_COMMAND_DEF ("bootlog" , "show boot events" , NULL , cliBootlog ),
3999
4038
#endif
4039
+ #if defined(USE_ADSB )
4040
+ CLI_COMMAND_DEF ("adsb_vehicles" , "the closest vehicle" , NULL , cliAdsbVehicles ),
4041
+ #endif
4000
4042
#ifdef USE_LED_STRIP
4001
4043
CLI_COMMAND_DEF ("color" , "configure colors" , NULL , cliColor ),
4002
4044
CLI_COMMAND_DEF ("mode_color" , "configure mode and special colors" , NULL , cliModeColor ),
0 commit comments