* interface manager now injected via begin()
This commit is contained in:
1 parent
d05ed2122c
commit
26ae484af8
12 files changed
+28
-28
No files matched your search
@@ -322,7 +322,7 @@ void setup() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
ui_task.begin(disp, &sensors, the_mesh.getNodePrefs(), &the_mesh, the_mesh.getBLEPin(), FIRMWARE_VERSION, FIRMWARE_BUILD_DATE);
|
ui_task.begin(disp, &sensors, the_mesh.getNodePrefs(), &interface_manager, &the_mesh, the_mesh.getBLEPin(), FIRMWARE_VERSION, FIRMWARE_BUILD_DATE);
|
||||||
the_mesh.setListener(&ui_task);
|
the_mesh.setListener(&ui_task);
|
||||||
#ifdef EINK_REFRESH_LOOP
|
#ifdef EINK_REFRESH_LOOP
|
||||||
if (disp != NULL) disp->setBusyHook(loopDuringDisplayRefresh);
|
if (disp != NULL) disp->setBusyHook(loopDuringDisplayRefresh);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ protected:
|
|||||||
mesh::MainBoard* _board;
|
mesh::MainBoard* _board;
|
||||||
MultiSerialInterface* _interfaceManager;
|
MultiSerialInterface* _interfaceManager;
|
||||||
|
|
||||||
AbstractUITask(mesh::MainBoard* board, MultiSerialInterface* interfaceManager) : _board(board), _interfaceManager(interfaceManager) {
|
AbstractUITask(mesh::MainBoard* board, MultiSerialInterface* interfaceManager = NULL) : _board(board), _interfaceManager(interfaceManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -787,9 +787,12 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date) {
|
void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, MultiSerialInterface* serial,
|
||||||
|
BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date)
|
||||||
|
{
|
||||||
_display = display;
|
_display = display;
|
||||||
_sensors = sensors;
|
_sensors = sensors;
|
||||||
|
_interfaceManager = serial;
|
||||||
the_mesh = mesh;
|
the_mesh = mesh;
|
||||||
_ble_pin = ble_pin;
|
_ble_pin = ble_pin;
|
||||||
|
|
||||||
|
|||||||
@@ -93,12 +93,13 @@ class UITask : public AbstractUITask {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
UITask(mesh::MainBoard* board, MultiSerialInterface* serial) : AbstractUITask(board, serial), _display(NULL), _sensors(NULL) {
|
UITask(mesh::MainBoard* board) : AbstractUITask(board), _display(NULL), _sensors(NULL) {
|
||||||
next_batt_chck = _next_refresh = 0;
|
next_batt_chck = _next_refresh = 0;
|
||||||
ui_started_at = 0;
|
ui_started_at = 0;
|
||||||
curr = NULL;
|
curr = NULL;
|
||||||
}
|
}
|
||||||
void begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date);
|
void begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, MultiSerialInterface* serial,
|
||||||
|
BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date);
|
||||||
|
|
||||||
void gotoHomeScreen() { setCurrScreen(home); }
|
void gotoHomeScreen() { setCurrScreen(home); }
|
||||||
void showAlert(const char* text, int duration_millis);
|
void showAlert(const char* text, int duration_millis);
|
||||||
|
|||||||
@@ -40,9 +40,12 @@ 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(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date) {
|
void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, MultiSerialInterface* serial,
|
||||||
|
BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date)
|
||||||
|
{
|
||||||
_display = display;
|
_display = display;
|
||||||
_sensors = sensors;
|
_sensors = sensors;
|
||||||
|
_interfaceManager = serial;
|
||||||
the_mesh = mesh;
|
the_mesh = mesh;
|
||||||
_ble_pin = ble_pin;
|
_ble_pin = ble_pin;
|
||||||
|
|
||||||
|
|||||||
@@ -63,11 +63,12 @@ class UITask : public AbstractUITask {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
UITask(mesh::MainBoard* board, MultiSerialInterface* serial) : AbstractUITask(board, serial), _display(NULL), _sensors(NULL) {
|
UITask(mesh::MainBoard* board) : AbstractUITask(board), _display(NULL), _sensors(NULL) {
|
||||||
_next_refresh = 0;
|
_next_refresh = 0;
|
||||||
ui_started_at = 0;
|
ui_started_at = 0;
|
||||||
}
|
}
|
||||||
void begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date);
|
void begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, MultiSerialInterface* serial,
|
||||||
|
BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date);
|
||||||
|
|
||||||
bool hasDisplay() const { return _display != NULL; }
|
bool hasDisplay() const { return _display != NULL; }
|
||||||
void clearMsgPreview();
|
void clearMsgPreview();
|
||||||
|
|||||||
@@ -453,10 +453,12 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, MultiSerialInterface* serial,
|
||||||
void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date) {
|
BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date)
|
||||||
|
{
|
||||||
_display = display;
|
_display = display;
|
||||||
_sensors = sensors;
|
_sensors = sensors;
|
||||||
|
_interfaceManager = serial;
|
||||||
the_mesh = mesh;
|
the_mesh = mesh;
|
||||||
_ble_pin = ble_pin;
|
_ble_pin = ble_pin;
|
||||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||||
|
|||||||
@@ -74,13 +74,14 @@ class UITask : public AbstractUITask {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
UITask(mesh::MainBoard* board, MultiSerialInterface* serial) : AbstractUITask(board, serial), _display(NULL), _sensors(NULL) {
|
UITask(mesh::MainBoard* board) : AbstractUITask(board), _display(NULL), _sensors(NULL) {
|
||||||
next_batt_chck = _next_refresh = 0;
|
next_batt_chck = _next_refresh = 0;
|
||||||
_cached_batt_mv = 0;
|
_cached_batt_mv = 0;
|
||||||
ui_started_at = 0;
|
ui_started_at = 0;
|
||||||
curr = NULL;
|
curr = NULL;
|
||||||
}
|
}
|
||||||
void begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date);
|
void begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs, MultiSerialInterface* serial,
|
||||||
|
BaseChatMesh* mesh, uint32_t ble_pin, const char* ver, const char* build_date);
|
||||||
|
|
||||||
void gotoHomeScreen() { setCurrScreen(home); }
|
void gotoHomeScreen() { setCurrScreen(home); }
|
||||||
void showAlert(const char* text, int duration_millis);
|
void showAlert(const char* text, int duration_millis);
|
||||||
|
|||||||
@@ -151,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 src/helpers/ui/companion-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
|
||||||
@@ -163,7 +163,6 @@ build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
|||||||
+<helpers/ui/MomentaryButton.cpp>
|
+<helpers/ui/MomentaryButton.cpp>
|
||||||
+<helpers/ui/companion-new>
|
+<helpers/ui/companion-new>
|
||||||
+<../examples/companion_radio/*.cpp>
|
+<../examples/companion_radio/*.cpp>
|
||||||
+<../examples/companion_radio/ui-new/*.cpp>
|
|
||||||
+<../variants/heltec_v3/target-companion.cpp>
|
+<../variants/heltec_v3/target-companion.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${Heltec_lora32_v3.lib_deps}
|
${Heltec_lora32_v3.lib_deps}
|
||||||
@@ -200,7 +199,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 src/helpers/ui/companion-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
|
||||||
@@ -218,7 +217,6 @@ build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
|||||||
+<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>
|
|
||||||
+<../variants/heltec_v3/target-companion.cpp>
|
+<../variants/heltec_v3/target-companion.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${Heltec_lora32_v3.lib_deps}
|
${Heltec_lora32_v3.lib_deps}
|
||||||
|
|||||||
@@ -2,11 +2,8 @@
|
|||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
#include <helpers/MultiSerialInterface.h>
|
|
||||||
extern MultiSerialInterface interface_manager;
|
|
||||||
|
|
||||||
DISPLAY_CLASS display;
|
DISPLAY_CLASS display;
|
||||||
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
||||||
|
|
||||||
UITask ui_task(&board, &interface_manager);
|
UITask ui_task(&board);
|
||||||
#endif
|
#endif
|
||||||
@@ -2,12 +2,9 @@
|
|||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
#include <helpers/MultiSerialInterface.h>
|
|
||||||
extern MultiSerialInterface interface_manager;
|
|
||||||
|
|
||||||
DISPLAY_CLASS display;
|
DISPLAY_CLASS display;
|
||||||
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
||||||
MomentaryButton back_btn(PIN_BUTTON2, 1000, true);
|
MomentaryButton back_btn(PIN_BUTTON2, 1000, true);
|
||||||
UITask ui_task(&board, &interface_manager);
|
UITask ui_task(&board);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2,9 +2,6 @@
|
|||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
#include <helpers/MultiSerialInterface.h>
|
|
||||||
extern MultiSerialInterface interface_manager;
|
|
||||||
|
|
||||||
NullDisplayDriver display;
|
NullDisplayDriver display;
|
||||||
UITask ui_task(&board, &interface_manager);
|
UITask ui_task(&board);
|
||||||
#endif
|
#endif
|
||||||
Reference in new issue
Block a user