Skip to content

Commit

Permalink
Closes #298: Add LPS TDoA synchronization log variable
Browse files Browse the repository at this point in the history
Requires the preprocessor variable LPS_TDOA_SYNCHRONIZATION_VARIABLEto
be declared.
  • Loading branch information
ataffanel committed Feb 25, 2018
1 parent 8a6d392 commit bca69b2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/deck/drivers/src/lpsTdoaTag.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ static struct {

uint32_t nextStatisticsTime;
uint32_t previousStatisticsTime;

uint8_t lastAnchor0Seq;
uint32_t lastAnchor0RxTick;
} stats;

static bool rangingOk;
Expand Down Expand Up @@ -271,6 +274,14 @@ static bool rxcallback(dwDevice_t *dev) {
if (anchor < LOCODECK_NR_OF_TDOA2_ANCHORS) {
const rangePacket_t* packet = (rangePacket_t*)rxPacket.payload;

#ifdef LPS_TDOA_SYNCHRONIZATION_VARIABLE
// Storing timing
if (anchor == 0) {
stats.lastAnchor0Seq = packet->sequenceNrs[anchor];
stats.lastAnchor0RxTick = xTaskGetTickCount();
}
#endif

calcClockCorrection(&history[anchor].clockCorrection_T_To_A, anchor, packet, &arrival);
logClockCorrection[anchor] = history[anchor].clockCorrection_T_To_A;

Expand Down Expand Up @@ -438,4 +449,9 @@ LOG_ADD(LOG_UINT16, stSeq, &stats.packetsSeqNrPassRate)
LOG_ADD(LOG_UINT16, stData, &stats.packetsDataPassRate)
LOG_ADD(LOG_UINT16, stEst, &stats.packetsToEstimatorRate)

#ifdef LPS_TDOA_SYNCHRONIZATION_VARIABLE
LOG_ADD(LOG_UINT8, a0Seq, &stats.lastAnchor0Seq)
LOG_ADD(LOG_UINT32, a0RxTick, &stats.lastAnchor0RxTick)
#endif

LOG_GROUP_STOP(tdoa)

0 comments on commit bca69b2

Please sign in to comment.