mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-27 19:49:51 +00:00
Change System frame menu over to better match actions; added color picker for T114
This commit is contained in:
parent
8ce7cbd5c0
commit
3598c40aa5
@ -69,6 +69,8 @@ using graphics::Emote;
|
|||||||
using graphics::emotes;
|
using graphics::emotes;
|
||||||
using graphics::numEmotes;
|
using graphics::numEmotes;
|
||||||
|
|
||||||
|
extern uint16_t TFT_MESH;
|
||||||
|
|
||||||
#if HAS_WIFI && !defined(ARCH_PORTDUINO)
|
#if HAS_WIFI && !defined(ARCH_PORTDUINO)
|
||||||
#include "mesh/wifi/WiFiAPClient.h"
|
#include "mesh/wifi/WiFiAPClient.h"
|
||||||
#endif
|
#endif
|
||||||
@ -257,7 +259,7 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O
|
|||||||
ST7789_MISO, ST7789_SCK);
|
ST7789_MISO, ST7789_SCK);
|
||||||
#else
|
#else
|
||||||
dispdev = new ST7789Spi(&SPI1, ST7789_RESET, ST7789_RS, ST7789_NSS, GEOMETRY_RAWMODE, TFT_WIDTH, TFT_HEIGHT);
|
dispdev = new ST7789Spi(&SPI1, ST7789_RESET, ST7789_RS, ST7789_NSS, GEOMETRY_RAWMODE, TFT_WIDTH, TFT_HEIGHT);
|
||||||
static_cast<ST7789Spi *>(dispdev)->setRGB(COLOR565(255, 255, 128));
|
static_cast<ST7789Spi *>(dispdev)->setRGB(TFT_MESH);
|
||||||
#endif
|
#endif
|
||||||
#elif defined(USE_SSD1306)
|
#elif defined(USE_SSD1306)
|
||||||
dispdev = new SSD1306Wire(address.address, -1, -1, geometry,
|
dispdev = new SSD1306Wire(address.address, -1, -1, geometry,
|
||||||
@ -955,6 +957,9 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
// If no module requested focus, will show the first frame instead
|
// If no module requested focus, will show the first frame instead
|
||||||
ui->switchToFrame(fsi.positions.clock);
|
ui->switchToFrame(fsi.positions.clock);
|
||||||
break;
|
break;
|
||||||
|
case FOCUS_SYSTEM:
|
||||||
|
ui->switchToFrame(fsi.positions.memory);
|
||||||
|
break;
|
||||||
|
|
||||||
case FOCUS_PRESERVE:
|
case FOCUS_PRESERVE:
|
||||||
// No more adjustment — force stay on same index
|
// No more adjustment — force stay on same index
|
||||||
@ -1283,13 +1288,8 @@ int Screen::handleInputEvent(const InputEvent *event)
|
|||||||
} else if (event->inputEvent == INPUT_BROKER_SELECT) {
|
} else if (event->inputEvent == INPUT_BROKER_SELECT) {
|
||||||
if (this->ui->getUiState()->currentFrame == framesetInfo.positions.home) {
|
if (this->ui->getUiState()->currentFrame == framesetInfo.positions.home) {
|
||||||
menuHandler::homeBaseMenu();
|
menuHandler::homeBaseMenu();
|
||||||
#if HAS_TFT
|
|
||||||
} else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.memory) {
|
} else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.memory) {
|
||||||
menuHandler::switchToMUIMenu();
|
menuHandler::systemBaseMenu();
|
||||||
#else
|
|
||||||
} else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.memory) {
|
|
||||||
menuHandler::BuzzerModeMenu();
|
|
||||||
#endif
|
|
||||||
#if HAS_GPS
|
#if HAS_GPS
|
||||||
} else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.gps && gps) {
|
} else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.gps && gps) {
|
||||||
menuHandler::positionBaseMenu();
|
menuHandler::positionBaseMenu();
|
||||||
|
@ -25,6 +25,7 @@ class Screen
|
|||||||
FOCUS_TEXTMESSAGE,
|
FOCUS_TEXTMESSAGE,
|
||||||
FOCUS_MODULE, // Note: target module should call requestFocus(), otherwise no info about which module to focus
|
FOCUS_MODULE, // Note: target module should call requestFocus(), otherwise no info about which module to focus
|
||||||
FOCUS_CLOCK,
|
FOCUS_CLOCK,
|
||||||
|
FOCUS_SYSTEM,
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY);
|
explicit Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY);
|
||||||
@ -199,6 +200,7 @@ class Screen : public concurrency::OSThread
|
|||||||
CallbackObserver<Screen, AdminModule_ObserverData *>(this, &Screen::handleAdminMessage);
|
CallbackObserver<Screen, AdminModule_ObserverData *>(this, &Screen::handleAdminMessage);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
OLEDDisplay *getDisplayDevice() { return dispdev; }
|
||||||
explicit Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY);
|
explicit Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY);
|
||||||
size_t frameCount = 0; // Total number of active frames
|
size_t frameCount = 0; // Total number of active frames
|
||||||
~Screen();
|
~Screen();
|
||||||
@ -211,6 +213,7 @@ class Screen : public concurrency::OSThread
|
|||||||
FOCUS_TEXTMESSAGE,
|
FOCUS_TEXTMESSAGE,
|
||||||
FOCUS_MODULE, // Note: target module should call requestFocus(), otherwise no info about which module to focus
|
FOCUS_MODULE, // Note: target module should call requestFocus(), otherwise no info about which module to focus
|
||||||
FOCUS_CLOCK,
|
FOCUS_CLOCK,
|
||||||
|
FOCUS_SYSTEM,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Regenerate the normal set of frames, focusing a specific frame if requested
|
// Regenerate the normal set of frames, focusing a specific frame if requested
|
||||||
|
@ -15,7 +15,8 @@ extern SX1509 gpioExtender;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TFT_MESH
|
#ifndef TFT_MESH
|
||||||
#define TFT_MESH COLOR565(0x67, 0xEA, 0x94)
|
// Legacy Color: 0x67, 0xEA, 0x94
|
||||||
|
uint16_t TFT_MESH = COLOR565(255, 255, 128);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ST7735S)
|
#if defined(ST7735S)
|
||||||
|
@ -19,6 +19,10 @@ class TFTDisplay : public OLEDDisplay
|
|||||||
FIXME - the parameters are not used, just a temporary hack to keep working like the old displays
|
FIXME - the parameters are not used, just a temporary hack to keep working like the old displays
|
||||||
*/
|
*/
|
||||||
TFTDisplay(uint8_t, int, int, OLEDDISPLAY_GEOMETRY, HW_I2C);
|
TFTDisplay(uint8_t, int, int, OLEDDISPLAY_GEOMETRY, HW_I2C);
|
||||||
|
#ifndef TFT_MESH
|
||||||
|
// Legacy Color: 0x67, 0xEA, 0x94
|
||||||
|
uint16_t TFT_MESH = COLOR565(255, 255, 128);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Write the buffer to the display memory
|
// Write the buffer to the display memory
|
||||||
virtual void display() override { display(false); };
|
virtual void display() override { display(false); };
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
#include "modules/AdminModule.h"
|
#include "modules/AdminModule.h"
|
||||||
#include "modules/CannedMessageModule.h"
|
#include "modules/CannedMessageModule.h"
|
||||||
|
|
||||||
|
extern uint16_t TFT_MESH;
|
||||||
|
|
||||||
namespace graphics
|
namespace graphics
|
||||||
{
|
{
|
||||||
menuHandler::screenMenus menuHandler::menuQueue = menu_none;
|
menuHandler::screenMenus menuHandler::menuQueue = menu_none;
|
||||||
@ -298,6 +300,37 @@ void menuHandler::homeBaseMenu()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void menuHandler::systemBaseMenu()
|
||||||
|
{
|
||||||
|
int options;
|
||||||
|
static const char **optionsArrayPtr;
|
||||||
|
#if HAS_TFT
|
||||||
|
static const char *optionsArray[] = {"Back", "Beeps Action", "Switch to MUI"};
|
||||||
|
options = 3;
|
||||||
|
#endif
|
||||||
|
#ifdef HELTEC_MESH_NODE_T114
|
||||||
|
static const char *optionsArray[] = {"Back", "Beeps Action", "Screen Color"};
|
||||||
|
options = 3;
|
||||||
|
#endif
|
||||||
|
optionsArrayPtr = optionsArray;
|
||||||
|
screen->showOverlayBanner("System Action", 30000, optionsArrayPtr, options, [](int selected) -> void {
|
||||||
|
if (selected == 1) {
|
||||||
|
menuHandler::menuQueue = menuHandler::buzzermodemenupicker;
|
||||||
|
screen->setInterval(0);
|
||||||
|
runASAP = true;
|
||||||
|
} else if (selected == 2) {
|
||||||
|
#if HAS_TFT
|
||||||
|
menuHandler::menuQueue = menuHandler::mui_picker;
|
||||||
|
#endif
|
||||||
|
#ifdef HELTEC_MESH_NODE_T114
|
||||||
|
menuHandler::menuQueue = menuHandler::tftcolormenupicker;
|
||||||
|
#endif
|
||||||
|
screen->setInterval(0);
|
||||||
|
runASAP = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void menuHandler::favoriteBaseMenu()
|
void menuHandler::favoriteBaseMenu()
|
||||||
{
|
{
|
||||||
int options;
|
int options;
|
||||||
@ -448,6 +481,38 @@ void menuHandler::switchToMUIMenu()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void menuHandler::TFTColorPickerMenu()
|
||||||
|
{
|
||||||
|
static const char *optionsArray[] = {"Back", "Default", "Meshtastic Green", "Red", "Orange", "Purple", "Teal"};
|
||||||
|
screen->showOverlayBanner("Current Screen Color?", 30000, optionsArray, 7, [](int selected) -> void {
|
||||||
|
// auto *tft = static_cast<ST7789Spi *>(dispdev);
|
||||||
|
if (selected == 1) {
|
||||||
|
LOG_INFO("Setting color to soft yellow");
|
||||||
|
TFT_MESH = COLOR565(255, 255, 128);
|
||||||
|
} else if (selected == 2) {
|
||||||
|
LOG_INFO("Setting color to Meshtastic Green");
|
||||||
|
TFT_MESH = COLOR565(0x67, 0xEA, 0x94);
|
||||||
|
} else if (selected == 3) {
|
||||||
|
LOG_INFO("Setting color to Red");
|
||||||
|
TFT_MESH = COLOR565(255, 64, 64);
|
||||||
|
} else if (selected == 4) {
|
||||||
|
LOG_INFO("Setting color to orange");
|
||||||
|
TFT_MESH = COLOR565(255, 165, 0);
|
||||||
|
} else if (selected == 5) {
|
||||||
|
LOG_INFO("Setting color to purple");
|
||||||
|
TFT_MESH = COLOR565(192, 128, 192);
|
||||||
|
} else if (selected == 6) {
|
||||||
|
LOG_INFO("Setting color to teal");
|
||||||
|
TFT_MESH = COLOR565(64, 224, 208);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selected != 0) {
|
||||||
|
static_cast<ST7789Spi *>(screen->getDisplayDevice())->setRGB(TFT_MESH);
|
||||||
|
screen->setFrames(graphics::Screen::FOCUS_SYSTEM);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void menuHandler::handleMenuSwitch()
|
void menuHandler::handleMenuSwitch()
|
||||||
{
|
{
|
||||||
switch (menuQueue) {
|
switch (menuQueue) {
|
||||||
@ -480,6 +545,15 @@ void menuHandler::handleMenuSwitch()
|
|||||||
case reset_node_db_menu:
|
case reset_node_db_menu:
|
||||||
resetNodeDBMenu();
|
resetNodeDBMenu();
|
||||||
break;
|
break;
|
||||||
|
case buzzermodemenupicker:
|
||||||
|
BuzzerModeMenu();
|
||||||
|
break;
|
||||||
|
case mui_picker:
|
||||||
|
switchToMUIMenu();
|
||||||
|
break;
|
||||||
|
case tftcolormenupicker:
|
||||||
|
TFTColorPickerMenu();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
menuQueue = menu_none;
|
menuQueue = menu_none;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,10 @@ class menuHandler
|
|||||||
position_base_menu,
|
position_base_menu,
|
||||||
gps_toggle_menu,
|
gps_toggle_menu,
|
||||||
compass_point_north_menu,
|
compass_point_north_menu,
|
||||||
reset_node_db_menu
|
reset_node_db_menu,
|
||||||
|
buzzermodemenupicker,
|
||||||
|
mui_picker,
|
||||||
|
tftcolormenupicker
|
||||||
};
|
};
|
||||||
static screenMenus menuQueue;
|
static screenMenus menuQueue;
|
||||||
|
|
||||||
@ -27,12 +30,14 @@ class menuHandler
|
|||||||
static void ClockFacePicker();
|
static void ClockFacePicker();
|
||||||
static void messageResponseMenu();
|
static void messageResponseMenu();
|
||||||
static void homeBaseMenu();
|
static void homeBaseMenu();
|
||||||
|
static void systemBaseMenu();
|
||||||
static void favoriteBaseMenu();
|
static void favoriteBaseMenu();
|
||||||
static void positionBaseMenu();
|
static void positionBaseMenu();
|
||||||
static void compassNorthMenu();
|
static void compassNorthMenu();
|
||||||
static void GPSToggleMenu();
|
static void GPSToggleMenu();
|
||||||
static void BuzzerModeMenu();
|
static void BuzzerModeMenu();
|
||||||
static void switchToMUIMenu();
|
static void switchToMUIMenu();
|
||||||
|
static void TFTColorPickerMenu();
|
||||||
static void nodeListMenu();
|
static void nodeListMenu();
|
||||||
static void resetNodeDBMenu();
|
static void resetNodeDBMenu();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user