mirror of https://github.com/meshcore-dev/MeshCore
committed by
GitHub
112 changed files with 1871 additions and 269 deletions
@ -0,0 +1,64 @@ |
|||
from os.path import realpath |
|||
|
|||
Import("env") # type: ignore |
|||
menv=env # type: ignore |
|||
|
|||
src_filter = [ |
|||
'+<*.cpp>', |
|||
'+<helpers/*.cpp>', |
|||
'+<helpers/sensors>', |
|||
'+<helpers/radiolib/*.cpp>', |
|||
'+<helpers/ui/MomentaryButton.cpp>', |
|||
'+<helpers/ui/buzzer.cpp>', |
|||
] |
|||
|
|||
# add build and include dirs according to CPPDEFINES |
|||
for item in menv.get("CPPDEFINES", []): |
|||
|
|||
# PLATFORM HANDLING |
|||
if item == "STM32_PLATFORM": |
|||
src_filter.append("+<helpers/stm32/*>") |
|||
elif item == "ESP32": |
|||
src_filter.append("+<helpers/esp32/*>") |
|||
elif item == "NRF52_PLATFORM": |
|||
src_filter.append("+<helpers/nrf52/*>") |
|||
elif item == "RP2040_PLATFORM": |
|||
src_filter.append("+<helpers/rp2040/*>") |
|||
|
|||
# DISPLAY HANDLING |
|||
elif isinstance(item, tuple) and item[0] == "DISPLAY_CLASS": |
|||
display_class = item[1] |
|||
src_filter.append(f"+<helpers/ui/{display_class}.cpp>") |
|||
if (display_class == "ST7789Display") : |
|||
src_filter.append(f"+<helpers/ui/OLEDDisplay.cpp>") |
|||
src_filter.append(f"+<helpers/ui/OLEDDisplayFonts.cpp>") |
|||
|
|||
# VARIANTS HANDLING |
|||
elif isinstance(item, tuple) and item[0] == "MC_VARIANT": |
|||
variant_name = item[1] |
|||
src_filter.append(f"+<../variants/{variant_name}>") |
|||
|
|||
# INCLUDE EXAMPLE CODE IN BUILD (to provide your own support files without touching the tree) |
|||
elif isinstance(item, tuple) and item[0] == "BUILD_EXAMPLE": |
|||
example_name = item[1] |
|||
src_filter.append(f"+<../examples/{example_name}/*.cpp>") |
|||
|
|||
# EXCLUDE A SOURCE FILE FROM AN EXAMPLE (must be placed after example name or boom) |
|||
elif isinstance(item, tuple) and item[0] == "EXCLUDE_FROM_EXAMPLE": |
|||
exclude_name = item[1] |
|||
if example_name is None: |
|||
print("***** PLEASE DEFINE EXAMPLE FIRST *****") |
|||
break |
|||
src_filter.append(f"-<../examples/{example_name}/{exclude_name}>") |
|||
|
|||
# DEAL WITH UI VARIANT FOR AN EXAMPLE |
|||
elif isinstance(item, tuple) and item[0] == "MC_UI_FLAVOR": |
|||
ui_flavor = item[1] |
|||
if example_name is None: |
|||
print("***** PLEASE DEFINE EXAMPLE FIRST *****") |
|||
break |
|||
src_filter.append(f"+<../examples/{example_name}/{ui_flavor}/*.cpp>") |
|||
|
|||
menv.Replace(SRC_FILTER=src_filter) |
|||
|
|||
#print (menv.Dump()) |
|||
@ -0,0 +1,46 @@ |
|||
#pragma once |
|||
|
|||
#include <MeshCore.h> |
|||
#include <helpers/ui/DisplayDriver.h> |
|||
#include <helpers/ui/UIScreen.h> |
|||
#include <helpers/SensorManager.h> |
|||
#include <helpers/BaseSerialInterface.h> |
|||
#include <Arduino.h> |
|||
|
|||
#ifdef PIN_BUZZER |
|||
#include <helpers/ui/buzzer.h> |
|||
#endif |
|||
|
|||
#include "NodePrefs.h" |
|||
|
|||
enum class UIEventType { |
|||
none, |
|||
contactMessage, |
|||
channelMessage, |
|||
roomMessage, |
|||
newContactMessage, |
|||
ack |
|||
}; |
|||
|
|||
class AbstractUITask { |
|||
protected: |
|||
mesh::MainBoard* _board; |
|||
BaseSerialInterface* _serial; |
|||
bool _connected; |
|||
|
|||
AbstractUITask(mesh::MainBoard* board, BaseSerialInterface* serial) : _board(board), _serial(serial) { |
|||
_connected = false; |
|||
} |
|||
|
|||
public: |
|||
void setHasConnection(bool connected) { _connected = connected; } |
|||
bool hasConnection() const { return _connected; } |
|||
uint16_t getBattMilliVolts() const { return _board->getBattMilliVolts(); } |
|||
bool isSerialEnabled() const { return _serial->isEnabled(); } |
|||
void enableSerial() { _serial->enable(); } |
|||
void disableSerial() { _serial->disable(); } |
|||
virtual void msgRead(int msgcount) = 0; |
|||
virtual void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount) = 0; |
|||
virtual void soundBuzzer(UIEventType bet = UIEventType::none) = 0; |
|||
virtual void loop() = 0; |
|||
}; |
|||
@ -0,0 +1,597 @@ |
|||
#include "UITask.h" |
|||
#include <helpers/TxtDataHelpers.h> |
|||
#include "../MyMesh.h" |
|||
#include "target.h" |
|||
|
|||
#define AUTO_OFF_MILLIS 15000 // 15 seconds
|
|||
#define BOOT_SCREEN_MILLIS 3000 // 3 seconds
|
|||
|
|||
#ifdef PIN_STATUS_LED |
|||
#define LED_ON_MILLIS 20 |
|||
#define LED_ON_MSG_MILLIS 200 |
|||
#define LED_CYCLE_MILLIS 4000 |
|||
#endif |
|||
|
|||
#define LONG_PRESS_MILLIS 1200 |
|||
|
|||
#ifndef UI_RECENT_LIST_SIZE |
|||
#define UI_RECENT_LIST_SIZE 4 |
|||
#endif |
|||
|
|||
#define PRESS_LABEL "long press" |
|||
|
|||
#include "icons.h" |
|||
|
|||
class SplashScreen : public UIScreen { |
|||
UITask* _task; |
|||
unsigned long dismiss_after; |
|||
char _version_info[12]; |
|||
|
|||
public: |
|||
SplashScreen(UITask* task) : _task(task) { |
|||
// strip off dash and commit hash by changing dash to null terminator
|
|||
// e.g: v1.2.3-abcdef -> v1.2.3
|
|||
const char *ver = FIRMWARE_VERSION; |
|||
const char *dash = strchr(ver, '-'); |
|||
|
|||
int len = dash ? dash - ver : strlen(ver); |
|||
if (len >= sizeof(_version_info)) len = sizeof(_version_info) - 1; |
|||
memcpy(_version_info, ver, len); |
|||
_version_info[len] = 0; |
|||
|
|||
dismiss_after = millis() + BOOT_SCREEN_MILLIS; |
|||
} |
|||
|
|||
int render(DisplayDriver& display) override { |
|||
// meshcore logo
|
|||
display.setColor(DisplayDriver::BLUE); |
|||
int logoWidth = 128; |
|||
display.drawXbm((display.width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13); |
|||
|
|||
// version info
|
|||
display.setColor(DisplayDriver::LIGHT); |
|||
display.setTextSize(2); |
|||
display.drawTextCentered(display.width()/2, 22, _version_info); |
|||
|
|||
display.setTextSize(1); |
|||
display.drawTextCentered(display.width()/2, 42, FIRMWARE_BUILD_DATE); |
|||
|
|||
return 1000; |
|||
} |
|||
|
|||
void poll() override { |
|||
if (millis() >= dismiss_after) { |
|||
_task->gotoHomeScreen(); |
|||
} |
|||
} |
|||
}; |
|||
|
|||
class HomeScreen : public UIScreen { |
|||
enum HomePage { |
|||
FIRST, |
|||
RECENT, |
|||
RADIO, |
|||
BLUETOOTH, |
|||
ADVERT, |
|||
SHUTDOWN, |
|||
Count // keep as last
|
|||
}; |
|||
|
|||
UITask* _task; |
|||
mesh::RTCClock* _rtc; |
|||
SensorManager* _sensors; |
|||
NodePrefs* _node_prefs; |
|||
uint8_t _page; |
|||
bool _shutdown_init; |
|||
AdvertPath recent[UI_RECENT_LIST_SIZE]; |
|||
|
|||
void renderBatteryIndicator(DisplayDriver& display, uint16_t batteryMilliVolts) { |
|||
// Convert millivolts to percentage
|
|||
const int minMilliVolts = 3000; // Minimum voltage (e.g., 3.0V)
|
|||
const int maxMilliVolts = 4200; // Maximum voltage (e.g., 4.2V)
|
|||
int batteryPercentage = ((batteryMilliVolts - minMilliVolts) * 100) / (maxMilliVolts - minMilliVolts); |
|||
if (batteryPercentage < 0) batteryPercentage = 0; // Clamp to 0%
|
|||
if (batteryPercentage > 100) batteryPercentage = 100; // Clamp to 100%
|
|||
|
|||
// battery icon
|
|||
int iconWidth = 24; |
|||
int iconHeight = 10; |
|||
int iconX = display.width() - iconWidth - 5; // Position the icon near the top-right corner
|
|||
int iconY = 0; |
|||
display.setColor(DisplayDriver::GREEN); |
|||
|
|||
// battery outline
|
|||
display.drawRect(iconX, iconY, iconWidth, iconHeight); |
|||
|
|||
// battery "cap"
|
|||
display.fillRect(iconX + iconWidth, iconY + (iconHeight / 4), 3, iconHeight / 2); |
|||
|
|||
// fill the battery based on the percentage
|
|||
int fillWidth = (batteryPercentage * (iconWidth - 4)) / 100; |
|||
display.fillRect(iconX + 2, iconY + 2, fillWidth, iconHeight - 4); |
|||
} |
|||
|
|||
public: |
|||
HomeScreen(UITask* task, mesh::RTCClock* rtc, SensorManager* sensors, NodePrefs* node_prefs) |
|||
: _task(task), _rtc(rtc), _sensors(sensors), _node_prefs(node_prefs), _page(0), _shutdown_init(false) { } |
|||
|
|||
void poll() override { |
|||
if (_shutdown_init && !_task->isButtonPressed()) { // must wait for USR button to be released
|
|||
_task->shutdown(); |
|||
} |
|||
} |
|||
|
|||
int render(DisplayDriver& display) override { |
|||
char tmp[80]; |
|||
// node name
|
|||
display.setCursor(0, 0); |
|||
display.setTextSize(1); |
|||
display.setColor(DisplayDriver::GREEN); |
|||
display.print(_node_prefs->node_name); |
|||
|
|||
// battery voltage
|
|||
renderBatteryIndicator(display, _task->getBattMilliVolts()); |
|||
|
|||
// curr page indicator
|
|||
int y = 14; |
|||
int x = display.width() / 2 - 25; |
|||
for (uint8_t i = 0; i < HomePage::Count; i++, x += 10) { |
|||
if (i == _page) { |
|||
display.fillRect(x-1, y-1, 3, 3); |
|||
} else { |
|||
display.fillRect(x, y, 1, 1); |
|||
} |
|||
} |
|||
|
|||
if (_page == HomePage::FIRST) { |
|||
display.setColor(DisplayDriver::YELLOW); |
|||
display.setTextSize(2); |
|||
sprintf(tmp, "MSG: %d", _task->getMsgCount()); |
|||
display.drawTextCentered(display.width() / 2, 20, tmp); |
|||
|
|||
if (_task->hasConnection()) { |
|||
display.setColor(DisplayDriver::GREEN); |
|||
display.setTextSize(1); |
|||
display.drawTextCentered(display.width() / 2, 43, "< Connected >"); |
|||
} else if (the_mesh.getBLEPin() != 0) { // BT pin
|
|||
display.setColor(DisplayDriver::RED); |
|||
display.setTextSize(2); |
|||
sprintf(tmp, "Pin:%d", the_mesh.getBLEPin()); |
|||
display.drawTextCentered(display.width() / 2, 43, tmp); |
|||
} |
|||
} else if (_page == HomePage::RECENT) { |
|||
the_mesh.getRecentlyHeard(recent, UI_RECENT_LIST_SIZE); |
|||
display.setColor(DisplayDriver::GREEN); |
|||
int y = 20; |
|||
for (int i = 0; i < UI_RECENT_LIST_SIZE; i++, y += 11) { |
|||
auto a = &recent[i]; |
|||
if (a->name[0] == 0) continue; // empty slot
|
|||
display.setCursor(0, y); |
|||
display.print(a->name); |
|||
int secs = _rtc->getCurrentTime() - a->recv_timestamp; |
|||
if (secs < 60) { |
|||
sprintf(tmp, "%ds", secs); |
|||
} else if (secs < 60*60) { |
|||
sprintf(tmp, "%dm", secs / 60); |
|||
} else { |
|||
sprintf(tmp, "%dh", secs / (60*60)); |
|||
} |
|||
display.setCursor(display.width() - display.getTextWidth(tmp) - 1, y); |
|||
display.print(tmp); |
|||
} |
|||
} else if (_page == HomePage::RADIO) { |
|||
display.setColor(DisplayDriver::YELLOW); |
|||
display.setTextSize(1); |
|||
// freq / sf
|
|||
display.setCursor(0, 20); |
|||
sprintf(tmp, "FQ: %06.3f SF: %d", _node_prefs->freq, _node_prefs->sf); |
|||
display.print(tmp); |
|||
|
|||
display.setCursor(0, 31); |
|||
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr); |
|||
display.print(tmp); |
|||
|
|||
// tx power, noise floor
|
|||
display.setCursor(0, 42); |
|||
sprintf(tmp, "TX: %ddBm", _node_prefs->tx_power_dbm); |
|||
display.print(tmp); |
|||
display.setCursor(0, 53); |
|||
sprintf(tmp, "Noise floor: %d", radio_driver.getNoiseFloor()); |
|||
display.print(tmp); |
|||
} else if (_page == HomePage::BLUETOOTH) { |
|||
display.setColor(DisplayDriver::GREEN); |
|||
display.drawXbm((display.width() - 32) / 2, 18, |
|||
_task->isSerialEnabled() ? bluetooth_on : bluetooth_off, |
|||
32, 32); |
|||
display.setTextSize(1); |
|||
display.drawTextCentered(display.width() / 2, 64 - 11, "toggle: " PRESS_LABEL); |
|||
} else if (_page == HomePage::ADVERT) { |
|||
display.setColor(DisplayDriver::GREEN); |
|||
display.drawXbm((display.width() - 32) / 2, 18, advert_icon, 32, 32); |
|||
display.drawTextCentered(display.width() / 2, 64 - 11, "advert: " PRESS_LABEL); |
|||
} else if (_page == HomePage::SHUTDOWN) { |
|||
display.setColor(DisplayDriver::GREEN); |
|||
display.setTextSize(1); |
|||
if (_shutdown_init) { |
|||
display.drawTextCentered(display.width() / 2, 34, "hibernating..."); |
|||
} else { |
|||
display.drawXbm((display.width() - 32) / 2, 18, power_icon, 32, 32); |
|||
display.drawTextCentered(display.width() / 2, 64 - 11, "hibernate: " PRESS_LABEL); |
|||
} |
|||
} |
|||
return 5000; // next render after 5000 ms
|
|||
} |
|||
|
|||
bool handleInput(char c) override { |
|||
if (c == KEY_LEFT) { |
|||
_page = (_page + HomePage::Count - 1) % HomePage::Count; |
|||
return true; |
|||
} |
|||
if (c == KEY_RIGHT || c == KEY_SELECT) { |
|||
_page = (_page + 1) % HomePage::Count; |
|||
if (_page == HomePage::RECENT) { |
|||
_task->showAlert("Recent adverts", 800); |
|||
} |
|||
return true; |
|||
} |
|||
if (c == KEY_ENTER && _page == HomePage::BLUETOOTH) { |
|||
if (_task->isSerialEnabled()) { // toggle Bluetooth on/off
|
|||
_task->disableSerial(); |
|||
} else { |
|||
_task->enableSerial(); |
|||
} |
|||
return true; |
|||
} |
|||
if (c == KEY_ENTER && _page == HomePage::ADVERT) { |
|||
#ifdef PIN_BUZZER |
|||
_task->soundBuzzer(UIEventType::ack); |
|||
#endif |
|||
if (the_mesh.advert()) { |
|||
_task->showAlert("Advert sent!", 1000); |
|||
} else { |
|||
_task->showAlert("Advert failed..", 1000); |
|||
} |
|||
return true; |
|||
} |
|||
if (c == KEY_ENTER && _page == HomePage::SHUTDOWN) { |
|||
_shutdown_init = true; // need to wait for button to be released
|
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
}; |
|||
|
|||
class MsgPreviewScreen : public UIScreen { |
|||
UITask* _task; |
|||
mesh::RTCClock* _rtc; |
|||
|
|||
struct MsgEntry { |
|||
uint32_t timestamp; |
|||
char origin[62]; |
|||
char msg[78]; |
|||
}; |
|||
#define MAX_UNREAD_MSGS 32 |
|||
int num_unread; |
|||
MsgEntry unread[MAX_UNREAD_MSGS]; |
|||
|
|||
public: |
|||
MsgPreviewScreen(UITask* task, mesh::RTCClock* rtc) : _task(task), _rtc(rtc) { num_unread = 0; } |
|||
|
|||
void addPreview(uint8_t path_len, const char* from_name, const char* msg) { |
|||
if (num_unread >= MAX_UNREAD_MSGS) return; // full
|
|||
|
|||
auto p = &unread[num_unread++]; |
|||
p->timestamp = _rtc->getCurrentTime(); |
|||
if (path_len == 0xFF) { |
|||
sprintf(p->origin, "(D) %s:", from_name); |
|||
} else { |
|||
sprintf(p->origin, "(%d) %s:", (uint32_t) path_len, from_name); |
|||
} |
|||
StrHelper::strncpy(p->msg, msg, sizeof(p->msg)); |
|||
} |
|||
|
|||
int render(DisplayDriver& display) override { |
|||
char tmp[16]; |
|||
display.setCursor(0, 0); |
|||
display.setTextSize(1); |
|||
display.setColor(DisplayDriver::GREEN); |
|||
sprintf(tmp, "Unread: %d", num_unread); |
|||
display.print(tmp); |
|||
|
|||
auto p = &unread[0]; |
|||
|
|||
int secs = _rtc->getCurrentTime() - p->timestamp; |
|||
if (secs < 60) { |
|||
sprintf(tmp, "%ds", secs); |
|||
} else if (secs < 60*60) { |
|||
sprintf(tmp, "%dm", secs / 60); |
|||
} else { |
|||
sprintf(tmp, "%dh", secs / (60*60)); |
|||
} |
|||
display.setCursor(display.width() - display.getTextWidth(tmp) - 2, 0); |
|||
display.print(tmp); |
|||
|
|||
display.drawRect(0, 11, display.width(), 1); // horiz line
|
|||
|
|||
display.setCursor(0, 14); |
|||
display.setColor(DisplayDriver::YELLOW); |
|||
display.print(p->origin); |
|||
|
|||
display.setCursor(0, 25); |
|||
display.setColor(DisplayDriver::LIGHT); |
|||
display.printWordWrap(p->msg, display.width()); |
|||
|
|||
return 1000; // next render after 1000 ms
|
|||
} |
|||
|
|||
bool handleInput(char c) override { |
|||
if (c == KEY_SELECT || c == KEY_RIGHT) { |
|||
num_unread--; |
|||
if (num_unread == 0) { |
|||
_task->gotoHomeScreen(); |
|||
} else { |
|||
// delete first/curr item from unread queue
|
|||
for (int i = 0; i < num_unread; i++) { |
|||
unread[i] = unread[i + 1]; |
|||
} |
|||
} |
|||
return true; |
|||
} |
|||
if (c == KEY_ENTER) { |
|||
num_unread = 0; // clear unread queue
|
|||
_task->gotoHomeScreen(); |
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
}; |
|||
|
|||
void UITask::begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs) { |
|||
_display = display; |
|||
_sensors = sensors; |
|||
_auto_off = millis() + AUTO_OFF_MILLIS; |
|||
|
|||
#if defined(PIN_USER_BTN) |
|||
user_btn.begin(); |
|||
#endif |
|||
|
|||
_node_prefs = node_prefs; |
|||
if (_display != NULL) { |
|||
_display->turnOn(); |
|||
} |
|||
|
|||
#ifdef PIN_BUZZER |
|||
buzzer.begin(); |
|||
#endif |
|||
|
|||
ui_started_at = millis(); |
|||
_alert_expiry = 0; |
|||
|
|||
splash = new SplashScreen(this); |
|||
home = new HomeScreen(this, &rtc_clock, sensors, node_prefs); |
|||
msg_preview = new MsgPreviewScreen(this, &rtc_clock); |
|||
setCurrScreen(splash); |
|||
} |
|||
|
|||
void UITask::showAlert(const char* text, int duration_millis) { |
|||
strcpy(_alert, text); |
|||
_alert_expiry = millis() + duration_millis; |
|||
} |
|||
|
|||
void UITask::soundBuzzer(UIEventType bet) { |
|||
#if defined(PIN_BUZZER) |
|||
switch(bet){ |
|||
case UIEventType::contactMessage: |
|||
// gemini's pick
|
|||
buzzer.play("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7"); |
|||
break; |
|||
case UIEventType::channelMessage: |
|||
buzzer.play("kerplop:d=16,o=6,b=120:32g#,32c#"); |
|||
break; |
|||
case UIEventType::ack: |
|||
buzzer.play("ack:d=32,o=8,b=120:c"); |
|||
break; |
|||
case UIEventType::roomMessage: |
|||
case UIEventType::newContactMessage: |
|||
case UIEventType::none: |
|||
default: |
|||
break; |
|||
} |
|||
#endif |
|||
} |
|||
|
|||
void UITask::msgRead(int msgcount) { |
|||
_msgcount = msgcount; |
|||
if (msgcount == 0) { |
|||
gotoHomeScreen(); |
|||
} |
|||
} |
|||
|
|||
void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount) { |
|||
_msgcount = msgcount; |
|||
|
|||
((MsgPreviewScreen *) msg_preview)->addPreview(path_len, from_name, text); |
|||
setCurrScreen(msg_preview); |
|||
|
|||
if (_display != NULL) { |
|||
if (!_display->isOn()) _display->turnOn(); |
|||
_auto_off = millis() + AUTO_OFF_MILLIS; // extend the auto-off timer
|
|||
_next_refresh = 0; // trigger refresh
|
|||
} |
|||
} |
|||
|
|||
void UITask::userLedHandler() { |
|||
#ifdef PIN_STATUS_LED |
|||
static int state = 0; |
|||
static int next_change = 0; |
|||
static int last_increment = 0; |
|||
|
|||
int cur_time = millis(); |
|||
if (cur_time > next_change) { |
|||
if (state == 0) { |
|||
state = 1; |
|||
if (_msgcount > 0) { |
|||
last_increment = LED_ON_MSG_MILLIS; |
|||
} else { |
|||
last_increment = LED_ON_MILLIS; |
|||
} |
|||
next_change = cur_time + last_increment; |
|||
} else { |
|||
state = 0; |
|||
next_change = cur_time + LED_CYCLE_MILLIS - last_increment; |
|||
} |
|||
digitalWrite(PIN_STATUS_LED, state); |
|||
} |
|||
#endif |
|||
} |
|||
|
|||
void UITask::setCurrScreen(UIScreen* c) { |
|||
curr = c; |
|||
_next_refresh = 0; |
|||
} |
|||
|
|||
/*
|
|||
hardware-agnostic pre-shutdown activity should be done here |
|||
*/ |
|||
void UITask::shutdown(bool restart){ |
|||
|
|||
#ifdef PIN_BUZZER |
|||
/* note: we have a choice here -
|
|||
we can do a blocking buzzer.loop() with non-deterministic consequences |
|||
or we can set a flag and delay the shutdown for a couple of seconds |
|||
while a non-blocking buzzer.loop() plays out in UITask::loop() |
|||
*/ |
|||
buzzer.shutdown(); |
|||
uint32_t buzzer_timer = millis(); // fail-safe shutdown
|
|||
while (buzzer.isPlaying() && (millis() - 2500) < buzzer_timer) |
|||
buzzer.loop(); |
|||
|
|||
#endif // PIN_BUZZER
|
|||
|
|||
if (restart) { |
|||
_board->reboot(); |
|||
} else { |
|||
_display->turnOff(); |
|||
_board->powerOff(); |
|||
} |
|||
} |
|||
|
|||
bool UITask::isButtonPressed() const { |
|||
#ifdef PIN_USER_BTN |
|||
return user_btn.isPressed(); |
|||
#else |
|||
return false; |
|||
#endif |
|||
} |
|||
|
|||
void UITask::loop() { |
|||
char c = 0; |
|||
#if defined(PIN_USER_BTN) |
|||
int ev = user_btn.check(); |
|||
if (ev == BUTTON_EVENT_CLICK) { |
|||
c = checkDisplayOn(KEY_SELECT); |
|||
} else if (ev == BUTTON_EVENT_LONG_PRESS) { |
|||
c = handleLongPress(KEY_ENTER); |
|||
} |
|||
#endif |
|||
#if defined(WIO_TRACKER_L1) |
|||
ev = joystick_left.check(); |
|||
if (ev == BUTTON_EVENT_CLICK) { |
|||
c = checkDisplayOn(KEY_LEFT); |
|||
} else if (ev == BUTTON_EVENT_LONG_PRESS) { |
|||
c = handleLongPress(KEY_LEFT); |
|||
} |
|||
ev = joystick_right.check(); |
|||
if (ev == BUTTON_EVENT_CLICK) { |
|||
c = checkDisplayOn(KEY_RIGHT); |
|||
} else if (ev == BUTTON_EVENT_LONG_PRESS) { |
|||
c = handleLongPress(KEY_RIGHT); |
|||
} |
|||
#endif |
|||
|
|||
if (c != 0 && curr) { |
|||
curr->handleInput(c); |
|||
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
|
|||
_next_refresh = 0; // trigger refresh
|
|||
} |
|||
|
|||
userLedHandler(); |
|||
|
|||
#ifdef PIN_BUZZER |
|||
if (buzzer.isPlaying()) buzzer.loop(); |
|||
#endif |
|||
|
|||
if (curr) curr->poll(); |
|||
|
|||
if (_display != NULL && _display->isOn()) { |
|||
if (millis() >= _next_refresh && curr) { |
|||
_display->startFrame(); |
|||
int delay_millis = curr->render(*_display); |
|||
if (millis() < _alert_expiry) { // render alert popup
|
|||
_display->setTextSize(1); |
|||
int y = _display->height() / 3; |
|||
int p = _display->height() / 32; |
|||
_display->setColor(DisplayDriver::DARK); |
|||
_display->fillRect(p, y, _display->width() - p*2, y); |
|||
_display->setColor(DisplayDriver::LIGHT); // draw box border
|
|||
_display->drawRect(p, y, _display->width() - p*2, y); |
|||
_display->drawTextCentered(_display->width() / 2, y + p*3, _alert); |
|||
_next_refresh = _alert_expiry; // will need refresh when alert is dismissed
|
|||
} else { |
|||
_next_refresh = millis() + delay_millis; |
|||
} |
|||
_display->endFrame(); |
|||
} |
|||
if (millis() > _auto_off) { |
|||
_display->turnOff(); |
|||
} |
|||
} |
|||
|
|||
#ifdef AUTO_SHUTDOWN_MILLIVOLTS |
|||
if (millis() > next_batt_chck) { |
|||
uint16_t milliVolts = getBattMilliVolts(); |
|||
if (milliVolts > 0 && milliVolts < AUTO_SHUTDOWN_MILLIVOLTS) { |
|||
shutdown(); |
|||
} |
|||
next_batt_chck = millis() + 8000; |
|||
} |
|||
#endif |
|||
} |
|||
|
|||
char UITask::checkDisplayOn(char c) { |
|||
if (_display != NULL) { |
|||
if (!_display->isOn()) { |
|||
_display->turnOn(); // turn display on and consume event
|
|||
c = 0; |
|||
} |
|||
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
|
|||
_next_refresh = 0; // trigger refresh
|
|||
} |
|||
return c; |
|||
} |
|||
|
|||
char UITask::handleLongPress(char c) { |
|||
if (millis() - ui_started_at < 8000) { // long press in first 8 seconds since startup -> CLI/rescue
|
|||
the_mesh.enterCLIRescue(); |
|||
c = 0; // consume event
|
|||
} |
|||
return c; |
|||
} |
|||
|
|||
/*
|
|||
void UITask::handleButtonTriplePress() { |
|||
MESH_DEBUG_PRINTLN("UITask: triple press triggered"); |
|||
// Toggle buzzer quiet mode
|
|||
#ifdef PIN_BUZZER |
|||
if (buzzer.isQuiet()) { |
|||
buzzer.quiet(false); |
|||
soundBuzzer(UIEventType::ack); |
|||
showAlert("Buzzer: ON", 600); |
|||
} else { |
|||
buzzer.quiet(true); |
|||
showAlert("Buzzer: OFF", 600); |
|||
} |
|||
_next_refresh = 0; // trigger refresh
|
|||
#endif |
|||
} |
|||
*/ |
|||
@ -0,0 +1,65 @@ |
|||
#pragma once |
|||
|
|||
#include <MeshCore.h> |
|||
#include <helpers/ui/DisplayDriver.h> |
|||
#include <helpers/ui/UIScreen.h> |
|||
#include <helpers/SensorManager.h> |
|||
#include <helpers/BaseSerialInterface.h> |
|||
#include <Arduino.h> |
|||
|
|||
#ifdef PIN_BUZZER |
|||
#include <helpers/ui/buzzer.h> |
|||
#endif |
|||
|
|||
#include "../AbstractUITask.h" |
|||
#include "../NodePrefs.h" |
|||
|
|||
class UITask : public AbstractUITask { |
|||
DisplayDriver* _display; |
|||
SensorManager* _sensors; |
|||
#ifdef PIN_BUZZER |
|||
genericBuzzer buzzer; |
|||
#endif |
|||
unsigned long _next_refresh, _auto_off; |
|||
NodePrefs* _node_prefs; |
|||
char _alert[80]; |
|||
unsigned long _alert_expiry; |
|||
int _msgcount; |
|||
unsigned long ui_started_at, next_batt_chck; |
|||
|
|||
UIScreen* splash; |
|||
UIScreen* home; |
|||
UIScreen* msg_preview; |
|||
UIScreen* curr; |
|||
|
|||
void userLedHandler(); |
|||
|
|||
// Button action handlers
|
|||
char checkDisplayOn(char c); |
|||
char handleLongPress(char c); |
|||
|
|||
void setCurrScreen(UIScreen* c); |
|||
|
|||
public: |
|||
|
|||
UITask(mesh::MainBoard* board, BaseSerialInterface* serial) : AbstractUITask(board, serial), _display(NULL), _sensors(NULL) { |
|||
next_batt_chck = _next_refresh = 0; |
|||
ui_started_at = 0; |
|||
curr = NULL; |
|||
} |
|||
void begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs); |
|||
|
|||
void gotoHomeScreen() { setCurrScreen(home); } |
|||
void showAlert(const char* text, int duration_millis); |
|||
int getMsgCount() const { return _msgcount; } |
|||
bool hasDisplay() const { return _display != NULL; } |
|||
bool isButtonPressed() const; |
|||
|
|||
// from AbstractUITask
|
|||
void msgRead(int msgcount) override; |
|||
void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount) override; |
|||
void soundBuzzer(UIEventType bet = UIEventType::none) override; |
|||
void loop() override; |
|||
|
|||
void shutdown(bool restart = false); |
|||
}; |
|||
@ -0,0 +1,118 @@ |
|||
#pragma once |
|||
|
|||
#include <stdint.h> |
|||
|
|||
// 'meshcore', 128x13px
|
|||
static const uint8_t meshcore_logo [] = { |
|||
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, |
|||
}; |
|||
|
|||
static const uint8_t bluetooth_on[] = { |
|||
0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x30, 0x00, 0x00, |
|||
0x00, 0x3C, 0x00, 0x00, |
|||
0x00, 0x3E, 0x00, 0x00, |
|||
0x00, 0x3F, 0x80, 0x00, |
|||
0x00, 0x3F, 0xC0, 0x00, |
|||
0x00, 0x3B, 0xE0, 0x00, |
|||
0x30, 0x38, 0xF8, 0x00, |
|||
0x3C, 0x38, 0x7C, 0x00, |
|||
0x3E, 0x38, 0x7C, 0x00, |
|||
0x1F, 0xB8, 0xF8, 0x70, |
|||
0x07, 0xF9, 0xF0, 0x78, |
|||
0x03, 0xFF, 0xC0, 0x78, |
|||
0x00, 0xFF, 0x80, 0x3C, |
|||
0x00, 0x7F, 0x07, 0x1C, |
|||
0x00, 0x7E, 0x07, 0x1C, |
|||
0x03, 0xFF, 0x82, 0x1C, |
|||
0x03, 0xFF, 0xC0, 0x78, |
|||
0x07, 0xFB, 0xE0, 0x78, |
|||
0x0F, 0xB8, 0xF8, 0x70, |
|||
0x3E, 0x38, 0x7C, 0x00, |
|||
0x3C, 0x38, 0x7C, 0x00, |
|||
0x38, 0x38, 0xF8, 0x00, |
|||
0x00, 0x39, 0xF0, 0x00, |
|||
0x00, 0x3F, 0xC0, 0x00, |
|||
0x00, 0x3F, 0x80, 0x00, |
|||
0x00, 0x3E, 0x00, 0x00, |
|||
0x00, 0x3C, 0x00, 0x00, |
|||
0x00, 0x38, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, |
|||
}; |
|||
|
|||
static const uint8_t bluetooth_off[] = { |
|||
0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x03, 0x80, 0x00, |
|||
0x00, 0x03, 0xC0, 0x00, |
|||
0x00, 0x03, 0xE0, 0x00, |
|||
0x38, 0x03, 0xF8, 0x00, |
|||
0x3C, 0x03, 0xFC, 0x00, |
|||
0x3E, 0x03, 0xBF, 0x00, |
|||
0x0F, 0x83, 0x8F, 0x80, |
|||
0x07, 0xC3, 0x87, 0xC0, |
|||
0x03, 0xF0, 0x03, 0xC0, |
|||
0x00, 0xF8, 0x0F, 0x80, |
|||
0x00, 0x7C, 0x0F, 0x00, |
|||
0x00, 0x1F, 0x0E, 0x00, |
|||
0x00, 0x0F, 0x80, 0x00, |
|||
0x00, 0x07, 0xE0, 0x00, |
|||
0x00, 0x07, 0xF0, 0x00, |
|||
0x00, 0x0F, 0xF8, 0x00, |
|||
0x00, 0x3F, 0xBE, 0x00, |
|||
0x00, 0x7F, 0x9F, 0x00, |
|||
0x00, 0xFB, 0x8F, 0xC0, |
|||
0x03, 0xE3, 0x83, 0xE0, |
|||
0x03, 0xC3, 0x87, 0xF0, |
|||
0x03, 0x83, 0x8F, 0xFC, |
|||
0x00, 0x03, 0xBF, 0x3C, |
|||
0x00, 0x03, 0xFC, 0x1C, |
|||
0x00, 0x03, 0xF8, 0x00, |
|||
0x00, 0x03, 0xE0, 0x00, |
|||
0x00, 0x03, 0xC0, 0x00, |
|||
0x00, 0x03, 0x80, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, |
|||
}; |
|||
|
|||
static const uint8_t power_icon[] = { |
|||
0x00, 0x01, 0x80, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, |
|||
0x00, 0x33, 0xCC, 0x00, 0x00, 0xF3, 0xCF, 0x00, 0x01, 0xF3, 0xCF, 0x80, |
|||
0x03, 0xF3, 0xCF, 0xC0, 0x07, 0xF3, 0xCF, 0xE0, 0x0F, 0xE3, 0xC7, 0xF0, |
|||
0x1F, 0xC3, 0xC3, 0xF8, 0x1F, 0x83, 0xC1, 0xF8, 0x3F, 0x03, 0xC0, 0xFC, |
|||
0x3E, 0x03, 0xC0, 0x7C, 0x3E, 0x03, 0xC0, 0x7C, 0x7E, 0x01, 0x80, 0x7E, |
|||
0x7C, 0x00, 0x00, 0x3E, 0x7C, 0x00, 0x00, 0x3E, 0x7C, 0x00, 0x00, 0x3E, |
|||
0x7C, 0x00, 0x00, 0x3E, 0x7C, 0x00, 0x00, 0x3E, 0x3E, 0x00, 0x00, 0x7C, |
|||
0x3E, 0x00, 0x00, 0x7C, 0x3F, 0x00, 0x00, 0xFC, 0x1F, 0x80, 0x01, 0xF8, |
|||
0x1F, 0xC0, 0x03, 0xF8, 0x0F, 0xE0, 0x07, 0xF0, 0x0F, 0xF8, 0x1F, 0xF0, |
|||
0x07, 0xFF, 0xFF, 0xE0, 0x03, 0xFF, 0xFF, 0xC0, 0x00, 0xFF, 0xFF, 0x00, |
|||
0x00, 0x3F, 0xFC, 0x00, 0x00, 0x0F, 0xF0, 0x00, |
|||
}; |
|||
|
|||
static const uint8_t advert_icon[] = { |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x30, |
|||
0x1C, 0x00, 0x00, 0x38, 0x18, 0x00, 0x00, 0x18, 0x30, 0x00, 0x00, 0x0C, |
|||
0x30, 0x60, 0x06, 0x0C, 0x60, 0xE0, 0x07, 0x06, 0x61, 0xC0, 0x03, 0x86, |
|||
0xE1, 0x81, 0x81, 0x87, 0xC3, 0x07, 0xE0, 0xC3, 0xC3, 0x0F, 0xF0, 0xC3, |
|||
0xC3, 0x0F, 0xF0, 0xC3, 0xC3, 0x0F, 0xF0, 0xC3, 0xC3, 0x0F, 0xF0, 0xC3, |
|||
0xC3, 0x07, 0xE0, 0xC3, 0xC1, 0x83, 0xC1, 0x83, 0x61, 0x80, 0x01, 0x86, |
|||
0x60, 0xC0, 0x03, 0x06, 0x70, 0xE0, 0x07, 0x0E, 0x30, 0x40, 0x02, 0x0C, |
|||
0x38, 0x00, 0x00, 0x1C, 0x18, 0x00, 0x00, 0x18, 0x0C, 0x00, 0x00, 0x30, |
|||
0x04, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
}; |
|||
@ -1,8 +1,7 @@ |
|||
#include "UITask.h" |
|||
#include <Arduino.h> |
|||
#include <helpers/TxtDataHelpers.h> |
|||
#include "NodePrefs.h" |
|||
#include "MyMesh.h" |
|||
#include "../MyMesh.h" |
|||
|
|||
#define AUTO_OFF_MILLIS 15000 // 15 seconds
|
|||
#define BOOT_SCREEN_MILLIS 3000 // 3 seconds
|
|||
@ -0,0 +1,16 @@ |
|||
{ |
|||
"name": "MeshCore", |
|||
"version" : "1.7.4", |
|||
"dependencies": { |
|||
"SPI": "*", |
|||
"Wire": "*", |
|||
"jgromes/RadioLib": "^7.1.2", |
|||
"rweather/Crypto": "^0.4.0", |
|||
"adafruit/RTClib": "^2.1.3", |
|||
"melopero/Melopero RV3028": "^1.1.0", |
|||
"electroniccats/CayenneLPP": "1.4.0" |
|||
}, |
|||
"build": { |
|||
"extraScript": "build_as_lib.py" |
|||
} |
|||
} |
|||
@ -0,0 +1,75 @@ |
|||
#include "MomentaryButton.h" |
|||
|
|||
MomentaryButton::MomentaryButton(int8_t pin, int long_press_millis, bool reverse, bool pulldownup) { |
|||
_pin = pin; |
|||
_reverse = reverse; |
|||
_pull = pulldownup; |
|||
down_at = 0; |
|||
prev = _reverse ? HIGH : LOW; |
|||
cancel = 0; |
|||
_long_millis = long_press_millis; |
|||
} |
|||
|
|||
void MomentaryButton::begin() { |
|||
if (_pin >= 0) { |
|||
pinMode(_pin, _pull ? (_reverse ? INPUT_PULLUP : INPUT_PULLDOWN) : INPUT); |
|||
} |
|||
} |
|||
|
|||
bool MomentaryButton::isPressed() const { |
|||
return isPressed(digitalRead(_pin)); |
|||
} |
|||
|
|||
void MomentaryButton::cancelClick() { |
|||
cancel = 1; |
|||
} |
|||
|
|||
bool MomentaryButton::isPressed(int level) const { |
|||
if (_reverse) { |
|||
return level == LOW; |
|||
} else { |
|||
return level != LOW; |
|||
} |
|||
} |
|||
|
|||
int MomentaryButton::check(bool repeat_click) { |
|||
if (_pin < 0) return BUTTON_EVENT_NONE; |
|||
|
|||
int event = BUTTON_EVENT_NONE; |
|||
int btn = digitalRead(_pin); |
|||
if (btn != prev) { |
|||
if (isPressed(btn)) { |
|||
down_at = millis(); |
|||
} else { |
|||
// button UP
|
|||
if (_long_millis > 0) { |
|||
if (down_at > 0 && (unsigned long)(millis() - down_at) < _long_millis) { // only a CLICK if still within the long_press millis
|
|||
event = BUTTON_EVENT_CLICK; |
|||
} |
|||
} else { |
|||
event = BUTTON_EVENT_CLICK; // any UP results in CLICK event when NOT using long_press feature
|
|||
} |
|||
if (event == BUTTON_EVENT_CLICK && cancel) { |
|||
event = BUTTON_EVENT_NONE; |
|||
} |
|||
down_at = 0; |
|||
} |
|||
prev = btn; |
|||
} |
|||
if (!isPressed(btn) && cancel) { // always clear the pending 'cancel' once button is back in UP state
|
|||
cancel = 0; |
|||
} |
|||
|
|||
if (_long_millis > 0 && down_at > 0 && (unsigned long)(millis() - down_at) >= _long_millis) { |
|||
event = BUTTON_EVENT_LONG_PRESS; |
|||
down_at = 0; |
|||
} |
|||
if (down_at > 0 && repeat_click) { |
|||
unsigned long diff = (unsigned long)(millis() - down_at); |
|||
if (diff >= 700) { |
|||
event = BUTTON_EVENT_CLICK; // wait 700 millis before repeating the click events
|
|||
} |
|||
} |
|||
|
|||
return event; |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
#pragma once |
|||
|
|||
#include <Arduino.h> |
|||
|
|||
#define BUTTON_EVENT_NONE 0 |
|||
#define BUTTON_EVENT_CLICK 1 |
|||
#define BUTTON_EVENT_LONG_PRESS 2 |
|||
|
|||
class MomentaryButton { |
|||
int8_t _pin; |
|||
int8_t prev, cancel; |
|||
bool _reverse, _pull; |
|||
int _long_millis; |
|||
unsigned long down_at; |
|||
|
|||
bool isPressed(int level) const; |
|||
|
|||
public: |
|||
MomentaryButton(int8_t pin, int long_press_mills=0, bool reverse=false, bool pulldownup=false); |
|||
void begin(); |
|||
int check(bool repeat_click=false); // returns one of BUTTON_EVENT_*
|
|||
void cancelClick(); // suppress next BUTTON_EVENT_CLICK (if already in DOWN state)
|
|||
uint8_t getPin() { return _pin; } |
|||
bool isPressed() const; |
|||
}; |
|||
@ -0,0 +1,21 @@ |
|||
#pragma once |
|||
|
|||
#include "DisplayDriver.h" |
|||
|
|||
#define KEY_LEFT 0xB4 |
|||
#define KEY_UP 0xB5 |
|||
#define KEY_DOWN 0xB6 |
|||
#define KEY_RIGHT 0xB7 |
|||
#define KEY_SELECT 10 |
|||
#define KEY_ENTER 13 |
|||
#define KEY_BACK 27 // Esc
|
|||
|
|||
class UIScreen { |
|||
protected: |
|||
UIScreen() { } |
|||
public: |
|||
virtual int render(DisplayDriver& display) =0; // return value is number of millis until next render
|
|||
virtual bool handleInput(char c) { return false; } |
|||
virtual void poll() { } |
|||
}; |
|||
|
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue