diff --git a/circuitpython/code/main.py b/circuitpython/code/main.py index 18d0822..81b1eac 100644 --- a/circuitpython/code/main.py +++ b/circuitpython/code/main.py @@ -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()))