Add Vbat to written data on flash

This commit is contained in:
Pierrick C 2018-08-17 23:19:30 +02:00
parent 6141e4a9b2
commit b7187d6d54
1 changed files with 4 additions and 3 deletions

View File

@ -199,10 +199,11 @@ 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'],
csv_file.write("{};{};{};{};{}\n".format(self.data['SYS']['time'],
self.data['BME']['temp'],
self.data['BME']['hum'],
self.data['BME']['press']))
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
@ -356,7 +357,7 @@ while True:
last_written_data = current
print("Backup data...")
data.write_on_flash()
gc.collect()
# micropython.mem_info(1)
# print('Memory free: {} allocated: {}'.format(gc.mem_free(), gc.mem_alloc()))