mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-03 04:15:53 +00:00
Move function after include
This commit is contained in:
parent
c090a7f6d5
commit
11d307c609
@ -1345,30 +1345,6 @@ bool NodeDB::saveNodeDatabaseToDisk()
|
|||||||
return saveProto(nodeDatabaseFileName, nodeDatabaseSize, &meshtastic_NodeDatabase_msg, &nodeDatabase, false);
|
return saveProto(nodeDatabaseFileName, nodeDatabaseSize, &meshtastic_NodeDatabase_msg, &nodeDatabase, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeDB::sortMeshDB()
|
|
||||||
{
|
|
||||||
if (!Throttle::isWithinTimespanMs(lastSort, 1000 * 5)) {
|
|
||||||
lastSort = millis();
|
|
||||||
std::sort(meshNodes->begin(), meshNodes->end(), [](const meshtastic_NodeInfoLite &a, const meshtastic_NodeInfoLite &b) {
|
|
||||||
if (a.num == myNodeInfo.my_node_num) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (b.num == myNodeInfo.my_node_num) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool aFav = a.is_favorite;
|
|
||||||
bool bFav = b.is_favorite;
|
|
||||||
if (aFav != bFav)
|
|
||||||
return aFav;
|
|
||||||
if (a.last_heard == 0 || a.last_heard == UINT32_MAX)
|
|
||||||
return false;
|
|
||||||
if (b.last_heard == 0 || b.last_heard == UINT32_MAX)
|
|
||||||
return true;
|
|
||||||
return a.last_heard > b.last_heard;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NodeDB::saveToDiskNoRetry(int saveWhat)
|
bool NodeDB::saveToDiskNoRetry(int saveWhat)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
@ -1698,6 +1674,30 @@ void NodeDB::updateFrom(const meshtastic_MeshPacket &mp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeDB::sortMeshDB()
|
||||||
|
{
|
||||||
|
if (!Throttle::isWithinTimespanMs(lastSort, 1000 * 5)) {
|
||||||
|
lastSort = millis();
|
||||||
|
std::sort(meshNodes->begin(), meshNodes->end(), [](const meshtastic_NodeInfoLite &a, const meshtastic_NodeInfoLite &b) {
|
||||||
|
if (a.num == myNodeInfo.my_node_num) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (b.num == myNodeInfo.my_node_num) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool aFav = a.is_favorite;
|
||||||
|
bool bFav = b.is_favorite;
|
||||||
|
if (aFav != bFav)
|
||||||
|
return aFav;
|
||||||
|
if (a.last_heard == 0 || a.last_heard == UINT32_MAX)
|
||||||
|
return false;
|
||||||
|
if (b.last_heard == 0 || b.last_heard == UINT32_MAX)
|
||||||
|
return true;
|
||||||
|
return a.last_heard > b.last_heard;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t NodeDB::getMeshNodeChannel(NodeNum n)
|
uint8_t NodeDB::getMeshNodeChannel(NodeNum n)
|
||||||
{
|
{
|
||||||
const meshtastic_NodeInfoLite *info = getMeshNode(n);
|
const meshtastic_NodeInfoLite *info = getMeshNode(n);
|
||||||
|
Loading…
Reference in New Issue
Block a user