mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-04 18:49:00 +00:00
Compare commits
12 Commits
ac6843562e
...
74c0be6c70
Author | SHA1 | Date | |
---|---|---|---|
![]() |
74c0be6c70 | ||
![]() |
9d46a5a310 | ||
![]() |
8a500f1289 | ||
![]() |
157eaf685f | ||
![]() |
42b855d482 | ||
![]() |
0dc2874b05 | ||
![]() |
da5b4bffb4 | ||
![]() |
c895cf073c | ||
![]() |
227e2aac58 | ||
![]() |
60512dafbe | ||
![]() |
06e438390a | ||
![]() |
5b82301f1d |
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,6 +1,6 @@
|
|||||||
[submodule "protobufs"]
|
|
||||||
path = protobufs
|
|
||||||
url = https://github.com/medentem/protobufs.git
|
|
||||||
[submodule "meshtestic"]
|
[submodule "meshtestic"]
|
||||||
path = meshtestic
|
path = meshtestic
|
||||||
url = https://github.com/meshtastic/meshTestic
|
url = https://github.com/meshtastic/meshTestic
|
||||||
|
[submodule "protobufs"]
|
||||||
|
path = protobufs
|
||||||
|
url = https://github.com/medentem/protobufs.git
|
||||||
|
53
.vscode/settings.json
vendored
53
.vscode/settings.json
vendored
@ -7,58 +7,5 @@
|
|||||||
"cmake.configureOnOpen": false,
|
"cmake.configureOnOpen": false,
|
||||||
"[cpp]": {
|
"[cpp]": {
|
||||||
"editor.defaultFormatter": "trunk.io"
|
"editor.defaultFormatter": "trunk.io"
|
||||||
},
|
|
||||||
"files.associations": {
|
|
||||||
"array": "cpp",
|
|
||||||
"atomic": "cpp",
|
|
||||||
"*.tcc": "cpp",
|
|
||||||
"cctype": "cpp",
|
|
||||||
"clocale": "cpp",
|
|
||||||
"cmath": "cpp",
|
|
||||||
"csignal": "cpp",
|
|
||||||
"cstdarg": "cpp",
|
|
||||||
"cstddef": "cpp",
|
|
||||||
"cstdint": "cpp",
|
|
||||||
"cstdio": "cpp",
|
|
||||||
"cstdlib": "cpp",
|
|
||||||
"cstring": "cpp",
|
|
||||||
"ctime": "cpp",
|
|
||||||
"cwchar": "cpp",
|
|
||||||
"cwctype": "cpp",
|
|
||||||
"deque": "cpp",
|
|
||||||
"list": "cpp",
|
|
||||||
"unordered_map": "cpp",
|
|
||||||
"unordered_set": "cpp",
|
|
||||||
"vector": "cpp",
|
|
||||||
"exception": "cpp",
|
|
||||||
"algorithm": "cpp",
|
|
||||||
"functional": "cpp",
|
|
||||||
"iterator": "cpp",
|
|
||||||
"map": "cpp",
|
|
||||||
"memory": "cpp",
|
|
||||||
"memory_resource": "cpp",
|
|
||||||
"numeric": "cpp",
|
|
||||||
"optional": "cpp",
|
|
||||||
"random": "cpp",
|
|
||||||
"string": "cpp",
|
|
||||||
"string_view": "cpp",
|
|
||||||
"system_error": "cpp",
|
|
||||||
"tuple": "cpp",
|
|
||||||
"type_traits": "cpp",
|
|
||||||
"utility": "cpp",
|
|
||||||
"fstream": "cpp",
|
|
||||||
"initializer_list": "cpp",
|
|
||||||
"iomanip": "cpp",
|
|
||||||
"iosfwd": "cpp",
|
|
||||||
"iostream": "cpp",
|
|
||||||
"istream": "cpp",
|
|
||||||
"limits": "cpp",
|
|
||||||
"new": "cpp",
|
|
||||||
"ostream": "cpp",
|
|
||||||
"sstream": "cpp",
|
|
||||||
"stdexcept": "cpp",
|
|
||||||
"streambuf": "cpp",
|
|
||||||
"cinttypes": "cpp",
|
|
||||||
"typeinfo": "cpp"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 653b481befd422dca7c1c496778bc35b445c1611
|
Subproject commit a68f5e6455195dad13af9ff09b7474537abd9f5e
|
@ -153,9 +153,9 @@ void FloodingRouter::storeCoverageFilterInPacket(const CoverageFilter &filter, m
|
|||||||
void FloodingRouter::mergeMyCoverage(CoverageFilter &coverage)
|
void FloodingRouter::mergeMyCoverage(CoverageFilter &coverage)
|
||||||
{
|
{
|
||||||
// Retrieve recent direct neighbors within the time window
|
// Retrieve recent direct neighbors within the time window
|
||||||
std::vector<NodeNum> recentNeighbors = nodeDB->getCoveredNodes(RECENCY_THRESHOLD_MINUTES * 60);
|
std::vector<meshtastic_RelayNode> recentNeighbors = nodeDB->getCoveredNodes();
|
||||||
for (auto &nodeId : recentNeighbors) {
|
for (auto &relay : recentNeighbors) {
|
||||||
coverage.add(nodeId);
|
coverage.add(relay.num);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always add ourselves to prevent a rebroadcast for a packet we've already seen
|
// Always add ourselves to prevent a rebroadcast for a packet we've already seen
|
||||||
@ -175,7 +175,7 @@ float FloodingRouter::calculateForwardProbability(const CoverageFilter &incoming
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve recent direct neighbors within the time window
|
// Retrieve recent direct neighbors within the time window
|
||||||
std::vector<NodeNum> recentNeighbors = nodeDB->getCoveredNodes(RECENCY_THRESHOLD_MINUTES * 60);
|
std::vector<meshtastic_RelayNode> recentNeighbors = nodeDB->getCoveredNodes();
|
||||||
|
|
||||||
if (recentNeighbors.empty()) {
|
if (recentNeighbors.empty()) {
|
||||||
// Having no direct neighbors is a sign that our coverage is
|
// Having no direct neighbors is a sign that our coverage is
|
||||||
@ -192,20 +192,16 @@ float FloodingRouter::calculateForwardProbability(const CoverageFilter &incoming
|
|||||||
uint8_t neighbors = 0;
|
uint8_t neighbors = 0;
|
||||||
uint8_t uncovered = 0;
|
uint8_t uncovered = 0;
|
||||||
|
|
||||||
for (auto nodeId : recentNeighbors) {
|
for (auto relay : recentNeighbors) {
|
||||||
if (nodeId == from || nodeId == relayNode)
|
if (relay.num == from || relay.num == relayNode)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto nodeInfo = nodeDB->getMeshNode(nodeId);
|
uint32_t age = now - relay.last_heard;
|
||||||
if (!nodeInfo)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
uint32_t age = now - nodeInfo->last_heard;
|
|
||||||
float recency = computeRecencyWeight(age, RECENCY_THRESHOLD_MINUTES * 60);
|
float recency = computeRecencyWeight(age, RECENCY_THRESHOLD_MINUTES * 60);
|
||||||
|
|
||||||
totalWeight += recency;
|
totalWeight += recency;
|
||||||
neighbors += 1;
|
neighbors += 1;
|
||||||
if (!incoming.check(nodeId)) {
|
if (!incoming.check(relay.num)) {
|
||||||
uncoveredWeight += recency;
|
uncoveredWeight += recency;
|
||||||
uncovered += 1;
|
uncovered += 1;
|
||||||
}
|
}
|
||||||
|
@ -824,23 +824,14 @@ void NodeDB::clearLocalPosition()
|
|||||||
setLocalPosition(meshtastic_Position_init_default);
|
setLocalPosition(meshtastic_Position_init_default);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NodeDB::isValidCandidateForCoverage(const meshtastic_NodeInfoLite &node)
|
bool NodeDB::isValidCandidateForCoverage(const meshtastic_RelayNode &node)
|
||||||
{
|
{
|
||||||
// 1) Exclude self
|
// 1) Exclude self
|
||||||
if (node.num == getNodeNum()) {
|
if (node.num == getNodeNum()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 2) Exclude ignored
|
|
||||||
if (node.is_ignored) {
|
// 2) Must have last_heard
|
||||||
LOG_DEBUG("Node 0x%x is not valid for coverage: Ignored", node.num);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// 3) Exclude MQTT-based nodes if desired
|
|
||||||
if (node.via_mqtt) {
|
|
||||||
LOG_DEBUG("Node 0x%x is not valid for coverage: MQTT", node.num);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// 4) Must have last_heard
|
|
||||||
if (node.last_heard == 0) {
|
if (node.last_heard == 0) {
|
||||||
LOG_DEBUG("Node 0x%x is not valid for coverage: Missing Last Heard", node.num);
|
LOG_DEBUG("Node 0x%x is not valid for coverage: Missing Last Heard", node.num);
|
||||||
return false;
|
return false;
|
||||||
@ -849,7 +840,7 @@ bool NodeDB::isValidCandidateForCoverage(const meshtastic_NodeInfoLite &node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Retrieves a list of distinct recent direct neighbor NodeNums.
|
* @brief Retrieves a list of distinct recent direct neighbor meshtastic_RelayNode.
|
||||||
*
|
*
|
||||||
* Filters out:
|
* Filters out:
|
||||||
* - The local node itself.
|
* - The local node itself.
|
||||||
@ -858,83 +849,52 @@ bool NodeDB::isValidCandidateForCoverage(const meshtastic_NodeInfoLite &node)
|
|||||||
* - Nodes heard via MQTT.
|
* - Nodes heard via MQTT.
|
||||||
* - Nodes not heard within the specified time window.
|
* - Nodes not heard within the specified time window.
|
||||||
*
|
*
|
||||||
* @param timeWindowSecs The time window in seconds to consider a node as "recently heard."
|
* @return std::vector<meshtastic_RelayNode> A vector containing the meshtastic_RelayNode of recent direct neighbors.
|
||||||
* @return std::vector<NodeNum> A vector containing the NodeNums of recent direct neighbors.
|
|
||||||
*/
|
*/
|
||||||
std::vector<NodeNum> NodeDB::getCoveredNodes(uint32_t timeWindowSecs)
|
std::vector<meshtastic_RelayNode> NodeDB::getCoveredNodes()
|
||||||
{
|
{
|
||||||
uint32_t now = getTime();
|
uint32_t now = getTime();
|
||||||
|
|
||||||
// We'll collect (nodeNum, last_heard, snr) for both main DB + ephemeral
|
std::vector<meshtastic_RelayNode> allCandidates;
|
||||||
struct NodeCandidate {
|
allCandidates.reserve(numRelayNodes);
|
||||||
NodeNum num;
|
|
||||||
uint32_t lastHeard;
|
|
||||||
float snr;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<NodeCandidate> allCandidates;
|
|
||||||
allCandidates.reserve(numMeshNodes + ephemeralNodes.size());
|
|
||||||
|
|
||||||
// 1) Collect from main node vector
|
// 1) Collect from main node vector
|
||||||
for (size_t i = 0; i < numMeshNodes; ++i) {
|
for (size_t i = 0; i < numRelayNodes; ++i) {
|
||||||
const auto &node = meshNodes->at(i);
|
const auto &node = relayNodes->at(i);
|
||||||
|
|
||||||
if (!isValidCandidateForCoverage(node)) {
|
if (!isValidCandidateForCoverage(node)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t age = now - node.last_heard;
|
uint32_t age = now - node.last_heard;
|
||||||
if (age <= timeWindowSecs) {
|
if (age <= (RECENCY_THRESHOLD_MINUTES * 60)) {
|
||||||
allCandidates.push_back(NodeCandidate{node.relay_node, node.last_heard, node.snr});
|
allCandidates.push_back(meshtastic_RelayNode{node.num, node.last_heard, node.snr});
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2) Collect from ephemeral node vector
|
|
||||||
for (const auto &node : ephemeralNodes) {
|
|
||||||
if (!isValidCandidateForCoverage(node)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t age = now - node.last_heard;
|
|
||||||
if (age <= timeWindowSecs) {
|
|
||||||
allCandidates.push_back(NodeCandidate{node.relay_node, node.last_heard, node.snr});
|
|
||||||
} else {
|
|
||||||
LOG_DEBUG("Node 0x%x is not valid for coverage: Aged Out", node.relay_node);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want the most recent, and highest SNR neighbors to determine
|
// We want the most recent, and highest SNR neighbors to determine
|
||||||
// the most likely coverage this node will offer on its hop
|
// the most likely coverage this node will offer on its hop
|
||||||
// In this case recency is more important than SNR because we need a fresh picture of coverage
|
// In this case recency is more important than SNR because we need a fresh picture of coverage
|
||||||
std::sort(allCandidates.begin(), allCandidates.end(), [](const NodeCandidate &a, const NodeCandidate &b) {
|
std::sort(allCandidates.begin(), allCandidates.end(), [](const meshtastic_RelayNode &a, const meshtastic_RelayNode &b) {
|
||||||
// 1) Descending by lastHeard
|
// 1) Descending by lastHeard
|
||||||
if (a.lastHeard != b.lastHeard) {
|
if (a.last_heard != b.last_heard) {
|
||||||
return a.lastHeard > b.lastHeard;
|
return a.last_heard > b.last_heard;
|
||||||
}
|
}
|
||||||
// 2) If tie, descending by snr
|
// 2) If tie, descending by snr
|
||||||
return a.snr > b.snr;
|
return a.snr > b.snr;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 4) Reduce to MAX_NEIGHBORS_PER_HOP
|
// 3) Reduce to MAX_NEIGHBORS_PER_HOP
|
||||||
if (allCandidates.size() > MAX_NEIGHBORS_PER_HOP) {
|
if (allCandidates.size() > MAX_NEIGHBORS_PER_HOP) {
|
||||||
allCandidates.resize(MAX_NEIGHBORS_PER_HOP);
|
allCandidates.resize(MAX_NEIGHBORS_PER_HOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5) Extract just the node ids for return
|
return allCandidates;
|
||||||
std::vector<NodeNum> recentNeighbors;
|
|
||||||
recentNeighbors.reserve(allCandidates.size());
|
|
||||||
for (auto &cand : allCandidates) {
|
|
||||||
recentNeighbors.push_back(cand.num);
|
|
||||||
}
|
|
||||||
|
|
||||||
return recentNeighbors;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeDB::cleanupMeshDB()
|
void NodeDB::cleanupMeshDB()
|
||||||
{
|
{
|
||||||
int newPos = 0, removed = 0;
|
int newPos = 0, removed = 0;
|
||||||
std::vector<meshtastic_NodeInfoLite> newlyEphemeral;
|
|
||||||
newlyEphemeral.reserve(numMeshNodes);
|
|
||||||
|
|
||||||
for (int i = 0; i < numMeshNodes; i++) {
|
for (int i = 0; i < numMeshNodes; i++) {
|
||||||
if (meshNodes->at(i).has_user) {
|
if (meshNodes->at(i).has_user) {
|
||||||
@ -946,18 +906,29 @@ void NodeDB::cleanupMeshDB()
|
|||||||
meshNodes->at(newPos++) = meshNodes->at(i);
|
meshNodes->at(newPos++) = meshNodes->at(i);
|
||||||
} else {
|
} else {
|
||||||
removed++;
|
removed++;
|
||||||
|
|
||||||
// If this node doesn't have user data, we consider it "unknown" and ephemeral
|
|
||||||
newlyEphemeral.push_back(meshNodes->at(i));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
numMeshNodes -= removed;
|
numMeshNodes -= removed;
|
||||||
std::fill(devicestate.node_db_lite.begin() + numMeshNodes, devicestate.node_db_lite.begin() + numMeshNodes + removed,
|
std::fill(devicestate.node_db_lite.begin() + numMeshNodes, devicestate.node_db_lite.begin() + numMeshNodes + removed,
|
||||||
meshtastic_NodeInfoLite());
|
meshtastic_NodeInfoLite());
|
||||||
|
|
||||||
ephemeralNodes = std::move(newlyEphemeral);
|
LOG_DEBUG("cleanupMeshDB purged %d node entries", removed);
|
||||||
|
|
||||||
LOG_DEBUG("cleanupMeshDB purged %d entries", removed);
|
uint32_t now = getTime();
|
||||||
|
newPos = 0, removed = 0;
|
||||||
|
for (int i = 0; i < numRelayNodes; i++) {
|
||||||
|
uint32_t age = now - relayNodes->at(i).last_heard;
|
||||||
|
if (age <= (RECENCY_THRESHOLD_MINUTES * 60)) {
|
||||||
|
relayNodes->at(newPos++) = relayNodes->at(i);
|
||||||
|
} else {
|
||||||
|
removed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
numRelayNodes -= removed;
|
||||||
|
std::fill(devicestate.relay_db.begin() + numRelayNodes, devicestate.relay_db.begin() + numRelayNodes + removed,
|
||||||
|
meshtastic_RelayNode());
|
||||||
|
|
||||||
|
LOG_DEBUG("cleanupMeshDB purged %d relay entries", removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeDB::installDefaultDeviceState()
|
void NodeDB::installDefaultDeviceState()
|
||||||
@ -966,7 +937,9 @@ void NodeDB::installDefaultDeviceState()
|
|||||||
// memset(&devicestate, 0, sizeof(meshtastic_DeviceState));
|
// memset(&devicestate, 0, sizeof(meshtastic_DeviceState));
|
||||||
|
|
||||||
numMeshNodes = 0;
|
numMeshNodes = 0;
|
||||||
|
numRelayNodes = 0;
|
||||||
meshNodes = &devicestate.node_db_lite;
|
meshNodes = &devicestate.node_db_lite;
|
||||||
|
relayNodes = &devicestate.relay_db;
|
||||||
|
|
||||||
// init our devicestate with valid flags so protobuf writing/reading will work
|
// init our devicestate with valid flags so protobuf writing/reading will work
|
||||||
devicestate.has_my_node = true;
|
devicestate.has_my_node = true;
|
||||||
@ -1093,16 +1066,26 @@ void NodeDB::loadFromDisk()
|
|||||||
LOG_WARN("Devicestate %d is old, discard", devicestate.version);
|
LOG_WARN("Devicestate %d is old, discard", devicestate.version);
|
||||||
installDefaultDeviceState();
|
installDefaultDeviceState();
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("Loaded saved devicestate version %d, with nodecount: %d", devicestate.version, devicestate.node_db_lite.size());
|
LOG_INFO("Loaded saved devicestate version %d, with nodecount: %d, relaycount: %d", devicestate.version,
|
||||||
|
devicestate.node_db_lite.size(), devicestate.relay_db.size());
|
||||||
meshNodes = &devicestate.node_db_lite;
|
meshNodes = &devicestate.node_db_lite;
|
||||||
numMeshNodes = devicestate.node_db_lite.size();
|
numMeshNodes = devicestate.node_db_lite.size();
|
||||||
|
relayNodes = &devicestate.relay_db;
|
||||||
|
numRelayNodes = devicestate.relay_db.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numMeshNodes > MAX_NUM_NODES) {
|
if (numMeshNodes > MAX_NUM_NODES) {
|
||||||
LOG_WARN("Node count %d exceeds MAX_NUM_NODES %d, truncating", numMeshNodes, MAX_NUM_NODES);
|
LOG_WARN("Node count %d exceeds MAX_NUM_NODES %d, truncating", numMeshNodes, MAX_NUM_NODES);
|
||||||
numMeshNodes = MAX_NUM_NODES;
|
numMeshNodes = MAX_NUM_NODES;
|
||||||
}
|
}
|
||||||
meshNodes->resize(MAX_NUM_NODES);
|
meshNodes->resize(MAX_NUM_NODES);
|
||||||
|
|
||||||
|
if (numRelayNodes > MAX_NUM_RELAYS) {
|
||||||
|
LOG_WARN("Relay node count %d exceeds MAX_NUM_RELAYS %d, truncating", numRelayNodes, MAX_NUM_RELAYS);
|
||||||
|
numRelayNodes = MAX_NUM_RELAYS;
|
||||||
|
}
|
||||||
|
relayNodes->resize(MAX_NUM_RELAYS);
|
||||||
|
|
||||||
state = loadProto(configFileName, meshtastic_LocalConfig_size, sizeof(meshtastic_LocalConfig), &meshtastic_LocalConfig_msg,
|
state = loadProto(configFileName, meshtastic_LocalConfig_size, sizeof(meshtastic_LocalConfig), &meshtastic_LocalConfig_msg,
|
||||||
&config);
|
&config);
|
||||||
if (state != LoadFileResult::LOAD_SUCCESS) {
|
if (state != LoadFileResult::LOAD_SUCCESS) {
|
||||||
@ -1267,8 +1250,10 @@ bool NodeDB::saveDeviceStateToDisk()
|
|||||||
#endif
|
#endif
|
||||||
// Note: if MAX_NUM_NODES=100 and meshtastic_NodeInfoLite_size=166, so will be approximately 17KB
|
// Note: if MAX_NUM_NODES=100 and meshtastic_NodeInfoLite_size=166, so will be approximately 17KB
|
||||||
// Because so huge we _must_ not use fullAtomic, because the filesystem is probably too small to hold two copies of this
|
// Because so huge we _must_ not use fullAtomic, because the filesystem is probably too small to hold two copies of this
|
||||||
return saveProto(prefFileName, sizeof(devicestate) + numMeshNodes * meshtastic_NodeInfoLite_size, &meshtastic_DeviceState_msg,
|
return saveProto(prefFileName,
|
||||||
&devicestate, false);
|
sizeof(devicestate) + (numMeshNodes * meshtastic_NodeInfoLite_size) +
|
||||||
|
(numRelayNodes * meshtastic_RelayNode_size),
|
||||||
|
&meshtastic_DeviceState_msg, &devicestate, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NodeDB::saveToDiskNoRetry(int saveWhat)
|
bool NodeDB::saveToDiskNoRetry(int saveWhat)
|
||||||
@ -1523,16 +1508,20 @@ void NodeDB::updateFrom(const meshtastic_MeshPacket &mp)
|
|||||||
LOG_DEBUG("Update DB node 0x%x, rx_time=%u", mp.from, mp.rx_time);
|
LOG_DEBUG("Update DB node 0x%x, rx_time=%u", mp.from, mp.rx_time);
|
||||||
|
|
||||||
meshtastic_NodeInfoLite *info = getOrCreateMeshNode(getFrom(&mp));
|
meshtastic_NodeInfoLite *info = getOrCreateMeshNode(getFrom(&mp));
|
||||||
|
meshtastic_RelayNode *relay = getOrCreateRelayNode(mp.relay_node);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mp.rx_time) { // if the packet has a valid timestamp use it to update our last_heard
|
if (mp.rx_time) { // if the packet has a valid timestamp use it to update our last_heard
|
||||||
info->last_heard = mp.rx_time;
|
info->last_heard = mp.rx_time;
|
||||||
|
relay->last_heard = mp.rx_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mp.rx_snr)
|
if (mp.rx_snr) {
|
||||||
info->snr = mp.rx_snr; // keep the most recent SNR we received for this node.
|
info->snr = mp.rx_snr; // keep the most recent SNR we received for this node.
|
||||||
|
relay->snr = mp.rx_snr;
|
||||||
|
}
|
||||||
|
|
||||||
info->via_mqtt = mp.via_mqtt; // Store if we received this packet via MQTT
|
info->via_mqtt = mp.via_mqtt; // Store if we received this packet via MQTT
|
||||||
|
|
||||||
@ -1564,12 +1553,28 @@ meshtastic_NodeInfoLite *NodeDB::getMeshNode(NodeNum n)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Find a relay node in our DB, return null for missing
|
||||||
|
/// NOTE: This function might be called from an ISR
|
||||||
|
meshtastic_RelayNode *NodeDB::getRelayNode(NodeNum n)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < numRelayNodes; i++)
|
||||||
|
if (relayNodes->at(i).num == n)
|
||||||
|
return &relayNodes->at(i);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// returns true if the maximum number of nodes is reached or we are running low on memory
|
// returns true if the maximum number of nodes is reached or we are running low on memory
|
||||||
bool NodeDB::isFull()
|
bool NodeDB::isFull()
|
||||||
{
|
{
|
||||||
return (numMeshNodes >= MAX_NUM_NODES) || (memGet.getFreeHeap() < MINIMUM_SAFE_FREE_HEAP);
|
return (numMeshNodes >= MAX_NUM_NODES) || (memGet.getFreeHeap() < MINIMUM_SAFE_FREE_HEAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NodeDB::isRelayBufferFull()
|
||||||
|
{
|
||||||
|
return (numRelayNodes >= MAX_NUM_RELAYS) || (memGet.getFreeHeap() < MINIMUM_SAFE_FREE_HEAP);
|
||||||
|
}
|
||||||
|
|
||||||
/// Find a node in our DB, create an empty NodeInfo if missing
|
/// Find a node in our DB, create an empty NodeInfo if missing
|
||||||
meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
|
meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
|
||||||
{
|
{
|
||||||
@ -1622,6 +1627,44 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
|
|||||||
return lite;
|
return lite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meshtastic_RelayNode *NodeDB::getOrCreateRelayNode(NodeNum n)
|
||||||
|
{
|
||||||
|
meshtastic_RelayNode *relay = getRelayNode(n);
|
||||||
|
|
||||||
|
if (!relay) {
|
||||||
|
if (isRelayBufferFull()) {
|
||||||
|
LOG_INFO("Relay database full with %i relays and %u bytes free. Erasing oldest entry", numRelayNodes,
|
||||||
|
memGet.getFreeHeap());
|
||||||
|
// look for oldest node and erase it
|
||||||
|
uint32_t oldest = UINT32_MAX;
|
||||||
|
int oldestIndex = -1;
|
||||||
|
for (int i = 1; i < numRelayNodes; i++) {
|
||||||
|
// Simply the oldest non-favorite node
|
||||||
|
if (relayNodes->at(i).last_heard < oldest) {
|
||||||
|
oldest = relayNodes->at(i).last_heard;
|
||||||
|
oldestIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (oldestIndex != -1) {
|
||||||
|
// Shove the remaining nodes down the chain
|
||||||
|
for (int i = oldestIndex; i < numRelayNodes - 1; i++) {
|
||||||
|
relayNodes->at(i) = relayNodes->at(i + 1);
|
||||||
|
}
|
||||||
|
(numRelayNodes)--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// add the node at the end
|
||||||
|
relay = &relayNodes->at((numRelayNodes)++);
|
||||||
|
|
||||||
|
// everything is missing except the nodenum
|
||||||
|
memset(relay, 0, sizeof(*relay));
|
||||||
|
relay->num = n;
|
||||||
|
LOG_INFO("Adding relay to database with %i nodes and %u bytes free!", numRelayNodes, memGet.getFreeHeap());
|
||||||
|
}
|
||||||
|
|
||||||
|
return relay;
|
||||||
|
}
|
||||||
|
|
||||||
/// Sometimes we will have Position objects that only have a time, so check for
|
/// Sometimes we will have Position objects that only have a time, so check for
|
||||||
/// valid lat/lon
|
/// valid lat/lon
|
||||||
bool NodeDB::hasValidPosition(const meshtastic_NodeInfoLite *n)
|
bool NodeDB::hasValidPosition(const meshtastic_NodeInfoLite *n)
|
||||||
|
@ -63,12 +63,13 @@ class NodeDB
|
|||||||
// Note: these two references just point into our static array we serialize to/from disk
|
// Note: these two references just point into our static array we serialize to/from disk
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
std::vector<meshtastic_RelayNode> *relayNodes;
|
||||||
std::vector<meshtastic_NodeInfoLite> *meshNodes;
|
std::vector<meshtastic_NodeInfoLite> *meshNodes;
|
||||||
std::vector<meshtastic_NodeInfoLite> ephemeralNodes;
|
|
||||||
bool updateGUI = false; // we think the gui should definitely be redrawn, screen will clear this once handled
|
bool updateGUI = false; // we think the gui should definitely be redrawn, screen will clear this once handled
|
||||||
meshtastic_NodeInfoLite *updateGUIforNode = NULL; // if currently showing this node, we think you should update the GUI
|
meshtastic_NodeInfoLite *updateGUIforNode = NULL; // if currently showing this node, we think you should update the GUI
|
||||||
Observable<const meshtastic::NodeStatus *> newStatus;
|
Observable<const meshtastic::NodeStatus *> newStatus;
|
||||||
pb_size_t numMeshNodes;
|
pb_size_t numMeshNodes;
|
||||||
|
pb_size_t numRelayNodes;
|
||||||
|
|
||||||
/// don't do mesh based algorithm for node id assignment (initially)
|
/// don't do mesh based algorithm for node id assignment (initially)
|
||||||
/// instead just store in flash - possibly even in the initial alpha release do this hack
|
/// instead just store in flash - possibly even in the initial alpha release do this hack
|
||||||
@ -149,9 +150,14 @@ class NodeDB
|
|||||||
meshtastic_NodeInfoLite *getMeshNode(NodeNum n);
|
meshtastic_NodeInfoLite *getMeshNode(NodeNum n);
|
||||||
size_t getNumMeshNodes() { return numMeshNodes; }
|
size_t getNumMeshNodes() { return numMeshNodes; }
|
||||||
|
|
||||||
|
meshtastic_RelayNode *getRelayNode(NodeNum n);
|
||||||
|
|
||||||
// returns true if the maximum number of nodes is reached or we are running low on memory
|
// returns true if the maximum number of nodes is reached or we are running low on memory
|
||||||
bool isFull();
|
bool isFull();
|
||||||
|
|
||||||
|
// returns true if the maximum number of relay nodes is reached or we are running low on memory
|
||||||
|
bool isRelayBufferFull();
|
||||||
|
|
||||||
void clearLocalPosition();
|
void clearLocalPosition();
|
||||||
|
|
||||||
void setLocalPosition(meshtastic_Position position, bool timeOnly = false)
|
void setLocalPosition(meshtastic_Position position, bool timeOnly = false)
|
||||||
@ -170,12 +176,11 @@ class NodeDB
|
|||||||
bool hasValidPosition(const meshtastic_NodeInfoLite *n);
|
bool hasValidPosition(const meshtastic_NodeInfoLite *n);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Retrieves a list of distinct recent direct neighbor NodeNums.
|
* @brief Retrieves a list of distinct recent direct neighbor meshtastic_RelayNode.
|
||||||
*
|
*
|
||||||
* @param timeWindowSecs The time window in seconds to consider a node as "recently heard."
|
* @return std::vector<meshtastic_RelayNode> A vector containing the meshtastic_RelayNode of recent direct neighbors.
|
||||||
* @return std::vector<NodeNum> A vector containing the NodeNums of recent direct neighbors.
|
|
||||||
*/
|
*/
|
||||||
std::vector<NodeNum> getCoveredNodes(uint32_t timeWindowSecs);
|
std::vector<meshtastic_RelayNode> getCoveredNodes();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t lastNodeDbSave = 0; // when we last saved our db to flash
|
uint32_t lastNodeDbSave = 0; // when we last saved our db to flash
|
||||||
@ -183,6 +188,9 @@ class NodeDB
|
|||||||
/// Find a node in our DB, create an empty NodeInfoLite if missing
|
/// Find a node in our DB, create an empty NodeInfoLite if missing
|
||||||
meshtastic_NodeInfoLite *getOrCreateMeshNode(NodeNum n);
|
meshtastic_NodeInfoLite *getOrCreateMeshNode(NodeNum n);
|
||||||
|
|
||||||
|
/// Find a relay node in our DB, create an empty RelayNode if missing
|
||||||
|
meshtastic_RelayNode *getOrCreateRelayNode(NodeNum n);
|
||||||
|
|
||||||
/// Notify observers of changes to the DB
|
/// Notify observers of changes to the DB
|
||||||
void notifyObservers(bool forceUpdate = false)
|
void notifyObservers(bool forceUpdate = false)
|
||||||
{
|
{
|
||||||
@ -208,7 +216,7 @@ class NodeDB
|
|||||||
bool saveChannelsToDisk();
|
bool saveChannelsToDisk();
|
||||||
bool saveDeviceStateToDisk();
|
bool saveDeviceStateToDisk();
|
||||||
|
|
||||||
bool isValidCandidateForCoverage(const meshtastic_NodeInfoLite &node);
|
bool isValidCandidateForCoverage(const meshtastic_RelayNode &node);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern NodeDB *nodeDB;
|
extern NodeDB *nodeDB;
|
||||||
|
@ -63,6 +63,8 @@ PB_BIND(meshtastic_Config_SessionkeyConfig, meshtastic_Config_SessionkeyConfig,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,6 +139,14 @@ typedef enum _meshtastic_Config_NetworkConfig_AddressMode {
|
|||||||
meshtastic_Config_NetworkConfig_AddressMode_STATIC = 1
|
meshtastic_Config_NetworkConfig_AddressMode_STATIC = 1
|
||||||
} meshtastic_Config_NetworkConfig_AddressMode;
|
} meshtastic_Config_NetworkConfig_AddressMode;
|
||||||
|
|
||||||
|
/* Available flags auxiliary network protocols */
|
||||||
|
typedef enum _meshtastic_Config_NetworkConfig_ProtocolFlags {
|
||||||
|
/* Do not broadcast packets over any network protocol */
|
||||||
|
meshtastic_Config_NetworkConfig_ProtocolFlags_NO_BROADCAST = 0,
|
||||||
|
/* Enable broadcasting packets via UDP over the local network */
|
||||||
|
meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST = 1
|
||||||
|
} meshtastic_Config_NetworkConfig_ProtocolFlags;
|
||||||
|
|
||||||
/* How the GPS coordinates are displayed on the OLED screen. */
|
/* How the GPS coordinates are displayed on the OLED screen. */
|
||||||
typedef enum _meshtastic_Config_DisplayConfig_GpsCoordinateFormat {
|
typedef enum _meshtastic_Config_DisplayConfig_GpsCoordinateFormat {
|
||||||
/* GPS coordinates are displayed in the normal decimal degrees format:
|
/* GPS coordinates are displayed in the normal decimal degrees format:
|
||||||
@ -429,6 +437,8 @@ typedef struct _meshtastic_Config_NetworkConfig {
|
|||||||
meshtastic_Config_NetworkConfig_IpV4Config ipv4_config;
|
meshtastic_Config_NetworkConfig_IpV4Config ipv4_config;
|
||||||
/* rsyslog Server and Port */
|
/* rsyslog Server and Port */
|
||||||
char rsyslog_server[33];
|
char rsyslog_server[33];
|
||||||
|
/* Flags for enabling/disabling network protocols */
|
||||||
|
uint32_t enabled_protocols;
|
||||||
} meshtastic_Config_NetworkConfig;
|
} meshtastic_Config_NetworkConfig;
|
||||||
|
|
||||||
/* Display Config */
|
/* Display Config */
|
||||||
@ -613,6 +623,10 @@ extern "C" {
|
|||||||
#define _meshtastic_Config_NetworkConfig_AddressMode_MAX meshtastic_Config_NetworkConfig_AddressMode_STATIC
|
#define _meshtastic_Config_NetworkConfig_AddressMode_MAX meshtastic_Config_NetworkConfig_AddressMode_STATIC
|
||||||
#define _meshtastic_Config_NetworkConfig_AddressMode_ARRAYSIZE ((meshtastic_Config_NetworkConfig_AddressMode)(meshtastic_Config_NetworkConfig_AddressMode_STATIC+1))
|
#define _meshtastic_Config_NetworkConfig_AddressMode_ARRAYSIZE ((meshtastic_Config_NetworkConfig_AddressMode)(meshtastic_Config_NetworkConfig_AddressMode_STATIC+1))
|
||||||
|
|
||||||
|
#define _meshtastic_Config_NetworkConfig_ProtocolFlags_MIN meshtastic_Config_NetworkConfig_ProtocolFlags_NO_BROADCAST
|
||||||
|
#define _meshtastic_Config_NetworkConfig_ProtocolFlags_MAX meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST
|
||||||
|
#define _meshtastic_Config_NetworkConfig_ProtocolFlags_ARRAYSIZE ((meshtastic_Config_NetworkConfig_ProtocolFlags)(meshtastic_Config_NetworkConfig_ProtocolFlags_UDP_BROADCAST+1))
|
||||||
|
|
||||||
#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DEC
|
#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN meshtastic_Config_DisplayConfig_GpsCoordinateFormat_DEC
|
||||||
#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MAX meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR
|
#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MAX meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR
|
||||||
#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_ARRAYSIZE ((meshtastic_Config_DisplayConfig_GpsCoordinateFormat)(meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR+1))
|
#define _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_ARRAYSIZE ((meshtastic_Config_DisplayConfig_GpsCoordinateFormat)(meshtastic_Config_DisplayConfig_GpsCoordinateFormat_OSGR+1))
|
||||||
@ -674,7 +688,7 @@ extern "C" {
|
|||||||
#define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
|
#define meshtastic_Config_DeviceConfig_init_default {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
|
||||||
#define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN}
|
#define meshtastic_Config_PositionConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN}
|
||||||
#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, ""}
|
#define meshtastic_Config_NetworkConfig_init_default {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_default, "", 0}
|
||||||
#define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0}
|
#define meshtastic_Config_NetworkConfig_IpV4Config_init_default {0, 0, 0, 0}
|
||||||
#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN}
|
#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN}
|
||||||
#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0}
|
#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0}
|
||||||
@ -685,7 +699,7 @@ extern "C" {
|
|||||||
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
|
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
|
||||||
#define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN}
|
#define meshtastic_Config_PositionConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _meshtastic_Config_PositionConfig_GpsMode_MIN}
|
||||||
#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define meshtastic_Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, ""}
|
#define meshtastic_Config_NetworkConfig_init_zero {0, "", "", "", 0, _meshtastic_Config_NetworkConfig_AddressMode_MIN, false, meshtastic_Config_NetworkConfig_IpV4Config_init_zero, "", 0}
|
||||||
#define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0}
|
#define meshtastic_Config_NetworkConfig_IpV4Config_init_zero {0, 0, 0, 0}
|
||||||
#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN}
|
#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN}
|
||||||
#define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0}
|
#define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0}
|
||||||
@ -739,6 +753,7 @@ extern "C" {
|
|||||||
#define meshtastic_Config_NetworkConfig_address_mode_tag 7
|
#define meshtastic_Config_NetworkConfig_address_mode_tag 7
|
||||||
#define meshtastic_Config_NetworkConfig_ipv4_config_tag 8
|
#define meshtastic_Config_NetworkConfig_ipv4_config_tag 8
|
||||||
#define meshtastic_Config_NetworkConfig_rsyslog_server_tag 9
|
#define meshtastic_Config_NetworkConfig_rsyslog_server_tag 9
|
||||||
|
#define meshtastic_Config_NetworkConfig_enabled_protocols_tag 10
|
||||||
#define meshtastic_Config_DisplayConfig_screen_on_secs_tag 1
|
#define meshtastic_Config_DisplayConfig_screen_on_secs_tag 1
|
||||||
#define meshtastic_Config_DisplayConfig_gps_format_tag 2
|
#define meshtastic_Config_DisplayConfig_gps_format_tag 2
|
||||||
#define meshtastic_Config_DisplayConfig_auto_screen_carousel_secs_tag 3
|
#define meshtastic_Config_DisplayConfig_auto_screen_carousel_secs_tag 3
|
||||||
@ -867,7 +882,8 @@ X(a, STATIC, SINGULAR, STRING, ntp_server, 5) \
|
|||||||
X(a, STATIC, SINGULAR, BOOL, eth_enabled, 6) \
|
X(a, STATIC, SINGULAR, BOOL, eth_enabled, 6) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, address_mode, 7) \
|
X(a, STATIC, SINGULAR, UENUM, address_mode, 7) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, ipv4_config, 8) \
|
X(a, STATIC, OPTIONAL, MESSAGE, ipv4_config, 8) \
|
||||||
X(a, STATIC, SINGULAR, STRING, rsyslog_server, 9)
|
X(a, STATIC, SINGULAR, STRING, rsyslog_server, 9) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, enabled_protocols, 10)
|
||||||
#define meshtastic_Config_NetworkConfig_CALLBACK NULL
|
#define meshtastic_Config_NetworkConfig_CALLBACK NULL
|
||||||
#define meshtastic_Config_NetworkConfig_DEFAULT NULL
|
#define meshtastic_Config_NetworkConfig_DEFAULT NULL
|
||||||
#define meshtastic_Config_NetworkConfig_ipv4_config_MSGTYPE meshtastic_Config_NetworkConfig_IpV4Config
|
#define meshtastic_Config_NetworkConfig_ipv4_config_MSGTYPE meshtastic_Config_NetworkConfig_IpV4Config
|
||||||
@ -972,12 +988,12 @@ extern const pb_msgdesc_t meshtastic_Config_SessionkeyConfig_msg;
|
|||||||
#define meshtastic_Config_DisplayConfig_size 30
|
#define meshtastic_Config_DisplayConfig_size 30
|
||||||
#define meshtastic_Config_LoRaConfig_size 85
|
#define meshtastic_Config_LoRaConfig_size 85
|
||||||
#define meshtastic_Config_NetworkConfig_IpV4Config_size 20
|
#define meshtastic_Config_NetworkConfig_IpV4Config_size 20
|
||||||
#define meshtastic_Config_NetworkConfig_size 196
|
#define meshtastic_Config_NetworkConfig_size 202
|
||||||
#define meshtastic_Config_PositionConfig_size 62
|
#define meshtastic_Config_PositionConfig_size 62
|
||||||
#define meshtastic_Config_PowerConfig_size 52
|
#define meshtastic_Config_PowerConfig_size 52
|
||||||
#define meshtastic_Config_SecurityConfig_size 178
|
#define meshtastic_Config_SecurityConfig_size 178
|
||||||
#define meshtastic_Config_SessionkeyConfig_size 0
|
#define meshtastic_Config_SessionkeyConfig_size 0
|
||||||
#define meshtastic_Config_size 199
|
#define meshtastic_Config_size 205
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -51,6 +51,8 @@ typedef enum _meshtastic_Language {
|
|||||||
meshtastic_Language_GREEK = 13,
|
meshtastic_Language_GREEK = 13,
|
||||||
/* Norwegian */
|
/* Norwegian */
|
||||||
meshtastic_Language_NORWEGIAN = 14,
|
meshtastic_Language_NORWEGIAN = 14,
|
||||||
|
/* Slovenian */
|
||||||
|
meshtastic_Language_SLOVENIAN = 15,
|
||||||
/* Simplified Chinese (experimental) */
|
/* Simplified Chinese (experimental) */
|
||||||
meshtastic_Language_SIMPLIFIED_CHINESE = 30,
|
meshtastic_Language_SIMPLIFIED_CHINESE = 30,
|
||||||
/* Traditional Chinese (experimental) */
|
/* Traditional Chinese (experimental) */
|
||||||
@ -71,6 +73,8 @@ typedef struct _meshtastic_NodeFilter {
|
|||||||
bool position_switch;
|
bool position_switch;
|
||||||
/* Filter nodes by matching name string */
|
/* Filter nodes by matching name string */
|
||||||
char node_name[16];
|
char node_name[16];
|
||||||
|
/* Filter based on channel */
|
||||||
|
int8_t channel;
|
||||||
} meshtastic_NodeFilter;
|
} meshtastic_NodeFilter;
|
||||||
|
|
||||||
typedef struct _meshtastic_NodeHighlight {
|
typedef struct _meshtastic_NodeHighlight {
|
||||||
@ -138,10 +142,10 @@ extern "C" {
|
|||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_DeviceUIConfig_init_default {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_default, false, meshtastic_NodeHighlight_init_default, {0, {0}}}
|
#define meshtastic_DeviceUIConfig_init_default {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_default, false, meshtastic_NodeHighlight_init_default, {0, {0}}}
|
||||||
#define meshtastic_NodeFilter_init_default {0, 0, 0, 0, 0, ""}
|
#define meshtastic_NodeFilter_init_default {0, 0, 0, 0, 0, "", 0}
|
||||||
#define meshtastic_NodeHighlight_init_default {0, 0, 0, 0, ""}
|
#define meshtastic_NodeHighlight_init_default {0, 0, 0, 0, ""}
|
||||||
#define meshtastic_DeviceUIConfig_init_zero {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_zero, false, meshtastic_NodeHighlight_init_zero, {0, {0}}}
|
#define meshtastic_DeviceUIConfig_init_zero {0, 0, 0, 0, 0, 0, _meshtastic_Theme_MIN, 0, 0, 0, _meshtastic_Language_MIN, false, meshtastic_NodeFilter_init_zero, false, meshtastic_NodeHighlight_init_zero, {0, {0}}}
|
||||||
#define meshtastic_NodeFilter_init_zero {0, 0, 0, 0, 0, ""}
|
#define meshtastic_NodeFilter_init_zero {0, 0, 0, 0, 0, "", 0}
|
||||||
#define meshtastic_NodeHighlight_init_zero {0, 0, 0, 0, ""}
|
#define meshtastic_NodeHighlight_init_zero {0, 0, 0, 0, ""}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
@ -151,6 +155,7 @@ extern "C" {
|
|||||||
#define meshtastic_NodeFilter_hops_away_tag 4
|
#define meshtastic_NodeFilter_hops_away_tag 4
|
||||||
#define meshtastic_NodeFilter_position_switch_tag 5
|
#define meshtastic_NodeFilter_position_switch_tag 5
|
||||||
#define meshtastic_NodeFilter_node_name_tag 6
|
#define meshtastic_NodeFilter_node_name_tag 6
|
||||||
|
#define meshtastic_NodeFilter_channel_tag 7
|
||||||
#define meshtastic_NodeHighlight_chat_switch_tag 1
|
#define meshtastic_NodeHighlight_chat_switch_tag 1
|
||||||
#define meshtastic_NodeHighlight_position_switch_tag 2
|
#define meshtastic_NodeHighlight_position_switch_tag 2
|
||||||
#define meshtastic_NodeHighlight_telemetry_switch_tag 3
|
#define meshtastic_NodeHighlight_telemetry_switch_tag 3
|
||||||
@ -198,7 +203,8 @@ X(a, STATIC, SINGULAR, BOOL, offline_switch, 2) \
|
|||||||
X(a, STATIC, SINGULAR, BOOL, public_key_switch, 3) \
|
X(a, STATIC, SINGULAR, BOOL, public_key_switch, 3) \
|
||||||
X(a, STATIC, SINGULAR, INT32, hops_away, 4) \
|
X(a, STATIC, SINGULAR, INT32, hops_away, 4) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, position_switch, 5) \
|
X(a, STATIC, SINGULAR, BOOL, position_switch, 5) \
|
||||||
X(a, STATIC, SINGULAR, STRING, node_name, 6)
|
X(a, STATIC, SINGULAR, STRING, node_name, 6) \
|
||||||
|
X(a, STATIC, SINGULAR, INT32, channel, 7)
|
||||||
#define meshtastic_NodeFilter_CALLBACK NULL
|
#define meshtastic_NodeFilter_CALLBACK NULL
|
||||||
#define meshtastic_NodeFilter_DEFAULT NULL
|
#define meshtastic_NodeFilter_DEFAULT NULL
|
||||||
|
|
||||||
@ -222,8 +228,8 @@ extern const pb_msgdesc_t meshtastic_NodeHighlight_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define MESHTASTIC_MESHTASTIC_DEVICE_UI_PB_H_MAX_SIZE meshtastic_DeviceUIConfig_size
|
#define MESHTASTIC_MESHTASTIC_DEVICE_UI_PB_H_MAX_SIZE meshtastic_DeviceUIConfig_size
|
||||||
#define meshtastic_DeviceUIConfig_size 117
|
#define meshtastic_DeviceUIConfig_size 128
|
||||||
#define meshtastic_NodeFilter_size 36
|
#define meshtastic_NodeFilter_size 47
|
||||||
#define meshtastic_NodeHighlight_size 25
|
#define meshtastic_NodeHighlight_size 25
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -12,6 +12,9 @@ PB_BIND(meshtastic_PositionLite, meshtastic_PositionLite, AUTO)
|
|||||||
PB_BIND(meshtastic_UserLite, meshtastic_UserLite, AUTO)
|
PB_BIND(meshtastic_UserLite, meshtastic_UserLite, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(meshtastic_RelayNode, meshtastic_RelayNode, AUTO)
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_NodeInfoLite, meshtastic_NodeInfoLite, AUTO)
|
PB_BIND(meshtastic_NodeInfoLite, meshtastic_NodeInfoLite, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,6 +59,16 @@ typedef struct _meshtastic_UserLite {
|
|||||||
meshtastic_UserLite_public_key_t public_key;
|
meshtastic_UserLite_public_key_t public_key;
|
||||||
} meshtastic_UserLite;
|
} meshtastic_UserLite;
|
||||||
|
|
||||||
|
typedef struct _meshtastic_RelayNode {
|
||||||
|
/* The node number */
|
||||||
|
uint32_t num;
|
||||||
|
/* Set to indicate the last time we received a packet from this node */
|
||||||
|
uint32_t last_heard;
|
||||||
|
/* Returns the Signal-to-noise ratio (SNR) of the last received message,
|
||||||
|
as measured by the receiver. Return SNR of the last received message in dB */
|
||||||
|
float snr;
|
||||||
|
} meshtastic_RelayNode;
|
||||||
|
|
||||||
typedef struct _meshtastic_NodeInfoLite {
|
typedef struct _meshtastic_NodeInfoLite {
|
||||||
/* The node number */
|
/* The node number */
|
||||||
uint32_t num;
|
uint32_t num;
|
||||||
@ -92,8 +102,6 @@ typedef struct _meshtastic_NodeInfoLite {
|
|||||||
bool is_ignored;
|
bool is_ignored;
|
||||||
/* Last byte of the node number of the node that should be used as the next hop to reach this node. */
|
/* Last byte of the node number of the node that should be used as the next hop to reach this node. */
|
||||||
uint8_t next_hop;
|
uint8_t next_hop;
|
||||||
/* Node id of the relaying node. */
|
|
||||||
uint32_t relay_node;
|
|
||||||
} meshtastic_NodeInfoLite;
|
} meshtastic_NodeInfoLite;
|
||||||
|
|
||||||
/* This message is never sent over the wire, but it is used for serializing DB
|
/* This message is never sent over the wire, but it is used for serializing DB
|
||||||
@ -136,6 +144,8 @@ typedef struct _meshtastic_DeviceState {
|
|||||||
meshtastic_NodeRemoteHardwarePin node_remote_hardware_pins[12];
|
meshtastic_NodeRemoteHardwarePin node_remote_hardware_pins[12];
|
||||||
/* New lite version of NodeDB to decrease memory footprint */
|
/* New lite version of NodeDB to decrease memory footprint */
|
||||||
std::vector<meshtastic_NodeInfoLite> node_db_lite;
|
std::vector<meshtastic_NodeInfoLite> node_db_lite;
|
||||||
|
/* New coverage tracking vector */
|
||||||
|
std::vector<meshtastic_RelayNode> relay_db;
|
||||||
} meshtastic_DeviceState;
|
} meshtastic_DeviceState;
|
||||||
|
|
||||||
/* The on-disk saved channels */
|
/* The on-disk saved channels */
|
||||||
@ -157,13 +167,15 @@ extern "C" {
|
|||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_PositionLite_init_default {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN}
|
#define meshtastic_PositionLite_init_default {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN}
|
||||||
#define meshtastic_UserLite_init_default {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}}
|
#define meshtastic_UserLite_init_default {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}}
|
||||||
|
#define meshtastic_RelayNode_init_default {0, 0, 0}
|
||||||
#define meshtastic_NodeInfoLite_init_default {0, false, meshtastic_UserLite_init_default, false, meshtastic_PositionLite_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0, 0}
|
#define meshtastic_NodeInfoLite_init_default {0, false, meshtastic_UserLite_init_default, false, meshtastic_PositionLite_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0, 0}
|
||||||
#define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0, false, meshtastic_MeshPacket_init_default, 0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}, {0}}
|
#define meshtastic_DeviceState_init_default {false, meshtastic_MyNodeInfo_init_default, false, meshtastic_User_init_default, 0, {meshtastic_MeshPacket_init_default}, false, meshtastic_MeshPacket_init_default, 0, 0, 0, false, meshtastic_MeshPacket_init_default, 0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}, {0}, {0}}
|
||||||
#define meshtastic_ChannelFile_init_default {0, {meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default}, 0}
|
#define meshtastic_ChannelFile_init_default {0, {meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default, meshtastic_Channel_init_default}, 0}
|
||||||
#define meshtastic_PositionLite_init_zero {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN}
|
#define meshtastic_PositionLite_init_zero {0, 0, 0, 0, _meshtastic_Position_LocSource_MIN}
|
||||||
#define meshtastic_UserLite_init_zero {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}}
|
#define meshtastic_UserLite_init_zero {{0}, "", "", _meshtastic_HardwareModel_MIN, 0, _meshtastic_Config_DeviceConfig_Role_MIN, {0, {0}}}
|
||||||
|
#define meshtastic_RelayNode_init_zero {0, 0, 0}
|
||||||
#define meshtastic_NodeInfoLite_init_zero {0, false, meshtastic_UserLite_init_zero, false, meshtastic_PositionLite_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0, 0}
|
#define meshtastic_NodeInfoLite_init_zero {0, false, meshtastic_UserLite_init_zero, false, meshtastic_PositionLite_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0, 0}
|
||||||
#define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0, false, meshtastic_MeshPacket_init_zero, 0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}, {0}}
|
#define meshtastic_DeviceState_init_zero {false, meshtastic_MyNodeInfo_init_zero, false, meshtastic_User_init_zero, 0, {meshtastic_MeshPacket_init_zero}, false, meshtastic_MeshPacket_init_zero, 0, 0, 0, false, meshtastic_MeshPacket_init_zero, 0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}, {0}, {0}}
|
||||||
#define meshtastic_ChannelFile_init_zero {0, {meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero}, 0}
|
#define meshtastic_ChannelFile_init_zero {0, {meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero, meshtastic_Channel_init_zero}, 0}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
@ -179,6 +191,9 @@ extern "C" {
|
|||||||
#define meshtastic_UserLite_is_licensed_tag 5
|
#define meshtastic_UserLite_is_licensed_tag 5
|
||||||
#define meshtastic_UserLite_role_tag 6
|
#define meshtastic_UserLite_role_tag 6
|
||||||
#define meshtastic_UserLite_public_key_tag 7
|
#define meshtastic_UserLite_public_key_tag 7
|
||||||
|
#define meshtastic_RelayNode_num_tag 1
|
||||||
|
#define meshtastic_RelayNode_last_heard_tag 2
|
||||||
|
#define meshtastic_RelayNode_snr_tag 3
|
||||||
#define meshtastic_NodeInfoLite_num_tag 1
|
#define meshtastic_NodeInfoLite_num_tag 1
|
||||||
#define meshtastic_NodeInfoLite_user_tag 2
|
#define meshtastic_NodeInfoLite_user_tag 2
|
||||||
#define meshtastic_NodeInfoLite_position_tag 3
|
#define meshtastic_NodeInfoLite_position_tag 3
|
||||||
@ -201,6 +216,7 @@ extern "C" {
|
|||||||
#define meshtastic_DeviceState_rx_waypoint_tag 12
|
#define meshtastic_DeviceState_rx_waypoint_tag 12
|
||||||
#define meshtastic_DeviceState_node_remote_hardware_pins_tag 13
|
#define meshtastic_DeviceState_node_remote_hardware_pins_tag 13
|
||||||
#define meshtastic_DeviceState_node_db_lite_tag 14
|
#define meshtastic_DeviceState_node_db_lite_tag 14
|
||||||
|
#define meshtastic_DeviceState_relay_db_tag 15
|
||||||
#define meshtastic_ChannelFile_channels_tag 1
|
#define meshtastic_ChannelFile_channels_tag 1
|
||||||
#define meshtastic_ChannelFile_version_tag 2
|
#define meshtastic_ChannelFile_version_tag 2
|
||||||
|
|
||||||
@ -225,6 +241,13 @@ X(a, STATIC, SINGULAR, BYTES, public_key, 7)
|
|||||||
#define meshtastic_UserLite_CALLBACK NULL
|
#define meshtastic_UserLite_CALLBACK NULL
|
||||||
#define meshtastic_UserLite_DEFAULT NULL
|
#define meshtastic_UserLite_DEFAULT NULL
|
||||||
|
|
||||||
|
#define meshtastic_RelayNode_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, num, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, FIXED32, last_heard, 2) \
|
||||||
|
X(a, STATIC, SINGULAR, FLOAT, snr, 3)
|
||||||
|
#define meshtastic_RelayNode_CALLBACK NULL
|
||||||
|
#define meshtastic_RelayNode_DEFAULT NULL
|
||||||
|
|
||||||
#define meshtastic_NodeInfoLite_FIELDLIST(X, a) \
|
#define meshtastic_NodeInfoLite_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, num, 1) \
|
X(a, STATIC, SINGULAR, UINT32, num, 1) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, user, 2) \
|
X(a, STATIC, OPTIONAL, MESSAGE, user, 2) \
|
||||||
@ -254,7 +277,8 @@ X(a, STATIC, SINGULAR, BOOL, no_save, 9) \
|
|||||||
X(a, STATIC, SINGULAR, BOOL, did_gps_reset, 11) \
|
X(a, STATIC, SINGULAR, BOOL, did_gps_reset, 11) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, rx_waypoint, 12) \
|
X(a, STATIC, OPTIONAL, MESSAGE, rx_waypoint, 12) \
|
||||||
X(a, STATIC, REPEATED, MESSAGE, node_remote_hardware_pins, 13) \
|
X(a, STATIC, REPEATED, MESSAGE, node_remote_hardware_pins, 13) \
|
||||||
X(a, CALLBACK, REPEATED, MESSAGE, node_db_lite, 14)
|
X(a, CALLBACK, REPEATED, MESSAGE, node_db_lite, 14) \
|
||||||
|
X(a, CALLBACK, REPEATED, MESSAGE, relay_db, 15)
|
||||||
extern bool meshtastic_DeviceState_callback(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_t *field);
|
extern bool meshtastic_DeviceState_callback(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_t *field);
|
||||||
#define meshtastic_DeviceState_CALLBACK meshtastic_DeviceState_callback
|
#define meshtastic_DeviceState_CALLBACK meshtastic_DeviceState_callback
|
||||||
#define meshtastic_DeviceState_DEFAULT NULL
|
#define meshtastic_DeviceState_DEFAULT NULL
|
||||||
@ -265,6 +289,7 @@ extern bool meshtastic_DeviceState_callback(pb_istream_t *istream, pb_ostream_t
|
|||||||
#define meshtastic_DeviceState_rx_waypoint_MSGTYPE meshtastic_MeshPacket
|
#define meshtastic_DeviceState_rx_waypoint_MSGTYPE meshtastic_MeshPacket
|
||||||
#define meshtastic_DeviceState_node_remote_hardware_pins_MSGTYPE meshtastic_NodeRemoteHardwarePin
|
#define meshtastic_DeviceState_node_remote_hardware_pins_MSGTYPE meshtastic_NodeRemoteHardwarePin
|
||||||
#define meshtastic_DeviceState_node_db_lite_MSGTYPE meshtastic_NodeInfoLite
|
#define meshtastic_DeviceState_node_db_lite_MSGTYPE meshtastic_NodeInfoLite
|
||||||
|
#define meshtastic_DeviceState_relay_db_MSGTYPE meshtastic_RelayNode
|
||||||
|
|
||||||
#define meshtastic_ChannelFile_FIELDLIST(X, a) \
|
#define meshtastic_ChannelFile_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, REPEATED, MESSAGE, channels, 1) \
|
X(a, STATIC, REPEATED, MESSAGE, channels, 1) \
|
||||||
@ -275,6 +300,7 @@ X(a, STATIC, SINGULAR, UINT32, version, 2)
|
|||||||
|
|
||||||
extern const pb_msgdesc_t meshtastic_PositionLite_msg;
|
extern const pb_msgdesc_t meshtastic_PositionLite_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_UserLite_msg;
|
extern const pb_msgdesc_t meshtastic_UserLite_msg;
|
||||||
|
extern const pb_msgdesc_t meshtastic_RelayNode_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_NodeInfoLite_msg;
|
extern const pb_msgdesc_t meshtastic_NodeInfoLite_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_DeviceState_msg;
|
extern const pb_msgdesc_t meshtastic_DeviceState_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_ChannelFile_msg;
|
extern const pb_msgdesc_t meshtastic_ChannelFile_msg;
|
||||||
@ -282,6 +308,7 @@ extern const pb_msgdesc_t meshtastic_ChannelFile_msg;
|
|||||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
#define meshtastic_PositionLite_fields &meshtastic_PositionLite_msg
|
#define meshtastic_PositionLite_fields &meshtastic_PositionLite_msg
|
||||||
#define meshtastic_UserLite_fields &meshtastic_UserLite_msg
|
#define meshtastic_UserLite_fields &meshtastic_UserLite_msg
|
||||||
|
#define meshtastic_RelayNode_fields &meshtastic_RelayNode_msg
|
||||||
#define meshtastic_NodeInfoLite_fields &meshtastic_NodeInfoLite_msg
|
#define meshtastic_NodeInfoLite_fields &meshtastic_NodeInfoLite_msg
|
||||||
#define meshtastic_DeviceState_fields &meshtastic_DeviceState_msg
|
#define meshtastic_DeviceState_fields &meshtastic_DeviceState_msg
|
||||||
#define meshtastic_ChannelFile_fields &meshtastic_ChannelFile_msg
|
#define meshtastic_ChannelFile_fields &meshtastic_ChannelFile_msg
|
||||||
@ -292,6 +319,7 @@ extern const pb_msgdesc_t meshtastic_ChannelFile_msg;
|
|||||||
#define meshtastic_ChannelFile_size 718
|
#define meshtastic_ChannelFile_size 718
|
||||||
#define meshtastic_NodeInfoLite_size 188
|
#define meshtastic_NodeInfoLite_size 188
|
||||||
#define meshtastic_PositionLite_size 28
|
#define meshtastic_PositionLite_size 28
|
||||||
|
#define meshtastic_RelayNode_size 16
|
||||||
#define meshtastic_UserLite_size 96
|
#define meshtastic_UserLite_size 96
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -187,7 +187,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size
|
#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalConfig_size
|
||||||
#define meshtastic_LocalConfig_size 735
|
#define meshtastic_LocalConfig_size 741
|
||||||
#define meshtastic_LocalModuleConfig_size 699
|
#define meshtastic_LocalModuleConfig_size 699
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -235,9 +235,9 @@ typedef enum _meshtastic_Constants {
|
|||||||
pass int constants between two very different environments */
|
pass int constants between two very different environments */
|
||||||
meshtastic_Constants_ZERO = 0,
|
meshtastic_Constants_ZERO = 0,
|
||||||
/* From mesh.options
|
/* From mesh.options
|
||||||
note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is
|
note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 32 byte header is
|
||||||
outside of this envelope */
|
outside of this envelope */
|
||||||
meshtastic_Constants_DATA_PAYLOAD_LEN = 233
|
meshtastic_Constants_DATA_PAYLOAD_LEN = 217
|
||||||
} meshtastic_Constants;
|
} meshtastic_Constants;
|
||||||
|
|
||||||
/* Error codes for critical errors
|
/* Error codes for critical errors
|
||||||
@ -613,7 +613,7 @@ typedef struct _meshtastic_Routing {
|
|||||||
};
|
};
|
||||||
} meshtastic_Routing;
|
} meshtastic_Routing;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(233) meshtastic_Data_payload_t;
|
typedef PB_BYTES_ARRAY_T(217) meshtastic_Data_payload_t;
|
||||||
/* (Formerly called SubPacket)
|
/* (Formerly called SubPacket)
|
||||||
The payload portion fo a packet, this is the actual bytes that are sent
|
The payload portion fo a packet, this is the actual bytes that are sent
|
||||||
inside a radio packet (because from/to are broken out by the comms library) */
|
inside a radio packet (because from/to are broken out by the comms library) */
|
||||||
@ -690,10 +690,10 @@ typedef struct _meshtastic_MqttClientProxyMessage {
|
|||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(256) meshtastic_MeshPacket_encrypted_t;
|
typedef PB_BYTES_ARRAY_T(256) meshtastic_MeshPacket_encrypted_t;
|
||||||
typedef PB_BYTES_ARRAY_T(32) meshtastic_MeshPacket_public_key_t;
|
typedef PB_BYTES_ARRAY_T(32) meshtastic_MeshPacket_public_key_t;
|
||||||
typedef PB_BYTES_ARRAY_T(13) meshtastic_MeshPacket_coverage_filter_t;
|
typedef PB_BYTES_ARRAY_T(104) meshtastic_MeshPacket_coverage_filter_t;
|
||||||
/* A packet envelope sent/received over the mesh
|
/* A packet envelope sent/received over the mesh
|
||||||
only payload_variant is sent in the payload portion of the LORA packet.
|
only payload_variant is sent in the payload portion of the LORA packet.
|
||||||
The other fields are either not sent at all, or sent in the special 16 byte LORA header. */
|
The other fields are either not sent at all, or sent in the special 32 byte LORA header. */
|
||||||
typedef struct _meshtastic_MeshPacket {
|
typedef struct _meshtastic_MeshPacket {
|
||||||
/* The sending node number.
|
/* The sending node number.
|
||||||
Note: Our crypto implementation uses this field as well.
|
Note: Our crypto implementation uses this field as well.
|
||||||
@ -775,7 +775,7 @@ typedef struct _meshtastic_MeshPacket {
|
|||||||
Timestamp after which this packet may be sent.
|
Timestamp after which this packet may be sent.
|
||||||
Set by the firmware internally, clients are not supposed to set this. */
|
Set by the firmware internally, clients are not supposed to set this. */
|
||||||
uint32_t tx_after;
|
uint32_t tx_after;
|
||||||
/* Flips two bits per node added to the filter */
|
/* A bloom filter storing the top 20 nodes for each hop using 2 hashes */
|
||||||
meshtastic_MeshPacket_coverage_filter_t coverage_filter;
|
meshtastic_MeshPacket_coverage_filter_t coverage_filter;
|
||||||
} meshtastic_MeshPacket;
|
} meshtastic_MeshPacket;
|
||||||
|
|
||||||
@ -1185,7 +1185,7 @@ extern "C" {
|
|||||||
#define meshtastic_Data_init_default {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0}
|
#define meshtastic_Data_init_default {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0}
|
||||||
#define meshtastic_Waypoint_init_default {0, false, 0, false, 0, 0, 0, "", "", 0}
|
#define meshtastic_Waypoint_init_default {0, false, 0, false, 0, 0, 0, "", "", 0}
|
||||||
#define meshtastic_MqttClientProxyMessage_init_default {"", 0, {{0, {0}}}, 0}
|
#define meshtastic_MqttClientProxyMessage_init_default {"", 0, {{0, {0}}}, 0}
|
||||||
#define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0}
|
#define meshtastic_MeshPacket_init_default {0, 0, 0, 0, {meshtastic_Data_init_default}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0, {0, {0}}}
|
||||||
#define meshtastic_NodeInfo_init_default {0, false, meshtastic_User_init_default, false, meshtastic_Position_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0}
|
#define meshtastic_NodeInfo_init_default {0, false, meshtastic_User_init_default, false, meshtastic_Position_init_default, 0, 0, false, meshtastic_DeviceMetrics_init_default, 0, 0, false, 0, 0, 0}
|
||||||
#define meshtastic_MyNodeInfo_init_default {0, 0, 0, {0, {0}}, ""}
|
#define meshtastic_MyNodeInfo_init_default {0, 0, 0, {0, {0}}, ""}
|
||||||
#define meshtastic_LogRecord_init_default {"", 0, "", _meshtastic_LogRecord_Level_MIN}
|
#define meshtastic_LogRecord_init_default {"", 0, "", _meshtastic_LogRecord_Level_MIN}
|
||||||
@ -1210,7 +1210,7 @@ extern "C" {
|
|||||||
#define meshtastic_Data_init_zero {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0}
|
#define meshtastic_Data_init_zero {_meshtastic_PortNum_MIN, {0, {0}}, 0, 0, 0, 0, 0, 0, false, 0}
|
||||||
#define meshtastic_Waypoint_init_zero {0, false, 0, false, 0, 0, 0, "", "", 0}
|
#define meshtastic_Waypoint_init_zero {0, false, 0, false, 0, 0, 0, "", "", 0}
|
||||||
#define meshtastic_MqttClientProxyMessage_init_zero {"", 0, {{0, {0}}}, 0}
|
#define meshtastic_MqttClientProxyMessage_init_zero {"", 0, {{0, {0}}}, 0}
|
||||||
#define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0}
|
#define meshtastic_MeshPacket_init_zero {0, 0, 0, 0, {meshtastic_Data_init_zero}, 0, 0, 0, 0, 0, _meshtastic_MeshPacket_Priority_MIN, 0, _meshtastic_MeshPacket_Delayed_MIN, 0, 0, {0, {0}}, 0, 0, 0, 0, {0, {0}}}
|
||||||
#define meshtastic_NodeInfo_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_Position_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0}
|
#define meshtastic_NodeInfo_init_zero {0, false, meshtastic_User_init_zero, false, meshtastic_Position_init_zero, 0, 0, false, meshtastic_DeviceMetrics_init_zero, 0, 0, false, 0, 0, 0}
|
||||||
#define meshtastic_MyNodeInfo_init_zero {0, 0, 0, {0, {0}}, ""}
|
#define meshtastic_MyNodeInfo_init_zero {0, 0, 0, {0, {0}}, ""}
|
||||||
#define meshtastic_LogRecord_init_zero {"", 0, "", _meshtastic_LogRecord_Level_MIN}
|
#define meshtastic_LogRecord_init_zero {"", 0, "", _meshtastic_LogRecord_Level_MIN}
|
||||||
@ -1752,13 +1752,13 @@ extern const pb_msgdesc_t meshtastic_ChunkedPayloadResponse_msg;
|
|||||||
#define meshtastic_ChunkedPayload_size 245
|
#define meshtastic_ChunkedPayload_size 245
|
||||||
#define meshtastic_ClientNotification_size 415
|
#define meshtastic_ClientNotification_size 415
|
||||||
#define meshtastic_Compressed_size 239
|
#define meshtastic_Compressed_size 239
|
||||||
#define meshtastic_Data_size 269
|
#define meshtastic_Data_size 253
|
||||||
#define meshtastic_DeviceMetadata_size 54
|
#define meshtastic_DeviceMetadata_size 54
|
||||||
#define meshtastic_FileInfo_size 236
|
#define meshtastic_FileInfo_size 236
|
||||||
#define meshtastic_FromRadio_size 510
|
#define meshtastic_FromRadio_size 510
|
||||||
#define meshtastic_Heartbeat_size 0
|
#define meshtastic_Heartbeat_size 0
|
||||||
#define meshtastic_LogRecord_size 426
|
#define meshtastic_LogRecord_size 426
|
||||||
#define meshtastic_MeshPacket_size 378
|
#define meshtastic_MeshPacket_size 475
|
||||||
#define meshtastic_MqttClientProxyMessage_size 501
|
#define meshtastic_MqttClientProxyMessage_size 501
|
||||||
#define meshtastic_MyNodeInfo_size 77
|
#define meshtastic_MyNodeInfo_size 77
|
||||||
#define meshtastic_NeighborInfo_size 258
|
#define meshtastic_NeighborInfo_size 258
|
||||||
|
@ -23,6 +23,11 @@
|
|||||||
#define MAX_NUM_NODES 100
|
#define MAX_NUM_NODES 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// max number of relays allowed
|
||||||
|
#ifndef MAX_NUM_RELAYS
|
||||||
|
#define MAX_NUM_RELAYS 20
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_NUM_NODES_FS 100
|
#define MAX_NUM_NODES_FS 100
|
||||||
|
|
||||||
/// Max number of channels allowed
|
/// Max number of channels allowed
|
||||||
|
Loading…
Reference in New Issue
Block a user