Skip to content

Commit

Permalink
#60 fix data logging
Browse files Browse the repository at this point in the history
  • Loading branch information
DarylDohner committed Jul 6, 2023
1 parent f6127d7 commit 6607dd1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions EosPayload/drivers/GPS_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def device_read(self, logger: logging.Logger) -> None:
time_month, time_year)
data_datetime = datetime.datetime.strptime(data_datetime_string, GPSDriver.data_time_format)
date_time = data_datetime.timestamp()
logger.info(f"Parsed timestamp from GPS: {data_datetime.isoformat()} ({date_time})")
except Exception as e:
data_datetime = datetime.datetime.now()
date_time = data_datetime.timestamp()
Expand All @@ -84,7 +83,10 @@ def device_read(self, logger: logging.Logger) -> None:
"\nusing current system time instead")

data_points = [date_time, gps_lat, gps_long, gps_alt, gps_speed, gps_sat]
self.data_log(data_points)
try:
self.data_log([str(datum) for datum in data_points])
except Exception as e:
logger.warning(f"exception thrown while logging data: {e}\n{traceback.format_exc()}")

if None in data_points:
logger.warning(f"Invalid GPS packet: time={date_time}, lat={gps_lat}, long={gps_long}"
Expand Down

0 comments on commit 6607dd1

Please sign in to comment.