Skip to content

Commit

Permalink
Time Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wnagele committed Dec 7, 2023
1 parent 9188a9a commit 41c190c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/PositionModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bool PositionModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mes
p.altitude_geoidal_separation, p.PDOP, p.HDOP, p.VDOP, p.sats_in_view, p.fix_quality, p.fix_type, p.timestamp,
p.time);

if (p.time) {
if (p.time && channels.getByIndex(mp.channel).role == meshtastic_Channel_Role_PRIMARY) {
struct timeval tv;
uint32_t secs = p.time;

Expand All @@ -87,6 +87,7 @@ bool PositionModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mes
meshtastic_MeshPacket *PositionModule::allocReply()
{
if (ignoreRequest) {
ignoreRequest = false; // Reset for next request
return nullptr;
}

Expand Down Expand Up @@ -150,6 +151,7 @@ meshtastic_MeshPacket *PositionModule::allocReply()
LOG_INFO("Stripping time %u from position send\n", p.time);
p.time = 0;
} else {
p.time = getValidTime(RTCQualityDevice);
LOG_INFO("Providing time to mesh %u\n", p.time);
}

Expand All @@ -166,7 +168,7 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies, uint8_t cha

meshtastic_MeshPacket *p = allocReply();
if (p == nullptr) {
LOG_WARN("allocReply returned a nullptr");
LOG_WARN("allocReply returned a nullptr\n");
return;
}

Expand Down

0 comments on commit 41c190c

Please sign in to comment.