Compare commits
2 commits
60d8702359
...
cdf8686a79
Author | SHA1 | Date | |
---|---|---|---|
|
cdf8686a79 | ||
|
9a7a9b96a1 |
1 changed files with 7 additions and 2 deletions
|
@ -83,7 +83,7 @@ class State:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def handle_key(self, key_num: int, state: bool) -> str | None:
|
async def handle_key(self, key_num: int, state: bool) -> str | None:
|
||||||
print(f"key:{key_num}, state:{state}")
|
log.debug(f"key:{key_num}, state:{state}")
|
||||||
if state is True:
|
if state is True:
|
||||||
msg = {
|
msg = {
|
||||||
"apiVersion": "1.0.0",
|
"apiVersion": "1.0.0",
|
||||||
|
@ -213,7 +213,7 @@ class TeamsCtrl:
|
||||||
if key_num > 4 or key_num < 0:
|
if key_num > 4 or key_num < 0:
|
||||||
raise IndexError("invalid key number: {key_num}")
|
raise IndexError("invalid key number: {key_num}")
|
||||||
cmd = f"{key_num:01}{color[0]:02x}{color[1]:02x}{color[2]:02x}\n"
|
cmd = f"{key_num:01}{color[0]:02x}{color[1]:02x}{color[2]:02x}\n"
|
||||||
print(cmd)
|
log.debug(f"set color:{cmd.strip()}")
|
||||||
self.serial_writer.write(cmd.encode("utf-8"))
|
self.serial_writer.write(cmd.encode("utf-8"))
|
||||||
|
|
||||||
async def process_serial(self) -> None:
|
async def process_serial(self) -> None:
|
||||||
|
@ -313,6 +313,11 @@ if __name__ == "__main__":
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
logging.basicConfig(level=args.log)
|
||||||
|
if args.log == "DEBUG":
|
||||||
|
logging.getLogger("asyncio").setLevel(logging.INFO)
|
||||||
|
logging.getLogger("websockets.client").setLevel(logging.INFO)
|
||||||
|
|
||||||
with open(args.token) as tf:
|
with open(args.token) as tf:
|
||||||
token = tf.read().strip()
|
token = tf.read().strip()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue