summaryrefslogtreecommitdiff
path: root/Mode
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2015-12-14 08:52:56 -0600
committerMike Fiore <mfiore@multitech.com>2015-12-14 08:52:56 -0600
commitfbfccac9e76196a5a42440ca3eae5340e36e8a33 (patch)
tree5b0dc91e858ed1ea0794b5c18038679662ed0748 /Mode
parent0a4f3de5040de014ec5d7d442b803e39d7328fd5 (diff)
downloadmtdot-box-evb-factory-firmware-fbfccac9e76196a5a42440ca3eae5340e36e8a33.tar.gz
mtdot-box-evb-factory-firmware-fbfccac9e76196a5a42440ca3eae5340e36e8a33.tar.bz2
mtdot-box-evb-factory-firmware-fbfccac9e76196a5a42440ca3eae5340e36e8a33.zip
rename *ping* variables to *link_check*, remove some debug comments
Diffstat (limited to 'Mode')
-rw-r--r--Mode/Mode.cpp12
-rw-r--r--Mode/ModeSingle.cpp32
-rw-r--r--Mode/ModeSweep.cpp32
3 files changed, 38 insertions, 38 deletions
diff --git a/Mode/Mode.cpp b/Mode/Mode.cpp
index e20477c..99bcc52 100644
--- a/Mode/Mode.cpp
+++ b/Mode/Mode.cpp
@@ -179,7 +179,7 @@ uint32_t Mode::getIndex(DataType type) {
if (file.fd < 0) {
logError("failed to open survey data file");
} else {
- logInfo("file size %d", file.size);
+ //logInfo("file size %d", file.size);
if (file.size > buf_size) {
read_offset = file.size - buf_size - 1;
read_size = buf_size;
@@ -192,7 +192,7 @@ uint32_t Mode::getIndex(DataType type) {
if (read_offset == 0)
done = true;
- logInfo("reading from index %d, %d bytes", read_offset, read_size);
+ //logInfo("reading from index %d, %d bytes", read_offset, read_size);
if (! _dot->seekUserFile(file, read_offset, SEEK_SET)) {
logError("failed to seek %d/%d", read_offset, file.size);
@@ -204,17 +204,17 @@ uint32_t Mode::getIndex(DataType type) {
logError("failed to read");
return 0;
}
- logInfo("read %d bytes [%s]", ret, buf);
+ //logInfo("read %d bytes [%s]", ret, buf);
bytes_read = file.size - read_offset - 1;
- logInfo("read %d total bytes", bytes_read);
+ //logInfo("read %d total bytes", bytes_read);
// read_size - 1 is the last byte in the buffer
for (current = read_size - 1; current >= 0; current--) {
if ((buf[current] == '\n' && current != read_size - 1) || (current == 0 && bytes_read >= file.size)) {
int test = current;
- logInfo("found potential %d, %c", read_offset + current, buf[test + 1]);
+ //logInfo("found potential %d, %c", read_offset + current, buf[test + 1]);
if (buf[test + 1] == search) {
- logInfo("reading index");
+ //logInfo("reading index");
sscanf(&buf[test + 2], "%ld", &index);
done = true;
break;
diff --git a/Mode/ModeSingle.cpp b/Mode/ModeSingle.cpp
index 52f7c21..8f5e1b8 100644
--- a/Mode/ModeSingle.cpp
+++ b/Mode/ModeSingle.cpp
@@ -15,9 +15,9 @@ ModeSingle::~ModeSingle() {}
bool ModeSingle::start() {
bool data_file = false;
- bool send_ping = false;
+ bool send_link_check = false;
bool send_data = false;
- bool no_channel_ping = false;
+ bool no_channel_link_check = false;
bool no_channel_data = false;
// clear any stale signals
@@ -98,25 +98,25 @@ bool ModeSingle::start() {
_state = in_progress;
_progress.display();
if (_dot->getNextTxMs() > 0)
- no_channel_ping = true;
+ no_channel_link_check = true;
else
- send_ping = true;
+ send_link_check = true;
break;
case success:
_state = in_progress;
_progress.display();
if (_dot->getNextTxMs() > 0)
- no_channel_ping = true;
+ no_channel_link_check = true;
else
- send_ping = true;
+ send_link_check = true;
break;
case failure:
_state = in_progress;
_progress.display();
if (_dot->getNextTxMs() > 0)
- no_channel_ping = true;
+ no_channel_link_check = true;
else
- send_ping = true;
+ send_link_check = true;
break;
}
break;
@@ -134,7 +134,7 @@ bool ModeSingle::start() {
case in_progress:
_link_check_result = _lora->getLinkCheckResults();
displaySuccess();
- logInfo("ping successful");
+ logInfo("link check successful\tMargin %ld\tRSSI %d dBm\tSNR %2.3f", _link_check_result.up.dBm, _link_check_result.down.rssi, (float)_link_check_result.down.snr / 10.0);
updateData(_data, single, true);
appendDataFile(_data);
if (_send_data) {
@@ -175,7 +175,7 @@ bool ModeSingle::start() {
}
_failure.updateSw1(" Power");
_failure.updateSw2("Survey");
- logInfo("ping failed");
+ logInfo("link check failed");
break;
}
break;
@@ -213,15 +213,15 @@ bool ModeSingle::start() {
}
}
- if (no_channel_ping) {
+ if (no_channel_link_check) {
uint32_t t = _dot->getNextTxMs();
if (t > 0) {
logInfo("next tx %lu ms", t);
_progress.updateCountdown(t / 1000);
} else {
_progress.display();
- no_channel_ping = false;
- send_ping = true;
+ no_channel_link_check = false;
+ send_link_check = true;
}
}
if (no_channel_data) {
@@ -235,9 +235,9 @@ bool ModeSingle::start() {
send_data = true;
}
}
- if (send_ping) {
- logInfo("sending ping %s %d", _dot->DataRateStr(_data_rate).c_str(), _power);
- send_ping = false;
+ if (send_link_check) {
+ logInfo("sending link check %s %d", _dot->DataRateStr(_data_rate).c_str(), _power);
+ send_link_check = false;
_dot->setTxDataRate(_data_rate);
_dot->setTxPower(_power);
_lora->linkCheck();
diff --git a/Mode/ModeSweep.cpp b/Mode/ModeSweep.cpp
index 4ccb05e..c7de333 100644
--- a/Mode/ModeSweep.cpp
+++ b/Mode/ModeSweep.cpp
@@ -16,9 +16,9 @@ ModeSweep::~ModeSweep() {}
bool ModeSweep::start() {
bool data_file = false;
- bool send_ping = false;
+ bool send_link_check = false;
bool send_data = false;
- bool no_channel_ping = false;
+ bool no_channel_link_check = false;
bool no_channel_data = false;
// clear any stale signals
@@ -137,9 +137,9 @@ bool ModeSweep::start() {
_progress.display();
_progress.updateProgress(_survey_current, _survey_total);
if (_dot->getNextTxMs() > 0)
- no_channel_ping = true;
+ no_channel_link_check = true;
else
- send_ping = true;
+ send_link_check = true;
break;
case complete:
_state = in_progress;
@@ -147,9 +147,9 @@ bool ModeSweep::start() {
_progress.display();
_progress.updateProgress(_survey_current, _survey_total);
if (_dot->getNextTxMs() > 0)
- no_channel_ping = true;
+ no_channel_link_check = true;
else
- send_ping = true;
+ send_link_check = true;
break;
}
break;
@@ -168,7 +168,7 @@ bool ModeSweep::start() {
_survey_success++;
_link_check_result = _lora->getLinkCheckResults();
displaySuccess();
- logInfo("ping successful");
+ logInfo("link check successful\tMargin %ld\tRSSI %d dBm\tSNR %2.3f", _link_check_result.up.dBm, _link_check_result.down.rssi, (float)_link_check_result.down.snr / 10.0);
updateData(_data, sweep, true);
appendDataFile(_data);
if (_send_data) {
@@ -208,7 +208,7 @@ bool ModeSweep::start() {
_failure.updateSw1(" Cancel");
updateData(_data, sweep, false);
appendDataFile(_data);
- logInfo("ping failed");
+ logInfo("link check failed");
_display_timer.start();
break;
}
@@ -260,16 +260,16 @@ bool ModeSweep::start() {
_survey_success = 0;
_survey_failure = 0;
} else {
- logInfo("starting next ping");
+ logInfo("starting next link check");
_state = in_progress;
_survey_current++;
_progress.display();
_progress.updateProgress(_survey_current, _survey_total);
- no_channel_ping = true;
+ no_channel_link_check = true;
}
}
- if (no_channel_ping) {
+ if (no_channel_link_check) {
uint32_t t = _dot->getNextTxMs();
if (t > 0) {
logInfo("next tx %lu ms", t);
@@ -277,8 +277,8 @@ bool ModeSweep::start() {
} else {
_progress.display();
_progress.updateProgress(_survey_current, _survey_total);
- no_channel_ping = false;
- send_ping = true;
+ no_channel_link_check = false;
+ send_link_check = true;
}
}
if (no_channel_data) {
@@ -292,12 +292,12 @@ bool ModeSweep::start() {
send_data = true;
}
}
- if (send_ping) {
+ if (send_link_check) {
point p = _points[_survey_current - 1];
_data_rate = p.first;
_power = p.second;
- logInfo("sending ping %s %d", _dot->DataRateStr(_data_rate).c_str(), _power);
- send_ping = false;
+ logInfo("sending link check %s %d", _dot->DataRateStr(_data_rate).c_str(), _power);
+ send_link_check = false;
_dot->setTxDataRate(_data_rate);
_dot->setTxPower(_power);
_lora->linkCheck();