MTDOT-BOX-EVB-Factory-Firmware
Dependencies: NCP5623B GpsParser ISL29011 libmDot-mbed5 MTS-Serial MMA845x DOGS102 MPL3115A2
Diff: Mode/ModeSweep.cpp
- Revision:
- 7:a31236c2e75c
- Parent:
- 1:71125aa00e33
- Child:
- 12:05435282f899
--- a/Mode/ModeSweep.cpp Fri Nov 04 22:21:01 2016 +0000 +++ b/Mode/ModeSweep.cpp Fri Nov 04 17:27:05 2016 -0500 @@ -207,8 +207,7 @@ _state = failure; _failure.display(); _failure.updateId(_index); - // mDot::DataRateStr returns format SF_XX - we only want to display the XX part - _failure.updateRate(_dot->DataRateStr(_data_rate).substr(3)); + _failure.updateRate(_dot->DataRateStr(_data_rate).substr(2)); _failure.updatePower(_power); if (_gps_available && _gps->getLockStatus()) { GPSPARSER::latitude lat = _gps->getLatitude(); @@ -262,7 +261,7 @@ } // 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) { @@ -343,8 +342,7 @@ void ModeSweep::displaySuccess() { _success.display(); _success.updateId(_index); - // mDot::DataRateStr returns format SF_XX - we only want to display the XX part - _success.updateRate(_dot->DataRateStr(_data_rate).substr(3)); + _success.updateRate(_dot->DataRateStr(_data_rate).substr(2)); _success.updatePower(_power); _success.updateStats(_link_check_result); if (_gps_available && _gps->getLockStatus()) { @@ -382,24 +380,22 @@ } uint8_t ModeSweep::payloadToRate(uint8_t payload) { - if (_band == mDot::FB_915) { - if (payload <= mDot::MaxLengths_915[mDot::SF_10]) - return mDot::SF_10; - else if (payload <= mDot::MaxLengths_915[mDot::SF_9]) - return mDot::SF_9; - else if (payload <= mDot::MaxLengths_915[mDot::SF_8]) - return mDot::SF_8; + if (_band == mDot::FB_EU868) { + if (payload <= mDot::MaxLengths_868[mDot::DR0]) + return mDot::DR0; + else if (payload <= mDot::MaxLengths_868[mDot::DR3]) + return mDot::DR3; else - return mDot::SF_7; + return mDot::DR6; } else { - if (payload <= mDot::MaxLengths_868[mDot::SF_12]) - return mDot::SF_12; - else if (payload <= mDot::MaxLengths_868[mDot::SF_9]) - return mDot::SF_9; + if (payload <= mDot::MaxLengths_915[mDot::DR0]) + return mDot::DR0; + else if (payload <= mDot::MaxLengths_915[mDot::DR1]) + return mDot::DR1; + else if (payload <= mDot::MaxLengths_915[mDot::DR2]) + return mDot::DR2; else - return mDot::SF_7; + return mDot::DR4; } - - return mDot::SF_7; }