summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Layout/LayoutDemoHelp.cpp28
-rw-r--r--Layout/LayoutDemoHelp.h22
-rw-r--r--Layout/LayoutHelp.cpp40
-rw-r--r--Layout/LayoutHelp.h28
-rw-r--r--Layout/LayoutJoin.cpp2
-rw-r--r--Mode/Mode.cpp2
-rw-r--r--Mode/Mode.h1
-rw-r--r--Mode/ModeJoin.cpp30
-rw-r--r--Mode/ModeJoin.h2
-rw-r--r--main.cpp26
10 files changed, 105 insertions, 76 deletions
diff --git a/Layout/LayoutDemoHelp.cpp b/Layout/LayoutDemoHelp.cpp
deleted file mode 100644
index dab907e..0000000
--- a/Layout/LayoutDemoHelp.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "LayoutDemoHelp.h"
-
-LayoutDemoHelp::LayoutDemoHelp(DOGS102* lcd)
- : Layout(lcd),
- _lMode(0, 0, "LoRa Demo"),
- _lDesc(0, 1, "Select TX Method"),
- _lIns1(0, 4, "Hold SW1 any time"),
- _lIns2(0, 5, "for Main Menu"),
- _lSw1(10, 7, "Trigger"),
- _lSw2(0, 7, "Interval")
-{}
-
-LayoutDemoHelp::~LayoutDemoHelp() {}
-
-void LayoutDemoHelp::display() {
- clear();
- startUpdate();
-
- writeLabel(_lMode);
- writeLabel(_lDesc);
- writeLabel(_lIns1);
- writeLabel(_lIns2);
- writeLabel(_lSw1);
- writeLabel(_lSw2);
-
- endUpdate();
-}
-
diff --git a/Layout/LayoutDemoHelp.h b/Layout/LayoutDemoHelp.h
deleted file mode 100644
index 3e20df9..0000000
--- a/Layout/LayoutDemoHelp.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef __LAYOUTDEMOHELP_H__
-#define __LAYOUTDEMOHELP_H__
-
-#include "Layout.h"
-
-class LayoutDemoHelp : public Layout {
- public:
- LayoutDemoHelp(DOGS102* lcd);
- ~LayoutDemoHelp();
-
- void display();
-
- private:
- Label _lMode;
- Label _lDesc;
- Label _lIns1;
- Label _lIns2;
- Label _lSw1;
- Label _lSw2;
-};
-
-#endif
diff --git a/Layout/LayoutHelp.cpp b/Layout/LayoutHelp.cpp
new file mode 100644
index 0000000..0e029de
--- /dev/null
+++ b/Layout/LayoutHelp.cpp
@@ -0,0 +1,40 @@
+#include "LayoutHelp.h"
+
+LayoutHelp::LayoutHelp(DOGS102* lcd)
+ : Layout(lcd),
+ _lIns1(0, 4, "Hold SW1 any time"),
+ _lIns2(0, 5, "for Main Menu"),
+ _fMode(0, 0, 17),
+ _fDesc(0, 1, 17),
+ _fSw1(9, 7, 8),
+ _fSw2(0, 7, 8)
+{}
+
+LayoutHelp::~LayoutHelp() {}
+
+void LayoutHelp::display() {
+ clear();
+ startUpdate();
+
+ writeLabel(_lIns1);
+ writeLabel(_lIns2);
+
+ endUpdate();
+}
+
+void LayoutHelp::updateMode(std::string mode) {
+ writeField(_fMode, mode);
+}
+
+void LayoutHelp::updateDescription(std::string description) {
+ writeField(_fDesc, description);
+}
+
+void LayoutHelp::updateSw1(std::string s) {
+ writeField(_fSw1, s);
+}
+
+void LayoutHelp::updateSw2(std::string s) {
+ writeField(_fSw2, s);
+}
+
diff --git a/Layout/LayoutHelp.h b/Layout/LayoutHelp.h
new file mode 100644
index 0000000..58ddf7c
--- /dev/null
+++ b/Layout/LayoutHelp.h
@@ -0,0 +1,28 @@
+#ifndef __LAYOUTHELP_H__
+#define __LAYOUTHELP_H__
+
+#include "Layout.h"
+
+class LayoutHelp : public Layout {
+ public:
+ LayoutHelp(DOGS102* lcd);
+ ~LayoutHelp();
+
+ void display();
+ void updateMode(std::string mode);
+ void updateDescription(std::string description);
+ void updateSw1(std::string s);
+ void updateSw2(std::string s);
+
+ private:
+ Label _lIns1;
+ Label _lIns2;
+
+ Field _fMode;
+ Field _fDesc;
+ Field _fSw1;
+ Field _fSw2;
+
+};
+
+#endif
diff --git a/Layout/LayoutJoin.cpp b/Layout/LayoutJoin.cpp
index 3b67c28..6a2e3be 100644
--- a/Layout/LayoutJoin.cpp
+++ b/Layout/LayoutJoin.cpp
@@ -85,7 +85,7 @@ void LayoutJoin::updateCountdown(uint32_t seconds) {
char buf[16];
size_t size;
- writeField(_fCountdownLabel, "No Free Channel");
+ writeField(_fCountdownLabel, "No Free Channel", true);
size = snprintf(buf, sizeof(buf), "%lu", seconds);
writeField(_fPower, buf, size, true);
}
diff --git a/Mode/Mode.cpp b/Mode/Mode.cpp
index eea6d3c..29b16ca 100644
--- a/Mode/Mode.cpp
+++ b/Mode/Mode.cpp
@@ -1,5 +1,7 @@
#include "Mode.h"
+const char* Mode::_file_name = "SurveyData.txt";
+
Mode::Mode(DOGS102* lcd, ButtonHandler* buttons)
: _lcd(lcd),
_buttons(buttons),
diff --git a/Mode/Mode.h b/Mode/Mode.h
index 1254a9e..ac5d839 100644
--- a/Mode/Mode.h
+++ b/Mode/Mode.h
@@ -42,6 +42,7 @@ class Mode {
ButtonHandler* _buttons;
uint32_t _index;
osThreadId _main_id;
+ static const char* _file_name;
};
#endif
diff --git a/Mode/ModeJoin.cpp b/Mode/ModeJoin.cpp
index acdd407..492f669 100644
--- a/Mode/ModeJoin.cpp
+++ b/Mode/ModeJoin.cpp
@@ -4,7 +4,7 @@
ModeJoin::ModeJoin(DOGS102* lcd, ButtonHandler* buttons, mDot* dot, LoRaHandler* lora, uint8_t band)
: Mode(lcd, buttons),
- _lj(lcd, band),
+ _join(lcd, band),
_dot(dot),
_lora(lora),
_band(band),
@@ -22,22 +22,22 @@ bool ModeJoin::start() {
_joined = false;
_index = 1;
- _lj.display();
- _lj.updateStatus("Joining...");
+ _join.display();
+ _join.updateStatus("Joining...");
if (_dot->getJoinMode() == mDot::MANUAL) {
- _lj.updateId(mts::Text::bin2hexString(_dot->getNetworkId()));
- _lj.updateKey(mts::Text::bin2hexString(_dot->getNetworkKey()));
+ _join.updateId(mts::Text::bin2hexString(_dot->getNetworkId()));
+ _join.updateKey(mts::Text::bin2hexString(_dot->getNetworkKey()));
} else {
- _lj.updateId(_dot->getNetworkName());
- _lj.updateKey(_dot->getNetworkPassphrase());
+ _join.updateId(_dot->getNetworkName());
+ _join.updateKey(_dot->getNetworkPassphrase());
}
if (_band == mDot::FB_915) {
_sub_band = _dot->getFrequencySubBand();
- _lj.updateFsb(_sub_band);
+ _join.updateFsb(_sub_band);
}
// mDot::DataRateStr returns format SF_XX - we only want to display the XX part
- _lj.updateRate(_dot->DataRateStr(_data_rate).substr(3));
- _lj.updatePower(_power);
+ _join.updateRate(_dot->DataRateStr(_data_rate).substr(3));
+ _join.updatePower(_power);
_lora->setDataRate(_data_rate);
_lora->setPower(_power);
@@ -45,10 +45,10 @@ bool ModeJoin::start() {
while (! _joined) {
_next_tx = _lora->getNextTx();
if (_next_tx) {
- _lj.updateCountdown(_next_tx * 1000);
+ _join.updateCountdown(_next_tx * 1000);
} else {
- _lj.updateAttempt(_index++);
- _lj.updateStatus("Joining...");
+ _join.updateAttempt(_index++);
+ _join.updateStatus("Joining...");
_lora->join();
}
@@ -69,8 +69,8 @@ bool ModeJoin::start() {
_ls = _lora->getStatus();
switch (_ls) {
case LoRaHandler::join_success:
- _lj.updateStatus("Join Success!");
- _lj.displayCancel(false);
+ _join.updateStatus("Join Success!");
+ _join.displayCancel(false);
logInfo("joined");
_joined = true;
osDelay(2000);
diff --git a/Mode/ModeJoin.h b/Mode/ModeJoin.h
index 5b88e25..6669ad4 100644
--- a/Mode/ModeJoin.h
+++ b/Mode/ModeJoin.h
@@ -14,7 +14,7 @@ class ModeJoin : public Mode {
bool start();
private:
- LayoutJoin _lj;
+ LayoutJoin _join;
mDot* _dot;
LoRaHandler* _lora;
uint8_t _band;
diff --git a/main.cpp b/main.cpp
index 9b9b165..856127c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -15,9 +15,7 @@
#include "LayoutStartup.h"
#include "LayoutScrollSelect.h"
#include "LayoutConfig.h"
-#include "LayoutDemoHelp.h"
-#include "LayoutSingleHelp.h"
-#include "LayoutSweepHelp.h"
+#include "LayoutHelp.h"
// button header
#include "ButtonHandler.h"
// LoRa header
@@ -190,12 +188,16 @@ void configuration() {
}
void loraDemo() {
- LayoutDemoHelp ldh(lcd);
+ LayoutHelp lh(lcd);
+ lh.display();
+ lh.updateMode("LoRa Demo");
+ lh.updateDescription("Select TX Method");
+ lh.updateSw1(" Trigger");
+ lh.updateSw2("Interval");
// clear any stale signals
osSignalClear(main_id, buttonSignal | loraSignal);
- ldh.display();
logInfo("demo mode");
while (true) {
@@ -219,12 +221,15 @@ void loraDemo() {
}
void surveySingle() {
- LayoutSingleHelp lsh(lcd);
+ LayoutHelp lh(lcd);
+ lh.display();
+ lh.updateMode("Survey Single");
+ lh.updateSw1(" DR/PWR");
+ lh.updateSw2("Survey");
// clear any stale signals
osSignalClear(main_id, buttonSignal | loraSignal);
- lsh.display();
logInfo("survey single mode");
while (true) {
@@ -248,12 +253,15 @@ void surveySingle() {
}
void surveySweep() {
- LayoutSweepHelp lsh(lcd);
+ LayoutHelp lh(lcd);
+ lh.display();
+ lh.updateMode("Survey Sweep");
+ lh.updateSw1(" Cancel");
+ lh.updateSw2("Sweep");
// clear any stale signals
osSignalClear(main_id, buttonSignal | loraSignal);
- lsh.display();
logInfo("survey sweep mode");
while (true) {