* refactored UITask from repeater/room/sensor to /helpers/ui/server
* added BaseUITask for common behaviours * ui_task now instantiated in one of the variant's target-*.cpp modules
This commit is contained in:
1 parent
f8476f94f2
commit
0b38bfd81a
20 files changed
+117
-363
No files matched your search
@@ -74,8 +74,6 @@ struct NeighbourInfo {
|
|||||||
#define FIRMWARE_VERSION "v1.18.0"
|
#define FIRMWARE_VERSION "v1.18.0"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FIRMWARE_ROLE "repeater"
|
|
||||||
|
|
||||||
#define PACKET_LOG_FILE "/packet_log"
|
#define PACKET_LOG_FILE "/packet_log"
|
||||||
|
|
||||||
class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
|
class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
|
||||||
@@ -189,7 +187,7 @@ public:
|
|||||||
void sendNodeDiscoverReq();
|
void sendNodeDiscoverReq();
|
||||||
const char* getFirmwareVer() override { return FIRMWARE_VERSION; }
|
const char* getFirmwareVer() override { return FIRMWARE_VERSION; }
|
||||||
const char* getBuildDate() override { return FIRMWARE_BUILD_DATE; }
|
const char* getBuildDate() override { return FIRMWARE_BUILD_DATE; }
|
||||||
const char* getRole() override { return FIRMWARE_ROLE; }
|
const char* getRole() override { return "repeater"; }
|
||||||
const char* getNodeName() { return _prefs.node_name; }
|
const char* getNodeName() { return _prefs.node_name; }
|
||||||
NodePrefs* getNodePrefs() {
|
NodePrefs* getNodePrefs() {
|
||||||
return &_prefs;
|
return &_prefs;
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <helpers/ui/DisplayDriver.h>
|
|
||||||
#include <helpers/CommonCLI.h>
|
|
||||||
|
|
||||||
class UITask {
|
|
||||||
mesh::MainBoard* _board;
|
|
||||||
DisplayDriver* _display;
|
|
||||||
unsigned long _next_read, _next_refresh, _auto_off;
|
|
||||||
int _prevBtnState;
|
|
||||||
NodePrefs* _node_prefs;
|
|
||||||
char _version_info[32];
|
|
||||||
unsigned long _powering_off_at = 0;
|
|
||||||
unsigned long _started_at = 0;
|
|
||||||
|
|
||||||
void renderCurrScreen();
|
|
||||||
public:
|
|
||||||
UITask(mesh::MainBoard& board, DisplayDriver& display) : _board(&board), _display(&display) { _next_read = _next_refresh = 0; }
|
|
||||||
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version);
|
|
||||||
|
|
||||||
void loop();
|
|
||||||
};
|
|
||||||
@@ -3,11 +3,6 @@
|
|||||||
|
|
||||||
#include "MyMesh.h"
|
#include "MyMesh.h"
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
|
||||||
#include "UITask.h"
|
|
||||||
static UITask ui_task(board, display);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ETHERNET_ENABLED
|
#ifdef ETHERNET_ENABLED
|
||||||
#define ETHERNET_CLI_BANNER "MeshCore Repeater CLI"
|
#define ETHERNET_CLI_BANNER "MeshCore Repeater CLI"
|
||||||
#include <helpers/nrf52/EthernetCLI.h>
|
#include <helpers/nrf52/EthernetCLI.h>
|
||||||
@@ -107,7 +102,7 @@ void setup() {
|
|||||||
the_mesh.begin(fs);
|
the_mesh.begin(fs);
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION, "< Repeater >");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ETHERNET_ENABLED
|
#ifdef ETHERNET_ENABLED
|
||||||
|
|||||||
@@ -77,8 +77,6 @@
|
|||||||
#define TXT_ACK_DELAY 200
|
#define TXT_ACK_DELAY 200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FIRMWARE_ROLE "room_server"
|
|
||||||
|
|
||||||
#define PACKET_LOG_FILE "/packet_log"
|
#define PACKET_LOG_FILE "/packet_log"
|
||||||
|
|
||||||
#define MAX_POST_TEXT_LEN (160-9)
|
#define MAX_POST_TEXT_LEN (160-9)
|
||||||
@@ -189,7 +187,7 @@ public:
|
|||||||
|
|
||||||
const char* getFirmwareVer() override { return FIRMWARE_VERSION; }
|
const char* getFirmwareVer() override { return FIRMWARE_VERSION; }
|
||||||
const char* getBuildDate() override { return FIRMWARE_BUILD_DATE; }
|
const char* getBuildDate() override { return FIRMWARE_BUILD_DATE; }
|
||||||
const char* getRole() override { return FIRMWARE_ROLE; }
|
const char* getRole() override { return "room_server"; }
|
||||||
const char* getNodeName() { return _prefs.node_name; }
|
const char* getNodeName() { return _prefs.node_name; }
|
||||||
NodePrefs* getNodePrefs() {
|
NodePrefs* getNodePrefs() {
|
||||||
return &_prefs;
|
return &_prefs;
|
||||||
|
|||||||
@@ -1,125 +0,0 @@
|
|||||||
#include "UITask.h"
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include <helpers/CommonCLI.h>
|
|
||||||
|
|
||||||
#ifndef USER_BTN_PRESSED
|
|
||||||
#define USER_BTN_PRESSED LOW
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define AUTO_OFF_MILLIS 20000 // 20 seconds
|
|
||||||
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds
|
|
||||||
|
|
||||||
// 'meshcore', 128x13px
|
|
||||||
static const uint8_t meshcore_logo [] PROGMEM = {
|
|
||||||
0x3c, 0x01, 0xe3, 0xff, 0xc7, 0xff, 0x8f, 0x03, 0x87, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe,
|
|
||||||
0x3c, 0x03, 0xe3, 0xff, 0xc7, 0xff, 0x8e, 0x03, 0x8f, 0xfe, 0x3f, 0xfe, 0x1f, 0xff, 0x1f, 0xfe,
|
|
||||||
0x3e, 0x03, 0xc3, 0xff, 0x8f, 0xff, 0x0e, 0x07, 0x8f, 0xfe, 0x7f, 0xfe, 0x1f, 0xff, 0x1f, 0xfc,
|
|
||||||
0x3e, 0x07, 0xc7, 0x80, 0x0e, 0x00, 0x0e, 0x07, 0x9e, 0x00, 0x78, 0x0e, 0x3c, 0x0f, 0x1c, 0x00,
|
|
||||||
0x3e, 0x0f, 0xc7, 0x80, 0x1e, 0x00, 0x0e, 0x07, 0x1e, 0x00, 0x70, 0x0e, 0x38, 0x0f, 0x3c, 0x00,
|
|
||||||
0x7f, 0x0f, 0xc7, 0xfe, 0x1f, 0xfc, 0x1f, 0xff, 0x1c, 0x00, 0x70, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
|
|
||||||
0x7f, 0x1f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
|
|
||||||
0x7f, 0x3f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x1e, 0x3f, 0xfe, 0x3f, 0xf0,
|
|
||||||
0x77, 0x3b, 0x87, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xfc, 0x38, 0x00,
|
|
||||||
0x77, 0xfb, 0x8f, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xf8, 0x38, 0x00,
|
|
||||||
0x73, 0xf3, 0x8f, 0xff, 0x0f, 0xff, 0x1c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x78, 0x7f, 0xf8,
|
|
||||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfe, 0x3c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x3c, 0x7f, 0xf8,
|
|
||||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
|
|
||||||
};
|
|
||||||
|
|
||||||
void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version) {
|
|
||||||
_prevBtnState = HIGH;
|
|
||||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
|
||||||
_node_prefs = node_prefs;
|
|
||||||
_display->turnOn();
|
|
||||||
|
|
||||||
// strip off dash and commit hash by changing dash to null terminator
|
|
||||||
// e.g: v1.2.3-abcdef -> v1.2.3
|
|
||||||
char *version = strdup(firmware_version);
|
|
||||||
char *dash = strchr(version, '-');
|
|
||||||
if(dash){
|
|
||||||
*dash = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// v1.2.3 (1 Jan 2025)
|
|
||||||
snprintf(_version_info, sizeof(_version_info), "%s (%s)", version, build_date);
|
|
||||||
free(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UITask::renderCurrScreen() {
|
|
||||||
char tmp[80];
|
|
||||||
if (millis() < BOOT_SCREEN_MILLIS) { // boot screen
|
|
||||||
// meshcore logo
|
|
||||||
_display->setColor(UIColor::corp_blue);
|
|
||||||
int logoWidth = 128;
|
|
||||||
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
|
|
||||||
|
|
||||||
// meshcore website
|
|
||||||
const char* website = "https://meshcore.io";
|
|
||||||
_display->setColor(UIColor::primary_txt);
|
|
||||||
_display->setTextSize(1);
|
|
||||||
uint16_t websiteWidth = _display->getTextWidth(website);
|
|
||||||
_display->setCursor((_display->width() - websiteWidth) / 2, 22);
|
|
||||||
_display->print(website);
|
|
||||||
|
|
||||||
// version info
|
|
||||||
_display->setTextSize(1);
|
|
||||||
uint16_t versionWidth = _display->getTextWidth(_version_info);
|
|
||||||
_display->setCursor((_display->width() - versionWidth) / 2, 35);
|
|
||||||
_display->print(_version_info);
|
|
||||||
|
|
||||||
// node type
|
|
||||||
const char* node_type = "< Room Server >";
|
|
||||||
uint16_t typeWidth = _display->getTextWidth(node_type);
|
|
||||||
_display->setCursor((_display->width() - typeWidth) / 2, 48);
|
|
||||||
_display->print(node_type);
|
|
||||||
} else { // home screen
|
|
||||||
// node name
|
|
||||||
_display->setCursor(0, 0);
|
|
||||||
_display->setTextSize(1);
|
|
||||||
_display->setColor(UIColor::primary_txt);
|
|
||||||
_display->print(_node_prefs->node_name);
|
|
||||||
|
|
||||||
// freq / sf
|
|
||||||
_display->setCursor(0, 20);
|
|
||||||
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
|
|
||||||
_display->print(tmp);
|
|
||||||
|
|
||||||
// bw / cr
|
|
||||||
_display->setCursor(0, 30);
|
|
||||||
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
|
|
||||||
_display->print(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UITask::loop() {
|
|
||||||
#ifdef PIN_USER_BTN
|
|
||||||
if (millis() >= _next_read) {
|
|
||||||
int btnState = digitalRead(PIN_USER_BTN);
|
|
||||||
if (btnState != _prevBtnState) {
|
|
||||||
if (btnState == USER_BTN_PRESSED) { // pressed?
|
|
||||||
if (_display->isOn()) {
|
|
||||||
// TODO: any action ?
|
|
||||||
} else {
|
|
||||||
_display->turnOn();
|
|
||||||
}
|
|
||||||
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
|
|
||||||
}
|
|
||||||
_prevBtnState = btnState;
|
|
||||||
}
|
|
||||||
_next_read = millis() + 200; // 5 reads per second
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_display->isOn()) {
|
|
||||||
if (millis() >= _next_refresh) {
|
|
||||||
_display->startFrame();
|
|
||||||
renderCurrScreen();
|
|
||||||
_display->endFrame();
|
|
||||||
|
|
||||||
_next_refresh = millis() + 1000; // refresh every second
|
|
||||||
}
|
|
||||||
if (millis() > _auto_off) {
|
|
||||||
_display->turnOff();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <helpers/ui/DisplayDriver.h>
|
|
||||||
#include <helpers/CommonCLI.h>
|
|
||||||
|
|
||||||
class UITask {
|
|
||||||
DisplayDriver* _display;
|
|
||||||
unsigned long _next_read, _next_refresh, _auto_off;
|
|
||||||
int _prevBtnState;
|
|
||||||
NodePrefs* _node_prefs;
|
|
||||||
char _version_info[32];
|
|
||||||
|
|
||||||
void renderCurrScreen();
|
|
||||||
public:
|
|
||||||
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
|
|
||||||
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version);
|
|
||||||
|
|
||||||
void loop();
|
|
||||||
};
|
|
||||||
@@ -8,11 +8,6 @@
|
|||||||
#include <helpers/nrf52/EthernetCLI.h>
|
#include <helpers/nrf52/EthernetCLI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
|
||||||
#include "UITask.h"
|
|
||||||
static UITask ui_task(display);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
StdRNG fast_rng;
|
StdRNG fast_rng;
|
||||||
SimpleMeshTables tables;
|
SimpleMeshTables tables;
|
||||||
MyMesh the_mesh(board, radio_driver, *new ArduinoMillis(), fast_rng, rtc_clock, tables);
|
MyMesh the_mesh(board, radio_driver, *new ArduinoMillis(), fast_rng, rtc_clock, tables);
|
||||||
@@ -88,7 +83,7 @@ void setup() {
|
|||||||
the_mesh.begin(fs);
|
the_mesh.begin(fs);
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION, "< Room Server >");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ETHERNET_ENABLED
|
#ifdef ETHERNET_ENABLED
|
||||||
|
|||||||
@@ -41,8 +41,6 @@
|
|||||||
#define FIRMWARE_VERSION "v1.18.0"
|
#define FIRMWARE_VERSION "v1.18.0"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FIRMWARE_ROLE "sensor"
|
|
||||||
|
|
||||||
#define MAX_SEARCH_RESULTS 24
|
#define MAX_SEARCH_RESULTS 24
|
||||||
#define MAX_CONCURRENT_ALERTS 4
|
#define MAX_CONCURRENT_ALERTS 4
|
||||||
|
|
||||||
@@ -56,7 +54,7 @@ public:
|
|||||||
// CommonCLI callbacks
|
// CommonCLI callbacks
|
||||||
const char* getFirmwareVer() override { return FIRMWARE_VERSION; }
|
const char* getFirmwareVer() override { return FIRMWARE_VERSION; }
|
||||||
const char* getBuildDate() override { return FIRMWARE_BUILD_DATE; }
|
const char* getBuildDate() override { return FIRMWARE_BUILD_DATE; }
|
||||||
const char* getRole() override { return FIRMWARE_ROLE; }
|
const char* getRole() override { return "sensor"; }
|
||||||
const char* getNodeName() { return _prefs.node_name; }
|
const char* getNodeName() { return _prefs.node_name; }
|
||||||
NodePrefs* getNodePrefs() { return &_prefs; }
|
NodePrefs* getNodePrefs() { return &_prefs; }
|
||||||
void savePrefs() override { _cli.savePrefs(_fs); }
|
void savePrefs() override { _cli.savePrefs(_fs); }
|
||||||
|
|||||||
@@ -1,125 +0,0 @@
|
|||||||
#include "UITask.h"
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include <helpers/CommonCLI.h>
|
|
||||||
|
|
||||||
#ifndef USER_BTN_PRESSED
|
|
||||||
#define USER_BTN_PRESSED LOW
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define AUTO_OFF_MILLIS 20000 // 20 seconds
|
|
||||||
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds
|
|
||||||
|
|
||||||
// 'meshcore', 128x13px
|
|
||||||
static const uint8_t meshcore_logo [] PROGMEM = {
|
|
||||||
0x3c, 0x01, 0xe3, 0xff, 0xc7, 0xff, 0x8f, 0x03, 0x87, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe,
|
|
||||||
0x3c, 0x03, 0xe3, 0xff, 0xc7, 0xff, 0x8e, 0x03, 0x8f, 0xfe, 0x3f, 0xfe, 0x1f, 0xff, 0x1f, 0xfe,
|
|
||||||
0x3e, 0x03, 0xc3, 0xff, 0x8f, 0xff, 0x0e, 0x07, 0x8f, 0xfe, 0x7f, 0xfe, 0x1f, 0xff, 0x1f, 0xfc,
|
|
||||||
0x3e, 0x07, 0xc7, 0x80, 0x0e, 0x00, 0x0e, 0x07, 0x9e, 0x00, 0x78, 0x0e, 0x3c, 0x0f, 0x1c, 0x00,
|
|
||||||
0x3e, 0x0f, 0xc7, 0x80, 0x1e, 0x00, 0x0e, 0x07, 0x1e, 0x00, 0x70, 0x0e, 0x38, 0x0f, 0x3c, 0x00,
|
|
||||||
0x7f, 0x0f, 0xc7, 0xfe, 0x1f, 0xfc, 0x1f, 0xff, 0x1c, 0x00, 0x70, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
|
|
||||||
0x7f, 0x1f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
|
|
||||||
0x7f, 0x3f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x1e, 0x3f, 0xfe, 0x3f, 0xf0,
|
|
||||||
0x77, 0x3b, 0x87, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xfc, 0x38, 0x00,
|
|
||||||
0x77, 0xfb, 0x8f, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xf8, 0x38, 0x00,
|
|
||||||
0x73, 0xf3, 0x8f, 0xff, 0x0f, 0xff, 0x1c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x78, 0x7f, 0xf8,
|
|
||||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfe, 0x3c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x3c, 0x7f, 0xf8,
|
|
||||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
|
|
||||||
};
|
|
||||||
|
|
||||||
void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version) {
|
|
||||||
_prevBtnState = HIGH;
|
|
||||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
|
||||||
_node_prefs = node_prefs;
|
|
||||||
_display->turnOn();
|
|
||||||
|
|
||||||
// strip off dash and commit hash by changing dash to null terminator
|
|
||||||
// e.g: v1.2.3-abcdef -> v1.2.3
|
|
||||||
char *version = strdup(firmware_version);
|
|
||||||
char *dash = strchr(version, '-');
|
|
||||||
if(dash){
|
|
||||||
*dash = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// v1.2.3 (1 Jan 2025)
|
|
||||||
snprintf(_version_info, sizeof(_version_info), "%s (%s)", version, build_date);
|
|
||||||
free(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UITask::renderCurrScreen() {
|
|
||||||
char tmp[80];
|
|
||||||
if (millis() < BOOT_SCREEN_MILLIS) { // boot screen
|
|
||||||
// meshcore logo
|
|
||||||
_display->setColor(UIColor::corp_blue);
|
|
||||||
int logoWidth = 128;
|
|
||||||
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
|
|
||||||
|
|
||||||
// meshcore website
|
|
||||||
const char* website = "https://meshcore.io";
|
|
||||||
_display->setColor(UIColor::primary_txt);
|
|
||||||
_display->setTextSize(1);
|
|
||||||
uint16_t websiteWidth = _display->getTextWidth(website);
|
|
||||||
_display->setCursor((_display->width() - websiteWidth) / 2, 22);
|
|
||||||
_display->print(website);
|
|
||||||
|
|
||||||
// version info
|
|
||||||
_display->setTextSize(1);
|
|
||||||
uint16_t versionWidth = _display->getTextWidth(_version_info);
|
|
||||||
_display->setCursor((_display->width() - versionWidth) / 2, 35);
|
|
||||||
_display->print(_version_info);
|
|
||||||
|
|
||||||
// node type
|
|
||||||
const char* node_type = "< Sensor >";
|
|
||||||
uint16_t typeWidth = _display->getTextWidth(node_type);
|
|
||||||
_display->setCursor((_display->width() - typeWidth) / 2, 48);
|
|
||||||
_display->print(node_type);
|
|
||||||
} else { // home screen
|
|
||||||
// node name
|
|
||||||
_display->setCursor(0, 0);
|
|
||||||
_display->setTextSize(1);
|
|
||||||
_display->setColor(UIColor::primary_txt);
|
|
||||||
_display->print(_node_prefs->node_name);
|
|
||||||
|
|
||||||
// freq / sf
|
|
||||||
_display->setCursor(0, 20);
|
|
||||||
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
|
|
||||||
_display->print(tmp);
|
|
||||||
|
|
||||||
// bw / cr
|
|
||||||
_display->setCursor(0, 30);
|
|
||||||
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
|
|
||||||
_display->print(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UITask::loop() {
|
|
||||||
#ifdef PIN_USER_BTN
|
|
||||||
if (millis() >= _next_read) {
|
|
||||||
int btnState = digitalRead(PIN_USER_BTN);
|
|
||||||
if (btnState != _prevBtnState) {
|
|
||||||
if (btnState == USER_BTN_PRESSED) { // pressed?
|
|
||||||
if (_display->isOn()) {
|
|
||||||
// TODO: any action ?
|
|
||||||
} else {
|
|
||||||
_display->turnOn();
|
|
||||||
}
|
|
||||||
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
|
|
||||||
}
|
|
||||||
_prevBtnState = btnState;
|
|
||||||
}
|
|
||||||
_next_read = millis() + 200; // 5 reads per second
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_display->isOn()) {
|
|
||||||
if (millis() >= _next_refresh) {
|
|
||||||
_display->startFrame();
|
|
||||||
renderCurrScreen();
|
|
||||||
_display->endFrame();
|
|
||||||
|
|
||||||
_next_refresh = millis() + 1000; // refresh every second
|
|
||||||
}
|
|
||||||
if (millis() > _auto_off) {
|
|
||||||
_display->turnOff();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <helpers/ui/DisplayDriver.h>
|
|
||||||
#include <helpers/CommonCLI.h>
|
|
||||||
|
|
||||||
class UITask {
|
|
||||||
DisplayDriver* _display;
|
|
||||||
unsigned long _next_read, _next_refresh, _auto_off;
|
|
||||||
int _prevBtnState;
|
|
||||||
NodePrefs* _node_prefs;
|
|
||||||
char _version_info[32];
|
|
||||||
|
|
||||||
void renderCurrScreen();
|
|
||||||
public:
|
|
||||||
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
|
|
||||||
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version);
|
|
||||||
|
|
||||||
void loop();
|
|
||||||
};
|
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
#include "SensorMesh.h"
|
#include "SensorMesh.h"
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
|
||||||
#include "UITask.h"
|
|
||||||
static UITask ui_task(display);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class MyMesh : public SensorMesh {
|
class MyMesh : public SensorMesh {
|
||||||
public:
|
public:
|
||||||
MyMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables)
|
MyMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables)
|
||||||
@@ -111,7 +106,7 @@ void setup() {
|
|||||||
the_mesh.begin(fs);
|
the_mesh.begin(fs);
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION, "< Sensor >");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// send out initial zero hop Advertisement to the mesh
|
// send out initial zero hop Advertisement to the mesh
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#include "BaseUITask.h"
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
void BaseUITask::loop() {
|
||||||
|
if (_display->isOn()) {
|
||||||
|
if (millis() >= _next_refresh) {
|
||||||
|
_display->startFrame();
|
||||||
|
long interval = renderCurrScreen();
|
||||||
|
_display->endFrame();
|
||||||
|
|
||||||
|
_next_refresh = millis() + interval;
|
||||||
|
}
|
||||||
|
if (millis() > _auto_off) {
|
||||||
|
_display->turnOff();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <MeshCore.h>
|
||||||
|
#include <helpers/ui/DisplayDriver.h>
|
||||||
|
// #include <helpers/ui/UIScreen.h>
|
||||||
|
|
||||||
|
class BaseUITask {
|
||||||
|
protected:
|
||||||
|
mesh::MainBoard* _board;
|
||||||
|
DisplayDriver* _display;
|
||||||
|
unsigned long _next_refresh, _auto_off;
|
||||||
|
|
||||||
|
BaseUITask(mesh::MainBoard* board, DisplayDriver* display) : _board(board), _display(display) { _next_refresh = 0; }
|
||||||
|
|
||||||
|
virtual long renderCurrScreen() = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void loop();
|
||||||
|
};
|
||||||
@@ -29,7 +29,7 @@ static const uint8_t meshcore_logo [] PROGMEM = {
|
|||||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
|
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
|
||||||
};
|
};
|
||||||
|
|
||||||
void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version) {
|
void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version, const char* role_lbl) {
|
||||||
_prevBtnState = HIGH;
|
_prevBtnState = HIGH;
|
||||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||||
_started_at = millis();
|
_started_at = millis();
|
||||||
@@ -44,16 +44,18 @@ void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* fi
|
|||||||
// e.g: v1.2.3-abcdef -> v1.2.3
|
// e.g: v1.2.3-abcdef -> v1.2.3
|
||||||
char *version = strdup(firmware_version);
|
char *version = strdup(firmware_version);
|
||||||
char *dash = strchr(version, '-');
|
char *dash = strchr(version, '-');
|
||||||
if(dash){
|
if (dash){
|
||||||
*dash = 0;
|
*dash = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// v1.2.3 (1 Jan 2025)
|
// v1.2.3 (1 Jan 2025)
|
||||||
snprintf(_version_info, sizeof(_version_info), "%s (%s)", version, build_date);
|
snprintf(_version_info, sizeof(_version_info), "%s (%s)", version, build_date);
|
||||||
free(version);
|
free(version);
|
||||||
|
|
||||||
|
_role_label = role_lbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UITask::renderCurrScreen() {
|
long UITask::renderCurrScreen() {
|
||||||
char tmp[80];
|
char tmp[80];
|
||||||
if (millis() < _started_at + BOOT_SCREEN_MILLIS) { // boot screen
|
if (millis() < _started_at + BOOT_SCREEN_MILLIS) { // boot screen
|
||||||
// meshcore logo
|
// meshcore logo
|
||||||
@@ -72,8 +74,7 @@ void UITask::renderCurrScreen() {
|
|||||||
_display->drawTextCentered(_display->width() / 2, 35, _version_info);
|
_display->drawTextCentered(_display->width() / 2, 35, _version_info);
|
||||||
|
|
||||||
// node type
|
// node type
|
||||||
const char* node_type = "< Repeater >";
|
_display->drawTextCentered(_display->width() / 2, 48, _role_label);
|
||||||
_display->drawTextCentered(_display->width() / 2, 48, node_type);
|
|
||||||
} else if (_powering_off_at > 0) {
|
} else if (_powering_off_at > 0) {
|
||||||
// meshcore logo
|
// meshcore logo
|
||||||
_display->setColor(UIColor::corp_blue);
|
_display->setColor(UIColor::corp_blue);
|
||||||
@@ -107,6 +108,7 @@ void UITask::renderCurrScreen() {
|
|||||||
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
|
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
|
||||||
_display->print(tmp);
|
_display->print(tmp);
|
||||||
}
|
}
|
||||||
|
return 1000; // 1 sec interval
|
||||||
}
|
}
|
||||||
|
|
||||||
void UITask::loop() {
|
void UITask::loop() {
|
||||||
@@ -126,18 +128,7 @@ void UITask::loop() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_display->isOn()) {
|
BaseUITask::loop();
|
||||||
if (millis() >= _next_refresh) {
|
|
||||||
_display->startFrame();
|
|
||||||
renderCurrScreen();
|
|
||||||
_display->endFrame();
|
|
||||||
|
|
||||||
_next_refresh = millis() + 1000; // refresh every second
|
|
||||||
}
|
|
||||||
if (millis() > _auto_off) {
|
|
||||||
_display->turnOff();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_powering_off_at > 0) { // power off timer armed
|
if (_powering_off_at > 0) { // power off timer armed
|
||||||
#if defined(LED_PIN) && defined(LED_STATE_ON)
|
#if defined(LED_PIN) && defined(LED_STATE_ON)
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <helpers/ui/BaseUITask.h>
|
||||||
|
#include <helpers/CommonCLI.h>
|
||||||
|
|
||||||
|
class UITask : public BaseUITask {
|
||||||
|
unsigned long _next_read;
|
||||||
|
int _prevBtnState;
|
||||||
|
NodePrefs* _node_prefs;
|
||||||
|
char _version_info[32];
|
||||||
|
const char* _role_label;
|
||||||
|
unsigned long _powering_off_at = 0;
|
||||||
|
unsigned long _started_at = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
long renderCurrScreen() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
UITask(mesh::MainBoard& board, DisplayDriver& display) : BaseUITask(&board, &display) { _next_read = 0; }
|
||||||
|
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version, const char* role_lbl);
|
||||||
|
|
||||||
|
void loop() override;
|
||||||
|
};
|
||||||
@@ -31,7 +31,8 @@ build_flags =
|
|||||||
-D PIN_GPS_TX=48
|
-D PIN_GPS_TX=48
|
||||||
-D PIN_GPS_EN=26
|
-D PIN_GPS_EN=26
|
||||||
build_src_filter = ${esp32_base.build_src_filter}
|
build_src_filter = ${esp32_base.build_src_filter}
|
||||||
+<../variants/heltec_v3>
|
+<../variants/heltec_v3/target.cpp>
|
||||||
|
+<helpers/ui/BaseUITask.cpp>
|
||||||
+<helpers/sensors>
|
+<helpers/sensors>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${esp32_base.lib_deps}
|
${esp32_base.lib_deps}
|
||||||
@@ -41,6 +42,7 @@ lib_deps =
|
|||||||
extends = Heltec_lora32_v3
|
extends = Heltec_lora32_v3
|
||||||
build_flags =
|
build_flags =
|
||||||
${Heltec_lora32_v3.build_flags}
|
${Heltec_lora32_v3.build_flags}
|
||||||
|
-I src/helpers/ui/server
|
||||||
-D DISPLAY_CLASS=SSD1306Display
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
-D ADVERT_NAME='"Heltec Repeater"'
|
-D ADVERT_NAME='"Heltec Repeater"'
|
||||||
-D ADVERT_LAT=0.0
|
-D ADVERT_LAT=0.0
|
||||||
@@ -51,7 +53,9 @@ build_flags =
|
|||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||||
+<helpers/ui/SSD1306Display.cpp>
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<helpers/ui/server>
|
||||||
+<../examples/simple_repeater>
|
+<../examples/simple_repeater>
|
||||||
|
+<../variants/heltec_v3/target-other.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${Heltec_lora32_v3.lib_deps}
|
${Heltec_lora32_v3.lib_deps}
|
||||||
${esp32_ota.lib_deps}
|
${esp32_ota.lib_deps}
|
||||||
@@ -76,7 +80,9 @@ build_flags =
|
|||||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||||
+<helpers/bridges/RS232Bridge.cpp>
|
+<helpers/bridges/RS232Bridge.cpp>
|
||||||
+<helpers/ui/SSD1306Display.cpp>
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<helpers/ui/server>
|
||||||
+<../examples/simple_repeater>
|
+<../examples/simple_repeater>
|
||||||
|
+<../variants/heltec_v3/target-other.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${Heltec_lora32_v3.lib_deps}
|
${Heltec_lora32_v3.lib_deps}
|
||||||
${esp32_ota.lib_deps}
|
${esp32_ota.lib_deps}
|
||||||
@@ -98,7 +104,9 @@ build_flags =
|
|||||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||||
+<helpers/bridges/ESPNowBridge.cpp>
|
+<helpers/bridges/ESPNowBridge.cpp>
|
||||||
+<helpers/ui/SSD1306Display.cpp>
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<helpers/ui/server>
|
||||||
+<../examples/simple_repeater>
|
+<../examples/simple_repeater>
|
||||||
|
+<../variants/heltec_v3/target-other.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${Heltec_lora32_v3.lib_deps}
|
${Heltec_lora32_v3.lib_deps}
|
||||||
${esp32_ota.lib_deps}
|
${esp32_ota.lib_deps}
|
||||||
@@ -107,6 +115,7 @@ lib_deps =
|
|||||||
extends = Heltec_lora32_v3
|
extends = Heltec_lora32_v3
|
||||||
build_flags =
|
build_flags =
|
||||||
${Heltec_lora32_v3.build_flags}
|
${Heltec_lora32_v3.build_flags}
|
||||||
|
-I src/helpers/ui/server
|
||||||
-D DISPLAY_CLASS=SSD1306Display
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
-D ADVERT_NAME='"Heltec Room"'
|
-D ADVERT_NAME='"Heltec Room"'
|
||||||
-D ADVERT_LAT=0.0
|
-D ADVERT_LAT=0.0
|
||||||
@@ -117,7 +126,9 @@ build_flags =
|
|||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||||
+<helpers/ui/SSD1306Display.cpp>
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<helpers/ui/server>
|
||||||
+<../examples/simple_room_server>
|
+<../examples/simple_room_server>
|
||||||
|
+<../variants/heltec_v3/target-other.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${Heltec_lora32_v3.lib_deps}
|
${Heltec_lora32_v3.lib_deps}
|
||||||
${esp32_ota.lib_deps}
|
${esp32_ota.lib_deps}
|
||||||
@@ -140,7 +151,7 @@ lib_deps =
|
|||||||
extends = Heltec_lora32_v3
|
extends = Heltec_lora32_v3
|
||||||
build_flags =
|
build_flags =
|
||||||
${Heltec_lora32_v3.build_flags}
|
${Heltec_lora32_v3.build_flags}
|
||||||
-I examples/companion_radio/ui-new
|
; -I examples/companion_radio/ui-new
|
||||||
-D MAX_CONTACTS=350
|
-D MAX_CONTACTS=350
|
||||||
-D MAX_GROUP_CHANNELS=40
|
-D MAX_GROUP_CHANNELS=40
|
||||||
-D DISPLAY_CLASS=SSD1306Display
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
@@ -150,8 +161,10 @@ build_flags =
|
|||||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||||
+<helpers/ui/SSD1306Display.cpp>
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
+<helpers/ui/MomentaryButton.cpp>
|
+<helpers/ui/MomentaryButton.cpp>
|
||||||
|
+<helpers/ui/companion-new>
|
||||||
+<../examples/companion_radio/*.cpp>
|
+<../examples/companion_radio/*.cpp>
|
||||||
+<../examples/companion_radio/ui-new/*.cpp>
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
|
+<../variants/heltec_v3/target-companion.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${Heltec_lora32_v3.lib_deps}
|
${Heltec_lora32_v3.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
@@ -160,7 +173,7 @@ lib_deps =
|
|||||||
extends = Heltec_lora32_v3
|
extends = Heltec_lora32_v3
|
||||||
build_flags =
|
build_flags =
|
||||||
${Heltec_lora32_v3.build_flags}
|
${Heltec_lora32_v3.build_flags}
|
||||||
-I examples/companion_radio/ui-new
|
; -I examples/companion_radio/ui-new
|
||||||
-D MAX_CONTACTS=350
|
-D MAX_CONTACTS=350
|
||||||
-D MAX_GROUP_CHANNELS=40
|
-D MAX_GROUP_CHANNELS=40
|
||||||
-D DISPLAY_CLASS=SSD1306Display
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
@@ -174,10 +187,12 @@ build_flags =
|
|||||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||||
+<helpers/ui/SSD1306Display.cpp>
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
+<helpers/ui/MomentaryButton.cpp>
|
+<helpers/ui/MomentaryButton.cpp>
|
||||||
|
+<helpers/ui/companion-new>
|
||||||
+<helpers/esp32/*.cpp>
|
+<helpers/esp32/*.cpp>
|
||||||
+<helpers/wifi/*.cpp>
|
+<helpers/wifi/*.cpp>
|
||||||
+<../examples/companion_radio/*.cpp>
|
+<../examples/companion_radio/*.cpp>
|
||||||
+<../examples/companion_radio/ui-new/*.cpp>
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
|
+<../variants/heltec_v3/target-companion.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${Heltec_lora32_v3.lib_deps}
|
${Heltec_lora32_v3.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
@@ -186,7 +201,7 @@ lib_deps =
|
|||||||
extends = Heltec_lora32_v3
|
extends = Heltec_lora32_v3
|
||||||
build_flags =
|
build_flags =
|
||||||
${Heltec_lora32_v3.build_flags}
|
${Heltec_lora32_v3.build_flags}
|
||||||
-I examples/companion_radio/ui-new
|
; -I examples/companion_radio/ui-new
|
||||||
-D ENABLE_WIFI_INTERFACE
|
-D ENABLE_WIFI_INTERFACE
|
||||||
-D MAX_CONTACTS=350
|
-D MAX_CONTACTS=350
|
||||||
-D MAX_GROUP_CHANNELS=40
|
-D MAX_GROUP_CHANNELS=40
|
||||||
@@ -200,10 +215,12 @@ build_flags =
|
|||||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||||
+<helpers/ui/SSD1306Display.cpp>
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
+<helpers/ui/MomentaryButton.cpp>
|
+<helpers/ui/MomentaryButton.cpp>
|
||||||
|
+<helpers/ui/companion-new>
|
||||||
+<helpers/esp32/*.cpp>
|
+<helpers/esp32/*.cpp>
|
||||||
+<helpers/wifi/*.cpp>
|
+<helpers/wifi/*.cpp>
|
||||||
+<../examples/companion_radio/*.cpp>
|
+<../examples/companion_radio/*.cpp>
|
||||||
+<../examples/companion_radio/ui-new/*.cpp>
|
+<../examples/companion_radio/ui-new/*.cpp>
|
||||||
|
+<../variants/heltec_v3/target-companion.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${Heltec_lora32_v3.lib_deps}
|
${Heltec_lora32_v3.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
@@ -212,6 +229,7 @@ lib_deps =
|
|||||||
extends = Heltec_lora32_v3
|
extends = Heltec_lora32_v3
|
||||||
build_flags =
|
build_flags =
|
||||||
${Heltec_lora32_v3.build_flags}
|
${Heltec_lora32_v3.build_flags}
|
||||||
|
-I src/helpers/ui/server
|
||||||
-D ADVERT_NAME='"Heltec v3 Sensor"'
|
-D ADVERT_NAME='"Heltec v3 Sensor"'
|
||||||
-D ADVERT_LAT=0.0
|
-D ADVERT_LAT=0.0
|
||||||
-D ADVERT_LON=0.0
|
-D ADVERT_LON=0.0
|
||||||
@@ -223,7 +241,9 @@ build_flags =
|
|||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||||
+<helpers/ui/SSD1306Display.cpp>
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<helpers/ui/server>
|
||||||
+<../examples/simple_sensor>
|
+<../examples/simple_sensor>
|
||||||
|
+<../variants/heltec_v3/target-other.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${Heltec_lora32_v3.lib_deps}
|
${Heltec_lora32_v3.lib_deps}
|
||||||
${esp32_ota.lib_deps}
|
${esp32_ota.lib_deps}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
#include "target.h"
|
||||||
|
|
||||||
|
#ifdef DISPLAY_CLASS
|
||||||
|
DISPLAY_CLASS display;
|
||||||
|
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
||||||
|
|
||||||
|
// TODO: UITask
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
#include "target.h"
|
||||||
|
|
||||||
|
#ifdef DISPLAY_CLASS
|
||||||
|
DISPLAY_CLASS display;
|
||||||
|
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
||||||
|
|
||||||
|
UITask ui_task(board, display);
|
||||||
|
#endif
|
||||||
@@ -24,11 +24,6 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
|||||||
EnvironmentSensorManager sensors;
|
EnvironmentSensorManager sensors;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
|
||||||
DISPLAY_CLASS display;
|
|
||||||
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool radio_init() {
|
bool radio_init() {
|
||||||
fallback_clock.begin();
|
fallback_clock.begin();
|
||||||
rtc_clock.begin(Wire);
|
rtc_clock.begin(Wire);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
#include <helpers/ui/SSD1306Display.h>
|
#include <helpers/ui/SSD1306Display.h>
|
||||||
#include <helpers/ui/MomentaryButton.h>
|
#include <helpers/ui/MomentaryButton.h>
|
||||||
|
#include <UITask.h> // needs -I(nclude) path setting
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern HeltecV3Board board;
|
extern HeltecV3Board board;
|
||||||
@@ -21,6 +22,7 @@ extern EnvironmentSensorManager sensors;
|
|||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
extern DISPLAY_CLASS display;
|
extern DISPLAY_CLASS display;
|
||||||
extern MomentaryButton user_btn;
|
extern MomentaryButton user_btn;
|
||||||
|
extern UITask ui_task;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool radio_init();
|
bool radio_init();
|
||||||
|
|||||||
Reference in new issue
Block a user