Skip to content

Commit

Permalink
Small cleanup of the RSSI code.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx authored Dec 22, 2016
1 parent 8c0f05c commit 15dd390
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion DMRSlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,13 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len)
uint16_t raw = 0U;
raw |= (data[35U] << 8) & 0xFF00U;
raw |= (data[36U] << 0) & 0x00FFU;

// Convert the raw RSSI to dBm
int rssi = m_rssiMapper->interpolate(raw);
LogDebug("DMR Slot %u, raw RSSI: %u, reported RSSI: %d dBm", m_slotNo, raw, rssi);

// RSSI is always reported as positive
m_rssi = (rssi >= 0) ? rssi : -rssi;
LogDebug("DMR Slot %u, raw RSSI: %u, reported RSSI: -%u dBm", m_slotNo, raw, m_rssi);
}

bool dataSync = (data[1U] & DMR_SYNC_DATA) == DMR_SYNC_DATA;
Expand Down

0 comments on commit 15dd390

Please sign in to comment.