Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Pressure_State(Time_State):
- """This state records a pressure log """
- def __init__(self):
- super().__init__()
- @property
- def name(self):
- return 'pressurel'
- def tick(self, now):
- # Once the job is done, go back to the main screen
- change_to_state('time')
- def enter(self):
- global low_light, LOG_MODE
- low_light = False
- plog_path = "/sd/"
- pyportal.set_backlight(1.00)
- pyportal.set_background(mugsy_background)
- try:
- board.DISPLAY.refresh(target_frames_per_second=60)
- except AttributeError:
- board.DISPLAY.refresh_soon()
- board.DISPLAY.wait_for_frame()
- gps.update()
- t_stamp = time.mktime(gps.timestamp_utc)
- PLOG_FILE = f"{t_stamp}pressure.txt"
- start = (time.monotonic_ns() / 1e9)
- with open((plog_path+PLOG_FILE), LOG_MODE) as pressfile:
- print(t_stamp, gps.latitude, gps.longitude, gps.altitude_m, file=pressfile)
- curr_time = 0
- # with open((plog_path+PLOG_FILE), LOG_MODE) as pressfile:
- while curr_time < 60:
- curr_time = ((time.monotonic_ns() / 1e9) - start)
- print(curr_time, lps.pressure, file=pressfile)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement