Skip to content

Commit 1a85756

Browse files
committed
Update svInTracking lastSeen
1 parent e742b43 commit 1a85756

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Firmware/RTK_Everywhere/GNSS_Mosaic.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,10 @@ class GNSS_MOSAIC : GNSS
613613
return m.SVID == findThisSv;
614614
}
615615
};
616+
// Check if SV is stale based on its lastSeen
616617
struct find_stale_sv
617618
{
618-
const unsigned long expireAfter_millis = 20000; // 10000 is too short
619+
const unsigned long expireAfter_millis = 2000;
619620
unsigned long millisNow;
620621
find_stale_sv(unsigned long now) : millisNow(now) {}
621622
bool operator () (const svTracking_t& m) const
@@ -631,7 +632,7 @@ class GNSS_MOSAIC : GNSS
631632
_antennaIsOpen(false), _antennaIsShorted(false),
632633
GNSS()
633634
{
634-
svInTracking.clear();
635+
svInTracking.clear();
635636
}
636637

637638
// If we have decryption keys, configure module

Firmware/RTK_Everywhere/GNSS_Mosaic.ino

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,10 +2592,16 @@ void GNSS_MOSAIC::storeBlock4013(SEMP_PARSE_STATE *parse)
25922592

25932593
if (Tracking)
25942594
{
2595-
// SV is being tracked. If it is not in svInTracking, add it
2595+
// SV is being tracked
25962596
std::vector<svTracking_t>::iterator pos = std::find_if(svInTracking.begin(), svInTracking.end(), find_sv(SVID));
2597-
if (pos == svInTracking.end())
2597+
if (pos == svInTracking.end()) // If it is not in svInTracking, add it
25982598
svInTracking.push_back({SVID, millis()});
2599+
else // Update lastSeen
2600+
{
2601+
svTracking_t sv = *pos;
2602+
sv.lastSeen = millis();
2603+
*pos = sv;
2604+
}
25992605
}
26002606
else
26012607
{

0 commit comments

Comments
 (0)