|
44 | 44 | set_time = False |
45 | 45 | if set_time: # change to True if you want to write the time! |
46 | 46 | # year, mon, date, hour, min, sec, wday, yday, isdst |
47 | | - t = time.struct_time((2020, 4, 21, 16, 36, 0, 2, -1, -1)) |
| 47 | + t = time.struct_time((2020, 4, 21, 18, 13, 0, 2, -1, -1)) |
48 | 48 | # you must set year, mon, date, hour, min, sec and weekday |
49 | 49 | # yearday not supported, isdst can be set but we don't use it at this time |
50 | 50 | print("Setting time to:", t) # uncomment for debugging |
|
55 | 55 | ble = adafruit_ble.BLERadio() # pylint: disable=no-member |
56 | 56 |
|
57 | 57 | pulse_ox_connection = None |
58 | | -initial_time = time.monotonic() |
59 | 58 |
|
60 | 59 | while True: |
61 | 60 | t = rtc.datetime |
|
113 | 112 |
|
114 | 113 | try: # logging to SD card |
115 | 114 | with open("/sd_card/log.txt", "a") as sdc: |
116 | | - current_time = time.monotonic() |
117 | | - time_stamp = current_time - initial_time |
118 | | - print( |
119 | | - "Seconds since current data log started:", |
120 | | - int(time_stamp), |
121 | | - ) |
| 115 | + t = rtc.datetime |
122 | 116 | sdc.write( |
123 | 117 | "{} {}/{}/{} {}:{}:{} ".format( |
124 | 118 | days[t.tm_wday], |
|
127 | 121 | t.tm_year, |
128 | 122 | t.tm_hour, |
129 | 123 | t.tm_min, |
130 | | - t.tm_sec, |
| 124 | + t.tm_sec |
131 | 125 | ) |
132 | 126 | ) |
133 | 127 | sdc.write( |
134 | | - "{}, {}, {}, {:.2f}\n".format( |
135 | | - int(time_stamp), spo2, pulse_rate, pleth |
| 128 | + "{}, {}, {:.2f}\n".format( |
| 129 | + spo2, pulse_rate, pleth |
136 | 130 | ) |
137 | 131 | ) |
138 | 132 |
|
|
0 commit comments