Skip to content

Commit 1f4889e

Browse files
committed
control.py: Reformat
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent edff2da commit 1f4889e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

control.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
LED_MATRIX_PID = 0x20
2424
INPUTMODULE_PIDS = [LED_MATRIX_PID]
2525

26+
2627
class CommandVals(IntEnum):
2728
Brightness = 0x00
2829
Pattern = 0x01
@@ -125,7 +126,8 @@ class GameControlVal(IntEnum):
125126

126127
RGB_COLORS = ['white', 'black', 'red', 'green',
127128
'blue', 'cyan', 'yellow', 'purple']
128-
SCREEN_FPS = ['quarter', 'half', 'one', 'two', 'four', 'eight', 'sixteen', 'thirtytwo']
129+
SCREEN_FPS = ['quarter', 'half', 'one', 'two',
130+
'four', 'eight', 'sixteen', 'thirtytwo']
129131
HIGH_FPS_MASK = 0b00010000
130132
LOW_FPS_MASK = 0b00000111
131133

@@ -136,7 +138,8 @@ class GameControlVal(IntEnum):
136138

137139
def main():
138140
parser = argparse.ArgumentParser()
139-
parser.add_argument("-l", "--list", help="List all compatible devices", action="store_true")
141+
parser.add_argument(
142+
"-l", "--list", help="List all compatible devices", action="store_true")
140143
parser.add_argument("--bootloader", help="Jump to the bootloader to flash new firmware",
141144
action="store_true")
142145
parser.add_argument('--sleep', help='Simulate the host going to sleep or waking up',
@@ -194,7 +197,8 @@ def main():
194197
"--get-color", help="Get RGB color (C1 Minimal Input Module)", action="store_true")
195198
parser.add_argument("-v", "--version",
196199
help="Get device version", action="store_true")
197-
parser.add_argument("--serial-dev", help="Change the serial dev. Probably /dev/ttyACM0 on Linux, COM0 on Windows")
200+
parser.add_argument(
201+
"--serial-dev", help="Change the serial dev. Probably /dev/ttyACM0 on Linux, COM0 on Windows")
198202

199203
parser.add_argument(
200204
"--disp-str", help="Display a string on the LCD Display", type=str)
@@ -337,10 +341,12 @@ def main():
337341
parser.print_help(sys.stderr)
338342
sys.exit(1)
339343

344+
340345
def find_devs():
341-
ports = list_ports.comports() # Same result as python -m serial.tools.list_ports
346+
ports = list_ports.comports()
342347
return [port for port in ports if port.vid == 0x32AC and port.pid in INPUTMODULE_PIDS]
343348

349+
344350
def print_devs(ports):
345351
for port in ports:
346352
print(f"{port.device}")
@@ -349,6 +355,7 @@ def print_devs(ports):
349355
print(f" SN: {port.serial_number}")
350356
print(f" Product: {port.product}")
351357

358+
352359
def bootloader():
353360
"""Reboot into the bootloader to flash new firmware"""
354361
send_command(CommandVals.BootloaderReset, [0x00])
@@ -1192,6 +1199,7 @@ def set_power_mode_cmd(mode):
11921199
print("Unsupported power mode")
11931200
sys.exit(1)
11941201

1202+
11951203
def get_power_mode_cmd():
11961204
res = send_command(CommandVals.SetPowerMode, with_response=True)
11971205
current_mode = int(res[0])
@@ -1200,6 +1208,7 @@ def get_power_mode_cmd():
12001208
elif current_mode == 1:
12011209
print(f"Current Power Mode: High Power")
12021210

1211+
12031212
def get_fps_cmd():
12041213
res = send_command(CommandVals.SetFps, with_response=True)
12051214
current_fps = res[0]

0 commit comments

Comments
 (0)