Skip to content

Commit

Permalink
_drive file added
Browse files Browse the repository at this point in the history
_drive contains a variable passed from Blender and the user's PC, it will update when the user presses 'Autodetect' in the Blender addon, and the code will now autofill the location of the pico's drive storage, meaning the user will no longer have to manually specify the location of the 'Scripts' file
  • Loading branch information
SpectralVectors authored Jan 21, 2023
1 parent 0bd8b99 commit caa3457
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions Pico/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

# Check for input in an infinite loop
while True:

# Button 0 - Page Change
if button0.value:
page += 1
Expand Down
18 changes: 9 additions & 9 deletions Pico/lib/BoardSetup/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.mouse import Mouse
from ._drive import drive

# Importing the shortened keycodes
from BoardSetup._shortcodes import *
Expand All @@ -14,19 +15,18 @@
text = KeyboardLayoutUS(kb)
mouse = Mouse(usb_hid.devices)

# The location of the Pico storage and Scripts folder
drive = 'G:'
# The location of the Scripts folder
path = '/lib/Scripts/'

# Helper function to make running scripts only a single line
def run_script(script):
kb.send(shift,ctrl,alt,insert)
wait(0.1)
print(f"exec(open('{drive}{path}{script}').read())")

# Helper function to allow running commands in the background
def command(command):
kb.send(shift,ctrl,alt,insert)
wait(0.1)
print(f"import bpy;{command}")
kb.send(left,right)
kb.send(left,right)

# Helper function to make running scripts only a single line
def run_script(script):
kb.send(shift,ctrl,alt,insert)
wait(0.1)
print(f"exec(open('{drive}{path}{script}').read())")
1 change: 1 addition & 0 deletions Pico/lib/BoardSetup/_drive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
drive = 'G:'

0 comments on commit caa3457

Please sign in to comment.