First speed reader test #3

This commit is contained in:
Jan Beníček 2025-01-14 20:26:50 +01:00
parent 8cd11992c4
commit 7e7d90ce68
4 changed files with 16 additions and 3 deletions

14
pdm.lock generated
View file

@ -5,7 +5,7 @@
groups = ["default"] groups = ["default"]
strategy = ["inherit_metadata"] strategy = ["inherit_metadata"]
lock_version = "4.5.0" lock_version = "4.5.0"
content_hash = "sha256:b23452099622a07a2d978cf257f8002c508fd6da50f49ef7dbcabd4ec0903596" content_hash = "sha256:ac1fc7d0bc04eb71b092c8da35428b6618d9b507c5d2e851ac831b7e0645098f"
[[metadata.targets]] [[metadata.targets]]
requires_python = ">=3.12" requires_python = ">=3.12"
@ -153,6 +153,18 @@ files = [
{file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"},
] ]
[[package]]
name = "lgpio"
version = "0.2.2.0"
summary = "Linux SBC GPIO module"
groups = ["default"]
files = [
{file = "lgpio-0.2.2.0-cp312-cp312-linux_armv7l.whl", hash = "sha256:6c65ac42e878764d04a71ed12fe6d46089b36e9e8127722bf29bb2e4bc91de22"},
{file = "lgpio-0.2.2.0-cp312-cp312-manylinux_2_34_aarch64.whl", hash = "sha256:d907db79292c721c605af08187385ddb3b7af09907e1ffca56cf0cd6558ace0a"},
{file = "lgpio-0.2.2.0-cp312-cp312-manylinux_2_34_x86_64.whl", hash = "sha256:2aadff092f642fcdada8457c158f87259dfda3a89ec19bae0b99ff22b34aac4b"},
{file = "lgpio-0.2.2.0.tar.gz", hash = "sha256:11372e653b200f76a0b3ef8a23a0735c85ec678a9f8550b9893151ed0f863fff"},
]
[[package]] [[package]]
name = "pydantic" name = "pydantic"
version = "2.10.0" version = "2.10.0"

View file

@ -14,6 +14,7 @@ dependencies = [
"SMmegaind>=1.0.3", "SMmegaind>=1.0.3",
"apscheduler>=3.11.0", "apscheduler>=3.11.0",
"gpiozero>=2.0.1", "gpiozero>=2.0.1",
"lgpio>=0.2.2.0",
] ]
requires-python = ">=3.12" requires-python = ">=3.12"
readme = "README.md" readme = "README.md"

View file

@ -15,7 +15,7 @@ def event():
if difference != 0: if difference != 0:
return return
print(difference) set_variable("pokus", difference)

View file

@ -17,7 +17,7 @@ def __create_file_path(variable: str):
default_path: str = os.getenv("VARIABLES_SAVE_DIR", "variables_storage") default_path: str = os.getenv("VARIABLES_SAVE_DIR", "variables_storage")
if not os.path.exists(default_path): if not os.path.exists(default_path):
os.makedirs(default_path) os.makedirs(default_path)
return f"{default_path}/{re.sub(r'[^\w\-_.]', '_', variable)}" return "{}/{}".format(default_path, re.sub(r"[^\w\-_.]", "_", variable))
def set_variable(variable: str, data, default: bool): def set_variable(variable: str, data, default: bool):