sforkowany z mirror/meshtastic-firmware
fix #622 - we might not have a local position yet early in the boot
rodzic
01848a9e5d
commit
34faea6100
|
@ -31,10 +31,16 @@ MeshPacket *PositionPlugin::allocReply()
|
||||||
{
|
{
|
||||||
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||||
assert(node);
|
assert(node);
|
||||||
assert(node->has_position);
|
|
||||||
|
// We might not have a position yet for our local node, in that case, at least try to send the time
|
||||||
|
if(!node->has_position) {
|
||||||
|
memset(&node->position, 0, sizeof(node->position));
|
||||||
|
node->has_position = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Position &position = node->position;
|
||||||
|
|
||||||
// Update our local node info with our position (even if we don't decide to update anyone else)
|
// Update our local node info with our position (even if we don't decide to update anyone else)
|
||||||
auto position = node->position;
|
|
||||||
position.time = getValidTime(RTCQualityGPS); // This nodedb timestamp might be stale, so update it if our clock is valid.
|
position.time = getValidTime(RTCQualityGPS); // This nodedb timestamp might be stale, so update it if our clock is valid.
|
||||||
|
|
||||||
return allocDataProtobuf(position);
|
return allocDataProtobuf(position);
|
||||||
|
|
Ładowanie…
Reference in New Issue