Add GPS data to data on flash memory
This commit is contained in:
parent
50b73d3592
commit
4b9885d7a7
@ -199,11 +199,25 @@ class Data:
|
||||
"""Save the current data as csv file on SPI flash"""
|
||||
try:
|
||||
with open("data/data.csv", "a") as csv_file:
|
||||
csv_file.write("{};{};{};{};{}\n".format(self.data['SYS']['time'],
|
||||
self.data['BME']['temp'],
|
||||
self.data['BME']['hum'],
|
||||
self.data['BME']['press'],
|
||||
self.data['SYS']['vbat']))
|
||||
if gps_enable:
|
||||
csv_file.write("{};{};{};{};{};{};{};{};{};{}\n".format(self.data['SYS']['time'],
|
||||
self.data['BME']['temp'],
|
||||
self.data['BME']['hum'],
|
||||
self.data['BME']['press'],
|
||||
self.data['SYS']['vbat'],
|
||||
self.data['GPS']['time'],
|
||||
self.data['GPS']['lon'],
|
||||
self.data['GPS']['lat'],
|
||||
self.data['GPS']['alt'],
|
||||
self.data['GPS']['qual'],
|
||||
))
|
||||
else:
|
||||
csv_file.write("{};{};{};{};{};;;;;\n".format(self.data['SYS']['time'],
|
||||
self.data['BME']['temp'],
|
||||
self.data['BME']['hum'],
|
||||
self.data['BME']['press'],
|
||||
self.data['SYS']['vbat']
|
||||
))
|
||||
except OSError as e:
|
||||
print("Err {}: readonly".format(e))
|
||||
backup_data = False #to avoid trying again till next reset
|
||||
|
Loading…
Reference in New Issue
Block a user