mirror of
https://github.com/meshtastic/firmware.git
synced 2025-07-31 19:05:44 +00:00
Message frame New Message Options and Clock / TDeck / Brightness Refinements (#7344)
* Clock updates and some TDeck corrections * TDeck Brightness Works in TFT Builds * Remove HAS_TFT from enabling Brightness, disable Brightness for TDeck * Add default textMessage frame actions and adjust SharedUIDisplay --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
parent
31d56c16d5
commit
625a529f6c
@ -1374,9 +1374,12 @@ int Screen::handleInputEvent(const InputEvent *event)
|
|||||||
menuHandler::clockMenu();
|
menuHandler::clockMenu();
|
||||||
} else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.lora) {
|
} else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.lora) {
|
||||||
menuHandler::LoraRegionPicker();
|
menuHandler::LoraRegionPicker();
|
||||||
} else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.textMessage &&
|
} else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.textMessage) {
|
||||||
devicestate.rx_text_message.from) {
|
if (devicestate.rx_text_message.from) {
|
||||||
menuHandler::messageResponseMenu();
|
menuHandler::messageResponseMenu();
|
||||||
|
} else {
|
||||||
|
menuHandler::textMessageBaseMenu();
|
||||||
|
}
|
||||||
} else if (framesetInfo.positions.firstFavorite != 255 &&
|
} else if (framesetInfo.positions.firstFavorite != 255 &&
|
||||||
this->ui->getUiState()->currentFrame >= framesetInfo.positions.firstFavorite &&
|
this->ui->getUiState()->currentFrame >= framesetInfo.positions.firstFavorite &&
|
||||||
this->ui->getUiState()->currentFrame <= framesetInfo.positions.lastFavorite) {
|
this->ui->getUiState()->currentFrame <= framesetInfo.positions.lastFavorite) {
|
||||||
|
@ -206,7 +206,7 @@ void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y, const char *ti
|
|||||||
timeX = screenW - xOffset - timeStrWidth + 3;
|
timeX = screenW - xOffset - timeStrWidth + 3;
|
||||||
|
|
||||||
// === Show Mail or Mute Icon to the Left of Time ===
|
// === Show Mail or Mute Icon to the Left of Time ===
|
||||||
int iconRightEdge = timeX - 1;
|
int iconRightEdge = timeX - 2;
|
||||||
|
|
||||||
bool showMail = false;
|
bool showMail = false;
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ void drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int1
|
|||||||
{
|
{
|
||||||
display->clear();
|
display->clear();
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
int line = 1;
|
|
||||||
// === Set Title, Blank for Clock
|
// === Set Title, Blank for Clock
|
||||||
const char *titleStr = "";
|
const char *titleStr = "";
|
||||||
// === Header ===
|
// === Header ===
|
||||||
@ -230,6 +230,8 @@ void drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int1
|
|||||||
|
|
||||||
#ifdef T_WATCH_S3
|
#ifdef T_WATCH_S3
|
||||||
float scale = 1.5;
|
float scale = 1.5;
|
||||||
|
#elif defined(CHATTER_2)
|
||||||
|
float scale = 1.1;
|
||||||
#else
|
#else
|
||||||
float scale = 0.75;
|
float scale = 0.75;
|
||||||
if (isHighResolution) {
|
if (isHighResolution) {
|
||||||
@ -285,6 +287,9 @@ void drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int1
|
|||||||
int yOffset = (isHighResolution) ? 3 : 1;
|
int yOffset = (isHighResolution) ? 3 : 1;
|
||||||
#ifdef SENSECAP_INDICATOR
|
#ifdef SENSECAP_INDICATOR
|
||||||
yOffset -= 3;
|
yOffset -= 3;
|
||||||
|
#endif
|
||||||
|
#ifdef T_DECK
|
||||||
|
yOffset -= 5;
|
||||||
#endif
|
#endif
|
||||||
if (config.display.use_12h_clock) {
|
if (config.display.use_12h_clock) {
|
||||||
display->drawString(startingHourMinuteTextX + xOffset, (display->getHeight() - hourMinuteTextY) - yOffset - 2,
|
display->drawString(startingHourMinuteTextX + xOffset, (display->getHeight() - hourMinuteTextY) - yOffset - 2,
|
||||||
|
@ -344,6 +344,35 @@ void menuHandler::homeBaseMenu()
|
|||||||
screen->showOverlayBanner(bannerOptions);
|
screen->showOverlayBanner(bannerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void menuHandler::textMessageBaseMenu()
|
||||||
|
{
|
||||||
|
enum optionsNumbers { Back, Preset, Freetext, enumEnd };
|
||||||
|
|
||||||
|
static const char *optionsArray[enumEnd] = {"Back"};
|
||||||
|
static int optionsEnumArray[enumEnd] = {Back};
|
||||||
|
int options = 1;
|
||||||
|
optionsArray[options] = "New Preset Msg";
|
||||||
|
optionsEnumArray[options++] = Preset;
|
||||||
|
if (kb_found) {
|
||||||
|
optionsArray[options] = "New Freetext Msg";
|
||||||
|
optionsEnumArray[options++] = Freetext;
|
||||||
|
}
|
||||||
|
|
||||||
|
BannerOverlayOptions bannerOptions;
|
||||||
|
bannerOptions.message = "Message Action";
|
||||||
|
bannerOptions.optionsArrayPtr = optionsArray;
|
||||||
|
bannerOptions.optionsEnumPtr = optionsEnumArray;
|
||||||
|
bannerOptions.optionsCount = options;
|
||||||
|
bannerOptions.bannerCallback = [](int selected) -> void {
|
||||||
|
if (selected == Preset) {
|
||||||
|
cannedMessageModule->LaunchWithDestination(NODENUM_BROADCAST);
|
||||||
|
} else if (selected == Freetext) {
|
||||||
|
cannedMessageModule->LaunchFreetextWithDestination(NODENUM_BROADCAST);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
screen->showOverlayBanner(bannerOptions);
|
||||||
|
}
|
||||||
|
|
||||||
void menuHandler::systemBaseMenu()
|
void menuHandler::systemBaseMenu()
|
||||||
{
|
{
|
||||||
// Check if brightness is supported
|
// Check if brightness is supported
|
||||||
@ -729,7 +758,7 @@ void menuHandler::TFTColorPickerMenu(OLEDDisplay *display)
|
|||||||
screen->runNow();
|
screen->runNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HELTEC_MESH_NODE_T114) || defined(HELTEC_VISION_MASTER_T190) || HAS_TFT
|
#if defined(HELTEC_MESH_NODE_T114) || defined(HELTEC_VISION_MASTER_T190) || defined(T_DECK) || HAS_TFT
|
||||||
if (selected != 0) {
|
if (selected != 0) {
|
||||||
display->setColor(BLACK);
|
display->setColor(BLACK);
|
||||||
display->fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
display->fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
@ -924,23 +953,28 @@ void menuHandler::screenOptionsMenu()
|
|||||||
{
|
{
|
||||||
// Check if brightness is supported
|
// Check if brightness is supported
|
||||||
bool hasSupportBrightness = false;
|
bool hasSupportBrightness = false;
|
||||||
#if defined(ST7789_CS) || defined(USE_OLED) || defined(USE_SSD1306) || defined(USE_SH1106) || defined(USE_SH1107) || HAS_TFT
|
#if defined(ST7789_CS) || defined(USE_OLED) || defined(USE_SSD1306) || defined(USE_SH1106) || defined(USE_SH1107)
|
||||||
hasSupportBrightness = true;
|
hasSupportBrightness = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(T_DECK)
|
||||||
|
// TDeck Doesn't seem to support brightness at all, at least not reliably
|
||||||
|
hasSupportBrightness = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
enum optionsNumbers { Back, Brightness, ScreenColor };
|
enum optionsNumbers { Back, Brightness, ScreenColor };
|
||||||
static const char *optionsArray[4] = {"Back"};
|
static const char *optionsArray[4] = {"Back"};
|
||||||
static int optionsEnumArray[4] = {Back};
|
static int optionsEnumArray[4] = {Back};
|
||||||
int options = 1;
|
int options = 1;
|
||||||
|
|
||||||
// Only show brightness for B&W displays
|
// Only show brightness for B&W displays
|
||||||
if (hasSupportBrightness && !HAS_TFT) {
|
if (hasSupportBrightness) {
|
||||||
optionsArray[options] = "Brightness";
|
optionsArray[options] = "Brightness";
|
||||||
optionsEnumArray[options++] = Brightness;
|
optionsEnumArray[options++] = Brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show screen color for TFT displays
|
// Only show screen color for TFT displays
|
||||||
#if defined(HELTEC_MESH_NODE_T114) || defined(HELTEC_VISION_MASTER_T190) || HAS_TFT
|
#if defined(HELTEC_MESH_NODE_T114) || defined(HELTEC_VISION_MASTER_T190) || defined(T_DECK) || HAS_TFT
|
||||||
optionsArray[options] = "Screen Color";
|
optionsArray[options] = "Screen Color";
|
||||||
optionsEnumArray[options++] = ScreenColor;
|
optionsEnumArray[options++] = ScreenColor;
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,6 +48,7 @@ class menuHandler
|
|||||||
static void ClockFacePicker();
|
static void ClockFacePicker();
|
||||||
static void messageResponseMenu();
|
static void messageResponseMenu();
|
||||||
static void homeBaseMenu();
|
static void homeBaseMenu();
|
||||||
|
static void textMessageBaseMenu();
|
||||||
static void systemBaseMenu();
|
static void systemBaseMenu();
|
||||||
static void favoriteBaseMenu();
|
static void favoriteBaseMenu();
|
||||||
static void positionBaseMenu();
|
static void positionBaseMenu();
|
||||||
|
Loading…
Reference in New Issue
Block a user