mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-22 13:04:53 +00:00
oops - we weren't properly stripping timestamps from new style positions
This commit is contained in:
parent
8c225a3c65
commit
52ec4d511c
@ -178,18 +178,6 @@ void MeshService::sendToMesh(MeshPacket *p)
|
|||||||
{
|
{
|
||||||
nodeDB.updateFrom(*p); // update our local DB for this packet (because phone might have sent position packets etc...)
|
nodeDB.updateFrom(*p); // update our local DB for this packet (because phone might have sent position packets etc...)
|
||||||
|
|
||||||
// Strip out any time information before sending packets to other nodes - to keep the wire size small (and because other
|
|
||||||
// nodes shouldn't trust it anyways) Note: we allow a device with a local GPS to include the time, so that gpsless
|
|
||||||
// devices can get time.
|
|
||||||
if (p->which_payloadVariant == MeshPacket_decoded_tag && p->decoded.which_payloadVariant == SubPacket_position_tag &&
|
|
||||||
p->decoded.position.time) {
|
|
||||||
if (getRTCQuality() < RTCQualityGPS) {
|
|
||||||
DEBUG_MSG("Stripping time %u from position send\n", p->decoded.position.time);
|
|
||||||
p->decoded.position.time = 0;
|
|
||||||
} else
|
|
||||||
DEBUG_MSG("Providing time to mesh %u\n", p->decoded.position.time);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: We might return !OK if our fifo was full, at that point the only option we have is to drop it
|
// Note: We might return !OK if our fifo was full, at that point the only option we have is to drop it
|
||||||
router->sendLocal(p);
|
router->sendLocal(p);
|
||||||
}
|
}
|
||||||
@ -221,7 +209,7 @@ NodeInfo *MeshService::refreshMyNodeInfo() {
|
|||||||
Position &position = node->position;
|
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)
|
||||||
position.time = getValidTime(RTCQualityGPS); // This nodedb timestamp might be stale, so update it if our clock is valid.
|
position.time = getValidTime(RTCQualityFromNet); // This nodedb timestamp might be stale, so update it if our clock is kinda valid
|
||||||
|
|
||||||
position.battery_level = powerStatus->getBatteryChargePercent();
|
position.battery_level = powerStatus->getBatteryChargePercent();
|
||||||
updateBatteryLevel(position.battery_level);
|
updateBatteryLevel(position.battery_level);
|
||||||
|
@ -32,13 +32,24 @@ MeshPacket *PositionPlugin::allocReply()
|
|||||||
NodeInfo *node = service.refreshMyNodeInfo(); // should guarantee there is now a position
|
NodeInfo *node = service.refreshMyNodeInfo(); // should guarantee there is now a position
|
||||||
assert(node->has_position);
|
assert(node->has_position);
|
||||||
|
|
||||||
return allocDataProtobuf(node->position);
|
Position p = node->position;
|
||||||
|
|
||||||
|
// Strip out any time information before sending packets to other nodes - to keep the wire size small (and because other
|
||||||
|
// nodes shouldn't trust it anyways) Note: we allow a device with a local GPS to include the time, so that gpsless
|
||||||
|
// devices can get time.
|
||||||
|
if (getRTCQuality() < RTCQualityGPS) {
|
||||||
|
DEBUG_MSG("Stripping time %u from position send\n", p.time);
|
||||||
|
p.time = 0;
|
||||||
|
} else
|
||||||
|
DEBUG_MSG("Providing time to mesh %u\n", p.time);
|
||||||
|
|
||||||
|
return allocDataProtobuf(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PositionPlugin::sendOurPosition(NodeNum dest, bool wantReplies)
|
void PositionPlugin::sendOurPosition(NodeNum dest, bool wantReplies)
|
||||||
{
|
{
|
||||||
// cancel any not yet sent (now stale) position packets
|
// cancel any not yet sent (now stale) position packets
|
||||||
if(prevPacketId) // if we wrap around to zero, we'll simply fail to cancel in that rare case (no big deal)
|
if (prevPacketId) // if we wrap around to zero, we'll simply fail to cancel in that rare case (no big deal)
|
||||||
service.cancelSending(prevPacketId);
|
service.cancelSending(prevPacketId);
|
||||||
|
|
||||||
MeshPacket *p = allocReply();
|
MeshPacket *p = allocReply();
|
||||||
@ -49,4 +60,3 @@ void PositionPlugin::sendOurPosition(NodeNum dest, bool wantReplies)
|
|||||||
|
|
||||||
service.sendToMesh(p);
|
service.sendToMesh(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user