summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Layout/LayoutDemoHelp.cpp28
-rw-r--r--Layout/LayoutDemoHelp.h22
-rw-r--r--Layout/LayoutSingleHelp.cpp26
-rw-r--r--Layout/LayoutSingleHelp.h21
-rw-r--r--Layout/LayoutSweepHelp.cpp26
-rw-r--r--Layout/LayoutSweepHelp.h21
-rw-r--r--main.cpp97
7 files changed, 241 insertions, 0 deletions
diff --git a/Layout/LayoutDemoHelp.cpp b/Layout/LayoutDemoHelp.cpp
new file mode 100644
index 0000000..dab907e
--- /dev/null
+++ b/Layout/LayoutDemoHelp.cpp
@@ -0,0 +1,28 @@
+#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
new file mode 100644
index 0000000..3e20df9
--- /dev/null
+++ b/Layout/LayoutDemoHelp.h
@@ -0,0 +1,22 @@
+#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/LayoutSingleHelp.cpp b/Layout/LayoutSingleHelp.cpp
new file mode 100644
index 0000000..82c4270
--- /dev/null
+++ b/Layout/LayoutSingleHelp.cpp
@@ -0,0 +1,26 @@
+#include "LayoutSingleHelp.h"
+
+LayoutSingleHelp::LayoutSingleHelp(DOGS102* lcd)
+ : Layout(lcd),
+ _lMode(0, 0, "Survey Single"),
+ _lIns1(0, 4, "Hold SW1 any time"),
+ _lIns2(0, 5, "for Main Menu"),
+ _lSw1(11, 7, "DR/PWR"),
+ _lSw2(0, 7, "Survey")
+{}
+
+LayoutSingleHelp::~LayoutSingleHelp() {}
+
+void LayoutSingleHelp::display() {
+ clear();
+ startUpdate();
+
+ writeLabel(_lMode);
+ writeLabel(_lIns1);
+ writeLabel(_lIns2);
+ writeLabel(_lSw1);
+ writeLabel(_lSw2);
+
+ endUpdate();
+}
+
diff --git a/Layout/LayoutSingleHelp.h b/Layout/LayoutSingleHelp.h
new file mode 100644
index 0000000..421bc1c
--- /dev/null
+++ b/Layout/LayoutSingleHelp.h
@@ -0,0 +1,21 @@
+#ifndef __LAYOUTSINGLEHELP_H__
+#define __LAYOUTSINGLEHELP_H__
+
+#include "Layout.h"
+
+class LayoutSingleHelp : public Layout {
+ public:
+ LayoutSingleHelp(DOGS102* lcd);
+ ~LayoutSingleHelp();
+
+ void display();
+
+ private:
+ Label _lMode;
+ Label _lIns1;
+ Label _lIns2;
+ Label _lSw1;
+ Label _lSw2;
+};
+
+#endif
diff --git a/Layout/LayoutSweepHelp.cpp b/Layout/LayoutSweepHelp.cpp
new file mode 100644
index 0000000..eb40013
--- /dev/null
+++ b/Layout/LayoutSweepHelp.cpp
@@ -0,0 +1,26 @@
+#include "LayoutSweepHelp.h"
+
+LayoutSweepHelp::LayoutSweepHelp(DOGS102* lcd)
+ : Layout(lcd),
+ _lMode(0, 0, "Survey Sweep"),
+ _lIns1(0, 4, "Hold SW1 any time"),
+ _lIns2(0, 5, "for Main Menu"),
+ _lSw1(11, 7, "Cancel"),
+ _lSw2(0, 7, "Sweep")
+{}
+
+LayoutSweepHelp::~LayoutSweepHelp() {}
+
+void LayoutSweepHelp::display() {
+ clear();
+ startUpdate();
+
+ writeLabel(_lMode);
+ writeLabel(_lIns1);
+ writeLabel(_lIns2);
+ writeLabel(_lSw1);
+ writeLabel(_lSw2);
+
+ endUpdate();
+}
+
diff --git a/Layout/LayoutSweepHelp.h b/Layout/LayoutSweepHelp.h
new file mode 100644
index 0000000..0ec0e45
--- /dev/null
+++ b/Layout/LayoutSweepHelp.h
@@ -0,0 +1,21 @@
+#ifndef __LAYOUTSWEEPHELP_H__
+#define __LAYOUTSWEEPHELP_H__
+
+#include "Layout.h"
+
+class LayoutSweepHelp : public Layout {
+ public:
+ LayoutSweepHelp(DOGS102* lcd);
+ ~LayoutSweepHelp();
+
+ void display();
+
+ private:
+ Label _lMode;
+ Label _lIns1;
+ Label _lIns2;
+ Label _lSw1;
+ Label _lSw2;
+};
+
+#endif
diff --git a/main.cpp b/main.cpp
index 02cfd5b..fce9e10 100644
--- a/main.cpp
+++ b/main.cpp
@@ -17,6 +17,9 @@
#include "LayoutScrollSelect.h"
#include "LayoutJoin.h"
#include "LayoutConfig.h"
+#include "LayoutDemoHelp.h"
+#include "LayoutSingleHelp.h"
+#include "LayoutSweepHelp.h"
// button header
#include "ButtonHandler.h"
// LoRa header
@@ -49,6 +52,9 @@ Serial debug(USBTX, USBRX);
void mainMenu();
void join();
void configuration();
+void loraDemo();
+void surveySingle();
+void surveySweep();
int main() {
debug.baud(115200);
@@ -125,12 +131,15 @@ void mainMenu() {
if (selected == menu_strings[demo]) {
join();
+ loraDemo();
} else if (selected == menu_strings[config]) {
configuration();
} else if (selected == menu_strings[single]) {
join();
+ surveySingle();
} else if (selected == menu_strings[sweep]) {
join();
+ surveySweep();
}
mode_selected = false;
@@ -262,3 +271,91 @@ void configuration() {
}
}
}
+
+void loraDemo() {
+ LayoutDemoHelp ldh(lcd);
+
+ // clear any stale signals
+ osSignalClear(main_id, buttonSignal | loraSignal);
+
+ ldh.display();
+ logInfo("demo mode");
+
+ while (true) {
+ osEvent e = Thread::signal_wait(buttonSignal);
+ if (e.status == osEventSignal) {
+ ButtonHandler::ButtonEvent ev = buttons->getButtonEvent();
+ switch (ev) {
+ case ButtonHandler::sw1_press:
+ logInfo("trigger TX mode");
+ break;
+ case ButtonHandler::sw2_press:
+ logInfo("interval TX mode");
+ break;
+ case ButtonHandler::sw1_hold:
+ return;
+ default:
+ break;
+ }
+ }
+ }
+}
+
+void surveySingle() {
+ LayoutSingleHelp lsh(lcd);
+
+ // clear any stale signals
+ osSignalClear(main_id, buttonSignal | loraSignal);
+
+ lsh.display();
+ logInfo("survey single mode");
+
+ while (true) {
+ osEvent e = Thread::signal_wait(buttonSignal);
+ if (e.status == osEventSignal) {
+ ButtonHandler::ButtonEvent ev = buttons->getButtonEvent();
+ switch (ev) {
+ case ButtonHandler::sw1_press:
+ logInfo("datarate/power");
+ break;
+ case ButtonHandler::sw2_press:
+ logInfo("start survey");
+ break;
+ case ButtonHandler::sw1_hold:
+ return;
+ default:
+ break;
+ }
+ }
+ }
+}
+
+void surveySweep() {
+ LayoutSweepHelp lsh(lcd);
+
+ // clear any stale signals
+ osSignalClear(main_id, buttonSignal | loraSignal);
+
+ lsh.display();
+ logInfo("survey sweep mode");
+
+ while (true) {
+ osEvent e = Thread::signal_wait(buttonSignal);
+ if (e.status == osEventSignal) {
+ ButtonHandler::ButtonEvent ev = buttons->getButtonEvent();
+ switch (ev) {
+ case ButtonHandler::sw1_press:
+ logInfo("cancel");
+ break;
+ case ButtonHandler::sw2_press:
+ logInfo("start sweep");
+ break;
+ case ButtonHandler::sw1_hold:
+ return;
+ default:
+ break;
+ }
+ }
+ }
+}
+