Added sinceLastSeen check to pings generated by node UI

This commit is contained in:
Professr 2020-07-05 19:56:57 -07:00
parent 6f7f540c79
commit ccadb6a43d

View File

@ -444,10 +444,13 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
nodeIndex = (nodeIndex + 1) % nodeDB.getNumNodes(); nodeIndex = (nodeIndex + 1) % nodeDB.getNumNodes();
n = nodeDB.getNodeByIndex(nodeIndex); n = nodeDB.getNodeByIndex(nodeIndex);
} }
// We just changed to a new node screen, ask that node for updated state
displayedNodeNum = n->num; displayedNodeNum = n->num;
service.sendNetworkPing(displayedNodeNum, true);
// We just changed to a new node screen, ask that node for updated state if it's older than 2 minutes
if(sinceLastSeen(n) > 120)
{
service.sendNetworkPing(displayedNodeNum, true);
}
} }
NodeInfo *node = nodeDB.getNodeByIndex(nodeIndex); NodeInfo *node = nodeDB.getNodeByIndex(nodeIndex);