aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-01-21 00:12:38 +0100
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-01-21 00:24:16 +0100
commit819cad1776e09782fffdf433a2e843fe5720d6c8 (patch)
treed3c009340b8f52e8c7b467e6c005273e9c70d755
parent54a98b5b52fa2b2117a374f186173547dd0b8027 (diff)
Transceiver: fix integer division in addRadioVector()
By default, C/C++ compiler does assume integer division. The lack of explicit cast to 'double' causes the transceiver to ignore non-decimal attenuation values (x % 10 > 0): txFullScale * 10 ^ ( -3 / 10) == txFullScale * 10 ^ 0 == txFullScale * 1.0 txFullScale * 10 ^ ( -8 / 10) == txFullScale * 10 ^ 0 == txFullScale * 1.0 txFullScale * 10 ^ (-10 / 10) == txFullScale * 10 ^ -1 == txFullScale * 0.1 txFullScale * 10 ^ (-18 / 10) == txFullScale * 10 ^ -1 == txFullScale * 0.1 Change-Id: I85b1063f57f630d90c6da32827bec4a05afc6514 Related: SYS#4918
-rw-r--r--Transceiver52M/Transceiver.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 9c93e98..3188c70 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -396,7 +396,7 @@ void Transceiver::addRadioVector(size_t chan, BitVector &bits,
else
burst = modulateBurst(bits, 8 + (wTime.TN() % 4 == 0), cfg->tx_sps);
- scaleVector(*burst, txFullScale * pow(10, -RSSI / 10));
+ scaleVector(*burst, txFullScale * pow(10, (double) -RSSI / 10));
radio_burst = new radioVector(wTime, burst);