Add Adhoc Ping and resolve error with std::string sanitized

This commit is contained in:
Jason P 2025-06-24 08:14:38 -05:00
parent fecf80c39b
commit 088143dbf3
2 changed files with 14 additions and 5 deletions

View File

@ -249,11 +249,11 @@ void menuHandler::homeBaseMenu()
static const char **optionsArrayPtr;
if (kb_found) {
static const char *optionsArray[] = {"Back", "Sleep Screen", "New Preset Msg", "New Freetext Msg"};
static const char *optionsArray[] = {"Back", "Sleep Screen", "Send Adhoc Ping", "New Preset Msg", "New Freetext Msg"};
optionsArrayPtr = optionsArray;
options = 4;
} else {
static const char *optionsArray[] = {"Back", "Sleep Screen", "New Preset Msg"};
static const char *optionsArray[] = {"Back", "Sleep Screen", "Send Adhoc Ping", "New Preset Msg"};
optionsArrayPtr = optionsArray;
options = 3;
}
@ -261,8 +261,15 @@ void menuHandler::homeBaseMenu()
if (selected == 1) {
screen->setOn(false);
} else if (selected == 2) {
cannedMessageModule->LaunchWithDestination(NODENUM_BROADCAST);
service->refreshLocalMeshNode();
if (service->trySendPosition(NODENUM_BROADCAST, true)) {
LOG_INFO("Position Update Sent");
} else {
LOG_INFO("Node Info Update Sent");
}
} else if (selected == 3) {
cannedMessageModule->LaunchWithDestination(NODENUM_BROADCAST);
} else if (selected == 4) {
cannedMessageModule->LaunchFreetextWithDestination(NODENUM_BROADCAST);
}
});

View File

@ -702,6 +702,8 @@ void UIRenderer::drawDeviceFocused(OLEDDisplay *display, OLEDDisplayUiState *sta
int nameX = 0;
int yOffset = (isHighResolution) ? 0 : 5;
const char *longName = nullptr;
std::string sanitized;
meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum());
if (ourNode && ourNode->has_user && strlen(ourNode->user.long_name) > 0) {
std::string sanitized = sanitizeString(ourNode->user.long_name);
@ -1199,11 +1201,11 @@ void UIRenderer::drawNavigationBar(OLEDDisplay *display, OLEDDisplayUiState *sta
if (!navBarVisible && navBarPrevVisible) {
EINK_ADD_FRAMEFLAG(display, DEMAND_FAST); // Fast refresh when hiding nav bar
navBarLastShown = millis(); // Mark when it disappeared
navBarLastShown = millis(); // Mark when it disappeared
}
if (!navBarVisible && navBarLastShown != 0 && !cosmeticRefreshDone) {
if (millis() - navBarLastShown > 10000) { // 10s after hidden
if (millis() - navBarLastShown > 10000) { // 10s after hidden
EINK_ADD_FRAMEFLAG(display, COSMETIC); // One-time ghost cleanup
cosmeticRefreshDone = true;
}