Small Changes
This commit is contained in:
5
Makefile
Normal file
5
Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
.PHONY: publish
|
||||
publish:
|
||||
poetry publish --build --repository gitea
|
||||
clean:
|
||||
find . -type f -name "*.py[co]" -delete -or -type d -name "__pycache__" -delete -or -type -name "dist" -delete
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "ProjectorPi"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
description = ""
|
||||
authors = ["Marijn Doeve <marijn@doeve.me>"]
|
||||
license = "GPL-3.0-or-later"
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
# w == escape
|
||||
# | == carriage return
|
||||
from types import LambdaType
|
||||
import sys
|
||||
from typing import Callable
|
||||
from .serialdevice import SerialDevice
|
||||
|
||||
@@ -42,12 +40,14 @@ class ExtronSerial(SerialDevice):
|
||||
response = super().send_command(command)
|
||||
|
||||
if response and response[0] == "E":
|
||||
print(response, self.ERRORS.get(response, "Unknown"))
|
||||
print(
|
||||
f"{response}: {self.ERRORS.get(response, 'Unknown')}", file=sys.stderr
|
||||
)
|
||||
|
||||
return response
|
||||
|
||||
def check_sleep(self) -> None:
|
||||
res = self.send_command(C("PSAV"))
|
||||
def check_sleep(self) -> str:
|
||||
return self.send_command(C("PSAV"))
|
||||
|
||||
def sleep(self) -> None:
|
||||
self.send_command(C("1PSAV"))
|
||||
@@ -59,7 +59,7 @@ class ExtronSerial(SerialDevice):
|
||||
self.send_command(f"{input}!")
|
||||
|
||||
def is_sleeping(self) -> bool:
|
||||
response = self.send_command(C("PSAV"))
|
||||
response = self.check_sleep
|
||||
|
||||
return bool(int(response))
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class ProjectorSerial(SerialDevice):
|
||||
def send_command(self, command: str, device_id: str = "ZZ") -> str:
|
||||
assert device_id in ["01", "02", "03", "04", "05", "06", "ZZ"]
|
||||
|
||||
full_command = f"\x02AD{device_id};{command}\x03"
|
||||
full_command = f"{STX}AD{device_id};{command}{ETX}"
|
||||
|
||||
return super().send_command(full_command)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user