Skip to content

Commit 2b69fa1

Browse files
committed
Cross out Mute or Ignored in lists, add Save to NodeDB on changes
1 parent 8d4a75f commit 2b69fa1

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/graphics/draw/MenuHandler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,7 @@ void menuHandler::ManageNodeMenu()
13851385
LOG_INFO("Muted node %08X", menuHandler::pickedNodeNum);
13861386
}
13871387
nodeDB->notifyObservers(true);
1388+
nodeDB->saveToDisk();
13881389
screen->setFrames(graphics::Screen::FOCUS_PRESERVE);
13891390
return;
13901391
}
@@ -1419,6 +1420,7 @@ void menuHandler::ManageNodeMenu()
14191420
LOG_INFO("Ignoring node %08X", menuHandler::pickedNodeNum);
14201421
}
14211422
nodeDB->notifyObservers(true);
1423+
nodeDB->saveToDisk();
14221424
screen->setFrames(graphics::Screen::FOCUS_PRESERVE);
14231425
return;
14241426
}

src/graphics/draw/NodeListRenderer.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,11 @@ void drawScrollbar(OLEDDisplay *display, int visibleNodeRows, int totalEntries,
205205
void drawEntryLastHeard(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth)
206206
{
207207
bool isLeftCol = (x < SCREEN_WIDTH / 2);
208+
int nameMaxWidth = columnWidth - 25;
208209
int timeOffset = (currentResolution == ScreenResolution::High) ? (isLeftCol ? 7 : 10) : (isLeftCol ? 3 : 7);
209210

210211
const char *nodeName = getSafeNodeName(display, node, columnWidth);
212+
bool isMuted = (node->bitfield & NODEINFO_BITFIELD_IS_MUTED_MASK) != 0;
211213

212214
char timeStr[10];
213215
uint32_t seconds = sinceLastSeen(node);
@@ -234,6 +236,13 @@ void drawEntryLastHeard(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int
234236
display->drawXbm(x, y + 5, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint);
235237
}
236238
}
239+
if (node->is_ignored || isMuted) {
240+
if (currentResolution == ScreenResolution::High) {
241+
display->drawLine(x + 4, y + 7, nameMaxWidth - 4, y + 7);
242+
} else {
243+
display->drawLine(x + 4, y + 6, nameMaxWidth - 4, y + 6);
244+
}
245+
}
237246

238247
int rightEdge = x + columnWidth - timeOffset;
239248
if (timeStr[strlen(timeStr) - 1] == 'm') // Fix the fact that our fonts don't line up well all the time
@@ -253,6 +262,7 @@ void drawEntryHopSignal(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int
253262
int barsXOffset = columnWidth - barsOffset;
254263

255264
const char *nodeName = getSafeNodeName(display, node, columnWidth);
265+
bool isMuted = (node->bitfield & NODEINFO_BITFIELD_IS_MUTED_MASK) != 0;
256266

257267
display->setTextAlignment(TEXT_ALIGN_LEFT);
258268
display->setFont(FONT_SMALL);
@@ -265,6 +275,13 @@ void drawEntryHopSignal(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int
265275
display->drawXbm(x, y + 5, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint);
266276
}
267277
}
278+
if (node->is_ignored || isMuted) {
279+
if (currentResolution == ScreenResolution::High) {
280+
display->drawLine(x + 4, y + 7, nameMaxWidth - 4, y + 7);
281+
} else {
282+
display->drawLine(x + 4, y + 6, nameMaxWidth - 4, y + 6);
283+
}
284+
}
268285

269286
// Draw signal strength bars
270287
int bars = (node->snr > 5) ? 4 : (node->snr > 0) ? 3 : (node->snr > -5) ? 2 : (node->snr > -10) ? 1 : 0;
@@ -298,6 +315,7 @@ void drawNodeDistance(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16
298315
columnWidth - ((currentResolution == ScreenResolution::High) ? (isLeftCol ? 25 : 28) : (isLeftCol ? 20 : 22));
299316

300317
const char *nodeName = getSafeNodeName(display, node, columnWidth);
318+
bool isMuted = (node->bitfield & NODEINFO_BITFIELD_IS_MUTED_MASK) != 0;
301319
char distStr[10] = "";
302320

303321
meshtastic_NodeInfoLite *ourNode = nodeDB->getMeshNode(nodeDB->getNodeNum());
@@ -358,6 +376,13 @@ void drawNodeDistance(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16
358376
display->drawXbm(x, y + 5, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint);
359377
}
360378
}
379+
if (node->is_ignored || isMuted) {
380+
if (currentResolution == ScreenResolution::High) {
381+
display->drawLine(x + 4, y + 7, nameMaxWidth - 4, y + 7);
382+
} else {
383+
display->drawLine(x + 4, y + 6, nameMaxWidth - 4, y + 6);
384+
}
385+
}
361386

362387
if (strlen(distStr) > 0) {
363388
int offset = (currentResolution == ScreenResolution::High)
@@ -392,6 +417,7 @@ void drawEntryCompass(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16
392417
columnWidth - ((currentResolution == ScreenResolution::High) ? (isLeftCol ? 25 : 28) : (isLeftCol ? 20 : 22));
393418

394419
const char *nodeName = getSafeNodeName(display, node, columnWidth);
420+
bool isMuted = (node->bitfield & NODEINFO_BITFIELD_IS_MUTED_MASK) != 0;
395421

396422
display->setTextAlignment(TEXT_ALIGN_LEFT);
397423
display->setFont(FONT_SMALL);
@@ -403,6 +429,13 @@ void drawEntryCompass(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16
403429
display->drawXbm(x, y + 5, smallbulletpoint_width, smallbulletpoint_height, smallbulletpoint);
404430
}
405431
}
432+
if (node->is_ignored || isMuted) {
433+
if (currentResolution == ScreenResolution::High) {
434+
display->drawLine(x + 4, y + 7, nameMaxWidth - 4, y + 7);
435+
} else {
436+
display->drawLine(x + 4, y + 6, nameMaxWidth - 4, y + 6);
437+
}
438+
}
406439
}
407440

408441
void drawCompassArrow(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16_t x, int16_t y, int columnWidth, float myHeading,

0 commit comments

Comments
 (0)