Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.

Commit c942a03

Browse files
committed
Merge pull request #304 from ljbade/improve-ephemeris-healthy
Check for valid ephemeris in satellite_healthy()
2 parents 2c0d0a7 + bc469a6 commit c942a03

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

python/tests/test_ephemeris.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_sat_state():
122122
'af1': 3.637978807091713e-12,
123123
'af2': 0.0}})
124124
assert not eph.is_valid(t.GpsTime(**{ 'wn': 1867, 'tow': 518400.0,}))
125-
assert not eph.is_healthy()
125+
assert eph.is_healthy()
126126
eph = e.Ephemeris(**{'sid': {'sat': 17, 'code': 0},
127127
'toe': { 'wn': 1867, 'tow': 518400.0,},
128128
'ura': 2.0,

src/ephemeris.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,13 @@ u8 ephemeris_valid(const ephemeris_t *eph, const gps_time_t *t)
286286
*/
287287
u8 satellite_healthy(const ephemeris_t *eph)
288288
{
289-
return eph->healthy;
289+
if (eph->valid) {
290+
return eph->healthy;
291+
} else {
292+
/* If we don't yet have an ephemeris, assume satellite is healthy */
293+
/* Otherwise we will stop tracking the sat and never find out */
294+
return 1;
295+
}
290296
}
291297

292298
/** Convert a GPS URA index into a value.

0 commit comments

Comments
 (0)