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, pressfile, PLOG_FILE, LOG_MODE, current_time
- low_light = False
- stamped = 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"
- loop = 1200
- timep = time.monotonic_ns()
- while loop > 0:
- with open((plog_path+PLOG_FILE), LOG_MODE) as pressfile:
- if stamped is False:
- debugp(t_stamp, gps.latitude, gps.longitude, gps.altitude_m)
- stamped = True
- debugp(((time.monotonic_ns() - timep) / 1000000000), lps.pressure)
- loop -= 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement