Skip to content

Commit

Permalink
Remote ID: misc. cleanup [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Linar Yusupov committed Oct 30, 2023
1 parent 66fec93 commit 643e64b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
12 changes: 6 additions & 6 deletions software/firmware/source/SoftRF/src/driver/Bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,11 @@ void nRF52_Bluetooth_setup()
BT_name += "-";
BT_name += String(SoC->getChipId() & 0x00FFFFFFU, HEX);

#if defined(ENABLE_REMOTE_ID)
rid_init();
RID_Time_Marker = millis();
#endif /* ENABLE_REMOTE_ID */

// Setup the BLE LED to be enabled on CONNECT
// Note: This is actually the default behavior, but provided
// here in case you want to control this LED manually via PIN 19
Expand Down Expand Up @@ -1492,11 +1497,6 @@ void nRF52_Bluetooth_setup()

BLE_Notify_TimeMarker = millis();
BLE_SensBox_TimeMarker = millis();

#if defined(ENABLE_REMOTE_ID)
rid_init();
RID_Time_Marker = millis();
#endif /* ENABLE_REMOTE_ID */
}

/*********************************************************************
Expand Down Expand Up @@ -1530,7 +1530,7 @@ static void nRF52_Bluetooth_loop()

#if defined(ENABLE_REMOTE_ID)
if (rid_enabled() && isValidFix()) {
if ((millis() - RID_Time_Marker) > (RID_TX_INTERVAL_MIN + RID_TX_INTERVAL_MAX)/2) {
if ((millis() - RID_Time_Marker) > 74) {
rid_encode((void *) &utm_data, &ThisAircraft);
squitter.transmit(&utm_data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ bool rid_init() {

if (strlen(RID_Drone_ID) > 0) {
strcpy(utm_parameters.UAV_id, RID_Drone_ID);
utm_parameters.ID_type = ODID_IDTYPE_CAA_REGISTRATION_ID;
} else {
snprintf(utm_parameters.UAV_id, sizeof(utm_parameters.UAV_id), "%08X",
SoC->getChipId());
utm_parameters.ID_type = ODID_IDTYPE_SERIAL_NUMBER;
}

utm_parameters.region = ODID_CLASSIFICATION_TYPE_EU;
Expand Down Expand Up @@ -125,6 +127,11 @@ size_t rid_encode(void *pkt, ufo_t *this_aircraft) {
utm_data.months = (int) gnss.date.month();
utm_data.years = (int) gnss.date.year();

/*
* SATS_LEVEL_1 4
* SATS_LEVEL_2 7
* SATS_LEVEL_3 10
*/
utm_data.satellites = (int) gnss.satellites.value();

return 0;
Expand Down

0 comments on commit 643e64b

Please sign in to comment.