Skip to content

Commit

Permalink
Ignore (from)Net time on positions with an unknown or fixed location …
Browse files Browse the repository at this point in the history
…source (#4593)

* Ignore (from)Net time on positions with an unknown or fixed location source

* Dunk a trunk
  • Loading branch information
thebentern authored Aug 31, 2024
1 parent 7475cc3 commit 33eb073
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/modules/PositionModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ void PositionModule::trySetRtc(meshtastic_Position p, bool isLocal, bool forceUp
LOG_DEBUG("Ignoring time from mesh because we have a GPS, RTC, or Phone/NTP time source in the past day\n");
return;
}
if (!isLocal && p.location_source < meshtastic_Position_LocSource_LOC_INTERNAL) {
LOG_DEBUG("Ignoring time from mesh because it has a unknown or manual source\n");
return;
}
struct timeval tv;
uint32_t secs = p.time;

Expand Down Expand Up @@ -191,6 +195,10 @@ meshtastic_MeshPacket *PositionModule::allocReply()
p.has_longitude_i = true;
p.time = getValidTime(RTCQualityNTP) > 0 ? getValidTime(RTCQualityNTP) : localPosition.time;

if (config.position.fixed_position) {
p.location_source = meshtastic_Position_LocSource_LOC_MANUAL;
}

if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE) {
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL) {
p.altitude = localPosition.altitude;
Expand Down

0 comments on commit 33eb073

Please sign in to comment.