File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -613,9 +613,10 @@ class GNSS_MOSAIC : GNSS
613
613
return m.SVID == findThisSv;
614
614
}
615
615
};
616
+ // Check if SV is stale based on its lastSeen
616
617
struct find_stale_sv
617
618
{
618
- const unsigned long expireAfter_millis = 20000 ; // 10000 is too short
619
+ const unsigned long expireAfter_millis = 2000 ;
619
620
unsigned long millisNow;
620
621
find_stale_sv (unsigned long now) : millisNow(now) {}
621
622
bool operator () (const svTracking_t& m) const
@@ -631,7 +632,7 @@ class GNSS_MOSAIC : GNSS
631
632
_antennaIsOpen(false ), _antennaIsShorted(false ),
632
633
GNSS()
633
634
{
634
- svInTracking.clear ();
635
+ svInTracking.clear ();
635
636
}
636
637
637
638
// If we have decryption keys, configure module
Original file line number Diff line number Diff line change @@ -2592,10 +2592,16 @@ void GNSS_MOSAIC::storeBlock4013(SEMP_PARSE_STATE *parse)
2592
2592
2593
2593
if (Tracking)
2594
2594
{
2595
- // SV is being tracked. If it is not in svInTracking, add it
2595
+ // SV is being tracked
2596
2596
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
2598
2598
svInTracking.push_back ({SVID, millis ()});
2599
+ else // Update lastSeen
2600
+ {
2601
+ svTracking_t sv = *pos;
2602
+ sv.lastSeen = millis ();
2603
+ *pos = sv;
2604
+ }
2599
2605
}
2600
2606
else
2601
2607
{
You can’t perform that action at this time.
0 commit comments