From d870873c250d27c214f49480401208e50a9cc330 Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Mon, 3 Oct 2016 13:11:24 -0500 Subject: Update to support AU915 --- Layout/LayoutJoin.cpp | 2 +- Layout/LayoutSemtech.cpp | 18 +++++++++++------- Layout/LayoutSemtechJoin.cpp | 14 +++++++------- Layout/LayoutSurveyGps.cpp | 4 ++-- Mode/ModeDemo.cpp | 5 +++-- Mode/ModeGps.cpp | 2 +- Mode/ModeJoin.cpp | 2 +- Mode/ModeSweep.cpp | 4 ++-- 8 files changed, 28 insertions(+), 23 deletions(-) diff --git a/Layout/LayoutJoin.cpp b/Layout/LayoutJoin.cpp index a0ec1ee..fd45d50 100644 --- a/Layout/LayoutJoin.cpp +++ b/Layout/LayoutJoin.cpp @@ -47,7 +47,7 @@ void LayoutJoin::display() { writeLabel(_lId); writeLabel(_lKey); - if (_band == mDot::FB_915) { + if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) { writeLabel(_lFsb); } writeLabel(_lRate); diff --git a/Layout/LayoutSemtech.cpp b/Layout/LayoutSemtech.cpp index e31d149..28e15cf 100644 --- a/Layout/LayoutSemtech.cpp +++ b/Layout/LayoutSemtech.cpp @@ -69,9 +69,11 @@ void LayoutSemtech::display(bool success, mDot::snr_stats snr, mDot::rssi_stats writeLabel(_lTemp); writeLabel(_lPower); writeLabel(_lPadding); - if (_band == mDot::FB_915) { - writeLabel(_lFSB); + + if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) { + writeLabel(_lFSB); } + if(success) { size = snprintf(buf, sizeof(buf), "DWN %3d dbm", rssi.last); writeField(_fDownRssi, buf, size); @@ -79,7 +81,9 @@ void LayoutSemtech::display(bool success, mDot::snr_stats snr, mDot::rssi_stats memset(buf, 0, sizeof(buf)); size = snprintf(buf, sizeof(buf), " %2.1f", (float)snr.last / 10.0); writeField(_fDownSnr, buf, size); - } else writeLabel(_lNoLink); + } else { + writeLabel(_lNoLink); + } memset(buf, 0, sizeof(buf)); size = snprintf(buf, sizeof(buf), "%d",dr); @@ -89,10 +93,10 @@ void LayoutSemtech::display(bool success, mDot::snr_stats snr, mDot::rssi_stats size = snprintf(buf, sizeof(buf), "%d",power); writeField(_fPower, buf, size, true); - if (_band == mDot::FB_915) { - memset(buf, 0, sizeof(buf)); - size = snprintf(buf, sizeof(buf), "%d",fsb); - writeField(_fFSB, buf, size, true); + if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) { + memset(buf, 0, sizeof(buf)); + size = snprintf(buf, sizeof(buf), "%d",fsb); + writeField(_fFSB, buf, size, true); } memset(buf, 0, sizeof(buf)); diff --git a/Layout/LayoutSemtechJoin.cpp b/Layout/LayoutSemtechJoin.cpp index 7bb7ac0..6b9143d 100644 --- a/Layout/LayoutSemtechJoin.cpp +++ b/Layout/LayoutSemtechJoin.cpp @@ -45,7 +45,7 @@ void LayoutSemtechJoin::display() writeLabel(_lId); writeLabel(_lKey); - if (_band == mDot::FB_915) { + if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) { writeLabel(_lFsb); } writeLabel(_lRate); @@ -67,12 +67,12 @@ void LayoutSemtechJoin::updateKey(std::string key) void LayoutSemtechJoin::updateFsb(uint8_t band) { - if (_band == mDot::FB_915) { - char buf[8]; - size_t size; - size = snprintf(buf, sizeof(buf), "%u", band); - writeField(_fFsb, buf, size, true); - writeField(_fSubBand, buf, size, true); + if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) { + char buf[8]; + size_t size; + size = snprintf(buf, sizeof(buf), "%u", band); + writeField(_fFsb, buf, size, true); + writeField(_fSubBand, buf, size, true); } } diff --git a/Layout/LayoutSurveyGps.cpp b/Layout/LayoutSurveyGps.cpp index 2630566..9ef191d 100644 --- a/Layout/LayoutSurveyGps.cpp +++ b/Layout/LayoutSurveyGps.cpp @@ -58,7 +58,7 @@ void LayoutSurveyGps::display(bool success, mDot::snr_stats snr, mDot::rssi_stat writeLabel(_lPower); writeLabel(_lPadding); - if (_band == mDot::FB_915) { + if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) { writeLabel(_lFSB); } if(success) { @@ -80,7 +80,7 @@ void LayoutSurveyGps::display(bool success, mDot::snr_stats snr, mDot::rssi_stat size = snprintf(buf, sizeof(buf), "%d", power); writeField(_fPower, buf, size, true); - if (_band == mDot::FB_915) { + if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) { memset(buf, 0, sizeof(buf)); size = snprintf(buf, sizeof(buf), "%d", fsb); writeField(_fFSB, buf, size, true); diff --git a/Mode/ModeDemo.cpp b/Mode/ModeDemo.cpp index 4add135..f32e03c 100644 --- a/Mode/ModeDemo.cpp +++ b/Mode/ModeDemo.cpp @@ -41,7 +41,7 @@ bool ModeDemo::start() { _initial_data_rate = _dot->getTxDataRate(); // use configured data rate and power if possible - if (_band == mDot::FB_915 && _initial_data_rate == mDot::DR0) { + if ((_band == mDot::FB_US915 || _band == mDot::FB_AU915) && _initial_data_rate == mDot::DR0) { logInfo("using DR1 instead of DR0 - DR0 max packet size is too small for data"); _dot->setTxDataRate(mDot::DR1); } @@ -103,8 +103,9 @@ bool ModeDemo::start() { case ButtonHandler::sw1_hold: _send_timer.stop(); _send_timer.reset(); - if (_band == mDot::FB_915) + if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) { _dot->setTxDataRate(_initial_data_rate); + } return true; } } diff --git a/Mode/ModeGps.cpp b/Mode/ModeGps.cpp index 47053cb..58b2b1f 100644 --- a/Mode/ModeGps.cpp +++ b/Mode/ModeGps.cpp @@ -67,7 +67,7 @@ void ModeGps::init(){ void ModeGps::drIncrement(){ _data_rate++; - if (_data_rate > mDot::DR3 && _band == mDot::FB_915 || _data_rate > mDot::DR5) { + if ((_data_rate > mDot::DR3 && (_band == mDot::FB_US915 || _band == mDot::FB_AU915)) || _data_rate > mDot::DR5) { _drAll = true; _data_rate = 0; } diff --git a/Mode/ModeJoin.cpp b/Mode/ModeJoin.cpp index 3a86dd9..62ac25d 100644 --- a/Mode/ModeJoin.cpp +++ b/Mode/ModeJoin.cpp @@ -119,7 +119,7 @@ void ModeJoin::display() { _join.updateId(_dot->getNetworkName()); _join.updateKey(_dot->getNetworkPassphrase()); } - if (_band == mDot::FB_915) { + if (_band == mDot::FB_US915 || _band == mDot::FB_AU915) { _sub_band = _dot->getFrequencySubBand(); _join.updateFsb(_sub_band); } diff --git a/Mode/ModeSweep.cpp b/Mode/ModeSweep.cpp index b6bef24..c6de7ba 100644 --- a/Mode/ModeSweep.cpp +++ b/Mode/ModeSweep.cpp @@ -261,7 +261,7 @@ bool ModeSweep::start() { } // wait 5s in EU mode to compensate for potential "no free channel" situations on server - if ((_band == mDot::FB_915 && _display_timer.read_ms() > 2000) || _display_timer.read_ms() > 5000) { + if ((_band != mDot::FB_EU868 && _display_timer.read_ms() > 2000) || _display_timer.read_ms() > 5000) { _display_timer.stop(); _display_timer.reset(); if (_survey_current == _survey_total) { @@ -380,7 +380,7 @@ std::vector ModeSweep::generatePoints() { } uint8_t ModeSweep::payloadToRate(uint8_t payload) { - if (_band == mDot::FB_915) { + if (_band != mDot::FB_EU868) { if (payload <= mDot::MaxLengths_915[mDot::DR0]) return mDot::DR0; else if (payload <= mDot::MaxLengths_915[mDot::DR1]) -- cgit v1.2.3