Merge pull request #2682 from dhalbert/readonly-keyword-arg
add readonly= keyword to storage.remount where not already present
This commit is contained in:
commit
cb55f61505
7 changed files with 8 additions and 8 deletions
|
|
@ -21,5 +21,5 @@ IO = digitalio.DigitalInOut(PIN)
|
|||
IO.direction = digitalio.Direction.INPUT
|
||||
IO.pull = digitalio.Pull.UP
|
||||
|
||||
if IO.value: # No connection
|
||||
storage.remount('/', False) # Remount storage as read/write for painter
|
||||
if IO.value: # No connection
|
||||
storage.remount('/', readonly=False) # Remount storage as read/write for painter
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@ switch.direction = digitalio.Direction.INPUT
|
|||
switch.pull = digitalio.Pull.UP
|
||||
|
||||
# If the switch pin is connected to ground CircuitPython can write to the drive
|
||||
storage.remount("/", switch.value)
|
||||
storage.remount("/", readonly=switch.value)
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@ switch.direction = digitalio.Direction.INPUT
|
|||
switch.pull = digitalio.Pull.UP
|
||||
|
||||
# If the switch pin is connected to ground CircuitPython can write to the drive
|
||||
storage.remount("/", switch.value)
|
||||
storage.remount("/", readonly=switch.value)
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ switch.direction = digitalio.Direction.INPUT
|
|||
switch.pull = digitalio.Pull.UP
|
||||
|
||||
# If the switch pin is connected to ground CircuitPython can write to the drive
|
||||
storage.remount("/", switch.value)
|
||||
storage.remount("/", readonly=switch.value)
|
||||
|
|
|
|||
|
|
@ -28,4 +28,4 @@ if readonly:
|
|||
print("OS has write access to CircuitPython drive")
|
||||
else:
|
||||
print("CircuitPython has write access to drive")
|
||||
storage.remount("/", readonly)
|
||||
storage.remount("/", readonly=readonly)
|
||||
|
|
|
|||
|
|
@ -12,4 +12,4 @@ switch.pull = digitalio.Pull.UP
|
|||
|
||||
# If the D0 is connected to ground with a wire
|
||||
# CircuitPython can write to the drive
|
||||
storage.remount("/", switch.value)
|
||||
storage.remount("/", readonly=switch.value)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ def get_current_toml_file(enumerated_files):
|
|||
# Erase settings.toml then write the contents of the new settings.toml file
|
||||
def change_toml_file(toml_file):
|
||||
try:
|
||||
storage.remount("/", False)
|
||||
storage.remount("/", readonly=False)
|
||||
with open("settings.toml", "w") as settings:
|
||||
settings.write("")
|
||||
with open("settings.toml", "w") as settings, open(toml_file) as f:
|
||||
|
|
|
|||
Loading…
Reference in a new issue