Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adsb enhanced #10298

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/ADSB.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@ All ADSB receivers which can send Mavlink [ADSB_VEHICLE](https://mavlink.io/en/m
* [PINGRX](https://uavionix.com/product/pingrx-pro/) (not tested)
* [TT-SC1](https://www.aerobits.pl/product/aero/) (tested)

## TT-SC1 settings
* download software for ADSB TT-SC1 from https://www.aerobits.pl/product/aero/ , file Micro_ADSB_App-vX.XX.X_win_setup.zip and install it
* connect your ADSB to FC, connect both RX and TX pins
* in INAV configurator ports TAB set telemetry MAVLINK, and baudrate 115200
* go to CLI in inav configurator and set serialpassthrough for port you connected ADSB ```serialpassthrough [PORT_YOU_SELECTED - 1] 115200 rxtx``` and close configurator
* open ADSB program you installed, got to settings and set "telemetry" = MAVLINK,

PCB board for TT-SC1-B module https://oshwlab.com/error414/adsb-power-board
![TT-SC1 settings](Screenshots/ADSB_TTSC01_settings.png)

Binary file added docs/Screenshots/ADSB_TTSC01_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/main/fc/fc_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,8 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
#ifdef USE_ADSB
sbufWriteU8(dst, MAX_ADSB_VEHICLES);
sbufWriteU8(dst, ADSB_CALL_SIGN_MAX_LENGTH);
sbufWriteU32(dst, getAdsbStatus()->vehiclesMessagesTotal);
sbufWriteU32(dst, getAdsbStatus()->heartbeatMessagesTotal);

for(uint8_t i = 0; i < MAX_ADSB_VEHICLES; i++){

Expand All @@ -977,6 +979,8 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
#else
sbufWriteU8(dst, 0);
sbufWriteU8(dst, 0);
sbufWriteU32(dst, 0);
sbufWriteU32(dst, 0);
#endif
break;
case MSP_DEBUG:
Expand Down
6 changes: 6 additions & 0 deletions src/main/io/adsb.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ void gpsDistanceCmBearing(int32_t currentLat1, int32_t currentLon1, int32_t dest
*bearing = wrap_36000(*bearing);
};

bool adsbHeartbeat(void){
adsbVehiclesStatus.heartbeatMessagesTotal++;
return true;
}

void adsbNewVehicle(adsbVehicleValues_t* vehicleValuesLocal) {

// no valid lat lon or altitude
Expand All @@ -139,6 +144,7 @@ void adsbNewVehicle(adsbVehicleValues_t* vehicleValuesLocal) {
}

adsbVehiclesStatus.vehiclesMessagesTotal++;

adsbVehicle_t *vehicle = NULL;

vehicle = findVehicleByIcao(vehicleValuesLocal->icao);
Expand Down
2 changes: 2 additions & 0 deletions src/main/io/adsb.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ typedef struct {

typedef struct {
uint32_t vehiclesMessagesTotal;
uint32_t heartbeatMessagesTotal;
} adsbVehicleStatus_t;

void adsbNewVehicle(adsbVehicleValues_t* vehicleValuesLocal);
bool adsbHeartbeat(void);
adsbVehicle_t * findVehicleClosest(void);
adsbVehicle_t * findVehicle(uint8_t index);
uint8_t getActiveVehiclesCount(void);
Expand Down
2 changes: 1 addition & 1 deletion src/main/io/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2136,7 +2136,7 @@ static bool osdDrawSingleElement(uint8_t item)
case OSD_ADSB_INFO:
{
buff[0] = SYM_ADSB;
if(getAdsbStatus()->vehiclesMessagesTotal > 0){
if(getAdsbStatus()->vehiclesMessagesTotal > 0 || getAdsbStatus()->heartbeatMessagesTotal > 0){
tfp_sprintf(buff + 1, "%2d", getActiveVehiclesCount());
}else{
buff[1] = '-';
Expand Down
18 changes: 17 additions & 1 deletion src/main/telemetry/mavlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,22 @@ static bool handleIncoming_RADIO_STATUS(void) {
return true;
}

static bool handleIncoming_HEARTBEAT(void) {
mavlink_heartbeat_t msg;
mavlink_msg_heartbeat_decode(&mavRecvMsg, &msg);

switch (msg.type) {
#ifdef USE_ADSB
case MAV_TYPE_ADSB:
return adsbHeartbeat();
#endif
default:
break;
}

return false;
}

#ifdef USE_ADSB
static bool handleIncoming_ADSB_VEHICLE(void) {
mavlink_adsb_vehicle_t msg;
Expand Down Expand Up @@ -1188,7 +1204,7 @@ static bool processMAVLinkIncomingTelemetry(void)
if (result == MAVLINK_FRAMING_OK) {
switch (mavRecvMsg.msgid) {
case MAVLINK_MSG_ID_HEARTBEAT:
break;
return handleIncoming_HEARTBEAT();
case MAVLINK_MSG_ID_PARAM_REQUEST_LIST:
return handleIncoming_PARAM_REQUEST_LIST();
case MAVLINK_MSG_ID_MISSION_CLEAR_ALL:
Expand Down
Loading