summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2015-12-01 12:53:50 -0600
committerMike Fiore <mfiore@multitech.com>2015-12-01 12:53:50 -0600
commit1d6a46f52840caf7f1aa5a3605dcfd44c5916731 (patch)
tree40e2f10ecf0734725468c0ae1d610c136d0642a2
parentc9c5c97055b7b1cc66475a03e091f186a4e8faf5 (diff)
downloadmtdot-box-evb-factory-firmware-1d6a46f52840caf7f1aa5a3605dcfd44c5916731.tar.gz
mtdot-box-evb-factory-firmware-1d6a46f52840caf7f1aa5a3605dcfd44c5916731.tar.bz2
mtdot-box-evb-factory-firmware-1d6a46f52840caf7f1aa5a3605dcfd44c5916731.zip
fix bug when generating data rate & power pairs in 868 frequency band
-rw-r--r--Mode/ModeSweep.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/Mode/ModeSweep.cpp b/Mode/ModeSweep.cpp
index 724e35c..c1ebbb9 100644
--- a/Mode/ModeSweep.cpp
+++ b/Mode/ModeSweep.cpp
@@ -393,10 +393,10 @@ std::vector<point> ModeSweep::generatePoints() {
uint8_t min_rate;
uint8_t max_rate;
- min_rate = payloadToRate(_min_payload);
- max_rate = payloadToRate(_max_payload);
+ max_rate = payloadToRate(_min_payload);
+ min_rate = payloadToRate(_max_payload);
- for (uint8_t rate = max_rate; rate >= min_rate; rate--) {
+ for (int rate = min_rate; rate >= max_rate; rate--) {
if (_max_power - _min_power < 4) {
for (uint32_t power = _min_power; power <= _max_power; power++)
p.push_back(std::make_pair(rate, power));
@@ -424,14 +424,8 @@ uint8_t ModeSweep::payloadToRate(uint8_t payload) {
} else {
if (payload <= mDot::MaxLengths_868[mDot::SF_12])
return mDot::SF_12;
- else if (payload <= mDot::MaxLengths_868[mDot::SF_11])
- return mDot::SF_11;
- else if (payload <= mDot::MaxLengths_868[mDot::SF_10])
- return mDot::SF_10;
else if (payload <= mDot::MaxLengths_868[mDot::SF_9])
return mDot::SF_9;
- else if (payload <= mDot::MaxLengths_868[mDot::SF_8])
- return mDot::SF_8;
else
return mDot::SF_7;
}