def mount_sd(): try: sd = machine.SD() os.mount(sd, SD_MOUNTPOINT) return True except OSError: return False
def mount_sd(): try: sd = machine.SD() try: # check if sd is already mounted os.stat('/sd') return True except: # not mounted: continue # todo except specific exception pass os.mount(sd, '/sd') return True except OSError: return False
def __init__(self, gps_poller, stdout_echo=False): self.gps_poller = gps_poller self.have_SD = False self.log_fh = None self.log_fn = None self.log_tag = None self.stdout_echo = stdout_echo self.py = pytrack.Pytrack() try: os.listdir("/sd") self.have_SD = True print(">> SD Card already mounted") except: try: sd = machine.SD() os.mount(sd, "/sd") # pylint: disable=E1101 self.have_SD = True print(">> Mounted SD card") except: pass if not self.have_SD: print(">> No SD Card")
# boot.py -- run on boot-up ########## #Jake Burton #40278490 #Final Honours Project ######### # - todo Fix RTC initialization to sync with the connectSink ######### import os, machine, time from network import WLAN sd = machine.SD() rtc = machine.RTC() rtc.init((2020, 3, 14, 20, 50, 0, 0, 0)) os.mount(sd, '/nodesd') print("BOOTING")