Verified Commit 5cd8c403 authored by Angus Ainslie's avatar Angus Ainslie Committed by Clayton Craft
Browse files

stm_agps.py: don't fail if one of the AGPS files is missing (MR 2)



Fixes #2
Signed-off-by: default avatarAngus Ainslie <angus@akkea.ca>
parent 99093892
......@@ -133,18 +133,19 @@ class STM_AGPS:
almanac_path = os.path.join(dir, 'almanac.txt')
ephemeris_path = os.path.join(dir, 'ephemeris.txt')
for file in [almanac_path, ephemeris_path]:
if not os.path.exists(file):
self.__log.warn(f"AGPS file not found: {file}")
self.__log.warn("*NOT* loading AGPS data")
return
# reset device in case it is stuck, and set time
await self.reset()
await self.set_time()
await self._load_almanac(almanac_path)
await self._load_ephemeris(ephemeris_path)
if not os.path.exists(almanac_path):
self.__log.warn(f"AGPS almanac file not found: {almanac_path}")
else:
await self._load_almanac(almanac_path)
if not os.path.exists(ephemeris_path):
self.__log.warn(f"AGPS ephemeris file not found: {ephemeris_path}")
else:
await self._load_ephemeris(ephemeris_path)
async def _store_ephemeris(self, file='ephemeris.txt'):
await self._store_to_file('STMDUMPEPHEMS', '$PSTMEPHEM', file)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment