Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevaev committed Mar 15, 2024
1 parent b9c4712 commit 88fae53
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions kvmd/plugins/ugpio/extron.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# #
# ========================================================================== #


import re
import multiprocessing
import functools
Expand Down Expand Up @@ -77,10 +78,10 @@ def __init__(
@classmethod
def get_plugin_options(cls) -> dict:
return {
"device": Option("", type=valid_abs_path, unpack_as="device_path"),
"device": Option("", type=valid_abs_path, unpack_as="device_path"),
"speed": Option(9600, type=valid_tty_speed),
"read_timeout": Option(2.0, type=valid_float_f01),
"protocol": Option(1, type=functools.partial(valid_number, min=1, max=2)),
"read_timeout": Option(2.0, type=valid_float_f01),
"protocol": Option(1, type=functools.partial(valid_number, min=1, max=2)),
}

@classmethod
Expand Down Expand Up @@ -177,10 +178,8 @@ def __recv_channel(self, tty: serial.Serial, data: bytes) -> tuple[(int | None),

def __send_channel(self, tty: serial.Serial, channel: int) -> None:
assert 0 <= channel <= 3
cmd = b"%d!\n" % (
channel + 1,
)
tty.write(cmd) # Twice because of ezcoo bugs
cmd = b"%d!\n" % (channel + 1)
tty.write(cmd)
tty.flush()

def __str__(self) -> str:
Expand Down

0 comments on commit 88fae53

Please sign in to comment.