Updated to libmDot 1.0.8-1
Dependencies: DOGS102 GpsParser ISL29011 MMA845x MPL3115A2 MTS-Serial NCP5623B libmDot mbed-rtos mbed
Fork of MTDOT-BOX-EVB-Factory-Firmware by
Diff: Mode/ModeSingle.cpp
- Revision:
- 6:ab581c4260e7
- Parent:
- 1:71125aa00e33
--- a/Mode/ModeSingle.cpp Mon Jul 11 14:06:36 2016 +0000 +++ b/Mode/ModeSingle.cpp Wed Jul 13 19:14:04 2016 +0000 @@ -176,8 +176,8 @@ _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)); + // mDot::DataRateStr returns format DRXX - we only want to display the XX part + _failure.updateRate(_dot->DataRateStr(_data_rate).substr(2)); updateData(_data, single, false); appendDataFile(_data); _failure.updatePower(_power); @@ -291,7 +291,7 @@ _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()) { @@ -312,7 +312,7 @@ size_t size; msg += "DR="; - msg += _dot->DataRateStr(_data_rate).substr(3); + msg += _dot->DataRateStr(_data_rate).substr(2); msg += " P="; size = snprintf(buf, sizeof(buf), "%u", _power); msg.append(buf, size); @@ -323,28 +323,9 @@ void ModeSingle::incrementRatePower() { if (_power == 20) { _power = 2; - switch (_data_rate) { - case mDot::SF_7: - _data_rate = mDot::SF_8; - break; - case mDot::SF_8: - _data_rate = mDot::SF_9; - break; - case mDot::SF_9: - _data_rate = mDot::SF_10; - break; - case mDot::SF_10: - if (_band == mDot::FB_915) - _data_rate = mDot::SF_7; - else - _data_rate = mDot::SF_11; - break; - case mDot::SF_11: - _data_rate = mDot::SF_12; - break; - case mDot::SF_12: - _data_rate = mDot::SF_7; - break; + _data_rate++; + if (_band == mDot::FB_915 && _data_rate > mDot::DR4 || _band == mDot::FB_868 && _data_rate > mDot::DR7) { + _data_rate = mDot::DR0; } } else { _power += 3;