diff options
author | Mike Fiore <mfiore@multitech.com> | 2015-12-03 12:15:10 -0600 |
---|---|---|
committer | Mike Fiore <mfiore@multitech.com> | 2015-12-03 12:15:10 -0600 |
commit | c3d181e2c45f8b4ddc6572a9834082413fb91817 (patch) | |
tree | c908d8acc58b7eb71769cfa2bdb81f3a3f866ddd /Mode | |
parent | 2cd88147a991bed2e0e71bbc028078bd15838161 (diff) | |
download | mtdot-box-evb-factory-firmware-c3d181e2c45f8b4ddc6572a9834082413fb91817.tar.gz mtdot-box-evb-factory-firmware-c3d181e2c45f8b4ddc6572a9834082413fb91817.tar.bz2 mtdot-box-evb-factory-firmware-c3d181e2c45f8b4ddc6572a9834082413fb91817.zip |
turn off acks and receive windows for survey data packets, use mDot handle for data rate, power, etc instead of lora handler
Diffstat (limited to 'Mode')
-rw-r--r-- | Mode/ModeJoin.cpp | 6 | ||||
-rw-r--r-- | Mode/ModeSingle.cpp | 34 | ||||
-rw-r--r-- | Mode/ModeSweep.cpp | 32 |
3 files changed, 46 insertions, 26 deletions
diff --git a/Mode/ModeJoin.cpp b/Mode/ModeJoin.cpp index c992eff..9adbd55 100644 --- a/Mode/ModeJoin.cpp +++ b/Mode/ModeJoin.cpp @@ -22,12 +22,12 @@ bool ModeJoin::start() { display(); - _lora->setDataRate(_data_rate); - _lora->setPower(_power); + _dot->setTxDataRate(_data_rate); + _dot->setTxPower(_power); _lora->resetJoinAttempts(); while (! _joined) { - _next_tx = _lora->getNextTx(); + _next_tx = _dot->getNextTxMs(); if (_next_tx) { logInfo("next tx %lu ms", _next_tx); _join.updateStatus("Waiting..."); diff --git a/Mode/ModeSingle.cpp b/Mode/ModeSingle.cpp index bda6e12..ab371fb 100644 --- a/Mode/ModeSingle.cpp +++ b/Mode/ModeSingle.cpp @@ -102,7 +102,7 @@ bool ModeSingle::start() { case show_help: _state = in_progress; _progress.display(); - if (_lora->getNextTx() > 0) + if (_dot->getNextTxMs() > 0) no_channel_ping = true; else send_ping = true; @@ -113,7 +113,7 @@ bool ModeSingle::start() { case success: _state = in_progress; _progress.display(); - if (_lora->getNextTx() > 0) + if (_dot->getNextTxMs() > 0) no_channel_ping = true; else send_ping = true; @@ -123,7 +123,7 @@ bool ModeSingle::start() { case failure: _state = in_progress; _progress.display(); - if (_lora->getNextTx() > 0) + if (_dot->getNextTxMs() > 0) no_channel_ping = true; else send_ping = true; @@ -153,7 +153,7 @@ bool ModeSingle::start() { appendDataFile(_data); if (_send_data) { _state = data; - if (_lora->getNextTx() > 0) + if (_dot->getNextTxMs() > 0) no_channel_data = true; else send_data = true; @@ -226,9 +226,12 @@ bool ModeSingle::start() { break; case data: _state = success; - _success.updateInfo("Data Send Success"); + _success.updateInfo(" "); _success.updateSw1(" Power"); _success.updateSw2("Survey"); + // turn acks and receive windows back on + _dot->setAck(1); + _dot->setTxWait(true); logInfo("data send success"); break; case failure: @@ -250,9 +253,12 @@ bool ModeSingle::start() { break; case data: _state = success; - _success.updateInfo("Data Send Failure"); + _success.updateInfo(" "); _success.updateSw1(" Power"); _success.updateSw2("Survey"); + // turn acks and receive windows back on + _dot->setAck(1); + _dot->setTxWait(true); logInfo("data send failed"); break; case failure: @@ -264,7 +270,7 @@ bool ModeSingle::start() { } if (no_channel_ping) { - uint32_t t = _lora->getNextTx(); + uint32_t t = _dot->getNextTxMs(); if (t > 0) { logInfo("next tx %lu ms", t); _progress.updateCountdown(t / 1000); @@ -275,7 +281,7 @@ bool ModeSingle::start() { } } if (no_channel_data) { - uint32_t t = _lora->getNextTx(); + uint32_t t = _dot->getNextTxMs(); if (t > 0) { logInfo("next tx %lu ms", t); _success.updateCountdown(t / 1000); @@ -288,8 +294,8 @@ bool ModeSingle::start() { if (send_ping) { logInfo("sending ping %s %d", _dot->DataRateStr(_data_rate).c_str(), _power); send_ping = false; - _lora->setDataRate(_data_rate); - _lora->setPower(_power); + _dot->setTxDataRate(_data_rate); + _dot->setTxPower(_power); _lora->ping(); _index++; } @@ -298,8 +304,12 @@ bool ModeSingle::start() { logInfo("sending data %s %d", _dot->DataRateStr(_data_rate).c_str(), _power); send_data = false; _success.updateInfo("Data Sending..."); - _lora->setDataRate(_data_rate); - _lora->setPower(_power); + _dot->setTxDataRate(_data_rate); + _dot->setTxPower(_power); + // we don't care if the server actually gets this packet or not + // we won't retry anyway + _dot->setAck(0); + _dot->setTxWait(false); _lora->send(s_data); } } diff --git a/Mode/ModeSweep.cpp b/Mode/ModeSweep.cpp index 12dbd1e..a0f6595 100644 --- a/Mode/ModeSweep.cpp +++ b/Mode/ModeSweep.cpp @@ -141,7 +141,7 @@ bool ModeSweep::start() { _state = in_progress; _progress.display(); _progress.updateProgress(_survey_current, _survey_total); - if (_lora->getNextTx() > 0) + if (_dot->getNextTxMs() > 0) no_channel_ping = true; else send_ping = true; @@ -159,7 +159,7 @@ bool ModeSweep::start() { _survey_current = 1; _progress.display(); _progress.updateProgress(_survey_current, _survey_total); - if (_lora->getNextTx() > 0) + if (_dot->getNextTxMs() > 0) no_channel_ping = true; else send_ping = true; @@ -190,7 +190,7 @@ bool ModeSweep::start() { appendDataFile(_data); if (_send_data) { _state = data; - if (_lora->getNextTx() > 0) + if (_dot->getNextTxMs() > 0) no_channel_data = true; else send_data = true; @@ -267,9 +267,12 @@ bool ModeSweep::start() { break; case data: _state = success; - _success.updateInfo("Data Send Success"); + _success.updateInfo(" "); _success.updateSw1(" Cancel"); logInfo("data send success"); + // turn acks and receive windows back on + _dot->setAck(1); + _dot->setTxWait(true); _display_timer.start(); break; case failure: @@ -293,9 +296,12 @@ bool ModeSweep::start() { break; case data: _state = success; - _success.updateInfo("Data Send Failure"); + _success.updateInfo(" "); _success.updateSw1(" Cancel"); logInfo("data send failed"); + // turn acks and receive windows back on + _dot->setAck(1); + _dot->setTxWait(true); _display_timer.start(); break; case failure: @@ -331,7 +337,7 @@ bool ModeSweep::start() { } if (no_channel_ping) { - uint32_t t = _lora->getNextTx(); + uint32_t t = _dot->getNextTxMs(); if (t > 0) { logInfo("next tx %lu ms", t); _progress.updateCountdown(t / 1000); @@ -343,7 +349,7 @@ bool ModeSweep::start() { } } if (no_channel_data) { - uint32_t t = _lora->getNextTx(); + uint32_t t = _dot->getNextTxMs(); if (t > 0) { logInfo("next tx %lu ms", t); _success.updateCountdown(t / 1000); @@ -359,8 +365,8 @@ bool ModeSweep::start() { _power = p.second; logInfo("sending ping %s %d", _dot->DataRateStr(_data_rate).c_str(), _power); send_ping = false; - _lora->setDataRate(_data_rate); - _lora->setPower(_power); + _dot->setTxDataRate(_data_rate); + _dot->setTxPower(_power); _lora->ping(); } if (send_data) { @@ -368,8 +374,12 @@ bool ModeSweep::start() { logInfo("sending data %s %d", _dot->DataRateStr(_data_rate).c_str(), _power); send_data = false; _success.updateInfo("Data Sending..."); - _lora->setDataRate(_data_rate); - _lora->setPower(_power); + _dot->setTxDataRate(_data_rate); + _dot->setTxPower(_power); + // we don't care if the server actually gets this packet or not + // we won't retry anyway + _dot->setAck(0); + _dot->setTxWait(false); _lora->send(s_data); } } |