summaryrefslogtreecommitdiff
path: root/Mode
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2015-12-11 10:18:02 -0600
committerMike Fiore <mfiore@multitech.com>2015-12-11 10:18:02 -0600
commitc28f3e07a6320f48476fd4dad5cca0011669e49f (patch)
tree063962dd2197419f62cd2555b8525df89db18ea1 /Mode
parenta1bb849d38853c79285665e702f9425770e74133 (diff)
parent279d4b746cb23dce634c968a86eaab0199f1d4af (diff)
downloadmtdot-box-evb-factory-firmware-c28f3e07a6320f48476fd4dad5cca0011669e49f.tar.gz
mtdot-box-evb-factory-firmware-c28f3e07a6320f48476fd4dad5cca0011669e49f.tar.bz2
mtdot-box-evb-factory-firmware-c28f3e07a6320f48476fd4dad5cca0011669e49f.zip
Merge branch 'link_check'
Conflicts: Layout/LayoutSurveySuccess.cpp Mode/Mode.cpp
Diffstat (limited to 'Mode')
-rw-r--r--Mode/Mode.cpp19
-rw-r--r--Mode/Mode.h4
-rw-r--r--Mode/ModeSingle.cpp10
-rw-r--r--Mode/ModeSweep.cpp10
4 files changed, 21 insertions, 22 deletions
diff --git a/Mode/Mode.cpp b/Mode/Mode.cpp
index 4d5af8a..ef343fd 100644
--- a/Mode/Mode.cpp
+++ b/Mode/Mode.cpp
@@ -94,12 +94,11 @@ bool Mode::appendDataFile(const DataItem& data) {
}
if (data.status) {
- float up_snr = (float)data.ping.up.snr / 10.0;
- float down_snr = (float)data.ping.down.snr / 10.0;
- snprintf(stats_buf, sizeof(stats_buf), "%d,%2.1f,%d,%2.1f",
- abs(data.ping.up.rssi),
- up_snr,
- abs(data.ping.down.rssi),
+ float down_snr = (float)data.link.down.snr / 10.0;
+ snprintf(stats_buf, sizeof(stats_buf), "%d,%d,%d,%2.1f",
+ data.link.up.gateways,
+ data.link.up.dBm,
+ abs(data.link.down.rssi),
down_snr);
}
@@ -140,7 +139,7 @@ void Mode::updateData(DataItem& data, DataType type, bool status) {
data.gps_latitude = _gps->getLatitude();
data.gps_altitude = _gps->getAltitude();
data.gps_time = _gps->getTimestamp();
- data.ping = _ping_result;
+ data.link = _link_check_result;
data.data_rate = _data_rate;
data.power = _power;
}
@@ -240,14 +239,14 @@ std::vector<uint8_t> Mode::formatSurveyData(DataItem& data) {
send_data.clear();
send_data.push_back(0x1D); // key for start of data structure
send_data.push_back(0x1A); // key for uplink QOS + RF Pwr
- convertS.f_s = data.ping.up.rssi;
+ convertS.f_s = data.link.up.gateways;
send_data.push_back(convertS.t_u[1]);
send_data.push_back(convertS.t_u[0]);
- send_data.push_back((data.ping.up.snr/10) & 0xFF);
+ send_data.push_back((data.link.up.dBm) & 0xFF);
send_data.push_back(data.power);
send_data.push_back(0x1B); // key for downlink QOS
- convertS.f_s=data.ping.down.rssi;
+ convertS.f_s=data.link.down.rssi;
send_data.push_back(convertS.t_u[1]);
send_data.push_back(convertS.t_u[0]);
send_data.push_back((data.ping.down.snr/10) & 0xFF);
diff --git a/Mode/Mode.h b/Mode/Mode.h
index e552732..759592a 100644
--- a/Mode/Mode.h
+++ b/Mode/Mode.h
@@ -29,7 +29,7 @@ class Mode {
GPSPARSER::latitude gps_latitude;
int16_t gps_altitude;
struct tm gps_time;
- LoRaHandler::LoRaPing ping;
+ LoRaHandler::LoRaLink link;
uint8_t data_rate;
uint32_t power;
} DataItem;
@@ -75,7 +75,7 @@ class Mode {
uint32_t _next_tx;
ButtonHandler::ButtonEvent _be;
LoRaHandler::LoRaStatus _ls;
- LoRaHandler::LoRaPing _ping_result;
+ LoRaHandler::LoRaLink _link_check_result;
uint8_t _state;
bool _send_data;
bool _gps_available;
diff --git a/Mode/ModeSingle.cpp b/Mode/ModeSingle.cpp
index 105fa16..52f7c21 100644
--- a/Mode/ModeSingle.cpp
+++ b/Mode/ModeSingle.cpp
@@ -129,10 +129,10 @@ bool ModeSingle::start() {
if (e.value.signals & loraSignal) {
_ls = _lora->getStatus();
switch (_ls) {
- case LoRaHandler::ping_success:
+ case LoRaHandler::link_check_success:
switch (_state) {
case in_progress:
- _ping_result = _lora->getPingResults();
+ _link_check_result = _lora->getLinkCheckResults();
displaySuccess();
logInfo("ping successful");
updateData(_data, single, true);
@@ -152,7 +152,7 @@ bool ModeSingle::start() {
}
break;
- case LoRaHandler::ping_failure:
+ case LoRaHandler::link_check_failure:
switch (_state) {
case in_progress:
_state = failure;
@@ -240,7 +240,7 @@ bool ModeSingle::start() {
send_ping = false;
_dot->setTxDataRate(_data_rate);
_dot->setTxPower(_power);
- _lora->ping();
+ _lora->linkCheck();
_index++;
}
if (send_data) {
@@ -277,7 +277,7 @@ void ModeSingle::displaySuccess() {
// mDot::DataRateStr returns format SF_XX - we only want to display the XX part
_success.updateRate(_dot->DataRateStr(_data_rate).substr(3));
_success.updatePower(_power);
- _success.updateStats(_ping_result);
+ _success.updateStats(_link_check_result);
if (_gps_available && _gps->getLockStatus()) {
GPSPARSER::latitude lat = _gps->getLatitude();
GPSPARSER::longitude lon = _gps->getLongitude();
diff --git a/Mode/ModeSweep.cpp b/Mode/ModeSweep.cpp
index 45fdee0..4ccb05e 100644
--- a/Mode/ModeSweep.cpp
+++ b/Mode/ModeSweep.cpp
@@ -162,11 +162,11 @@ bool ModeSweep::start() {
if (e.value.signals & loraSignal) {
_ls = _lora->getStatus();
switch (_ls) {
- case LoRaHandler::ping_success:
+ case LoRaHandler::link_check_success:
switch (_state) {
case in_progress:
_survey_success++;
- _ping_result = _lora->getPingResults();
+ _link_check_result = _lora->getLinkCheckResults();
displaySuccess();
logInfo("ping successful");
updateData(_data, sweep, true);
@@ -186,7 +186,7 @@ bool ModeSweep::start() {
}
break;
- case LoRaHandler::ping_failure:
+ case LoRaHandler::link_check_failure:
switch (_state) {
case in_progress:
_survey_failure++;
@@ -300,7 +300,7 @@ bool ModeSweep::start() {
send_ping = false;
_dot->setTxDataRate(_data_rate);
_dot->setTxPower(_power);
- _lora->ping();
+ _lora->linkCheck();
}
if (send_data) {
std::vector<uint8_t> s_data = formatSurveyData(_data);
@@ -332,7 +332,7 @@ void ModeSweep::displaySuccess() {
// mDot::DataRateStr returns format SF_XX - we only want to display the XX part
_success.updateRate(_dot->DataRateStr(_data_rate).substr(3));
_success.updatePower(_power);
- _success.updateStats(_ping_result);
+ _success.updateStats(_link_check_result);
if (_gps_available && _gps->getLockStatus()) {
GPSPARSER::latitude lat = _gps->getLatitude();
GPSPARSER::longitude lon = _gps->getLongitude();