В процессе работы

This commit is contained in:
Maxim
2026-06-22 14:38:07 +03:00
parent eab9e17212
commit 877b29d5b4
4 changed files with 331 additions and 382 deletions

View File

@@ -1,8 +1,11 @@
"""
# Создание сокета mkfifo /tmp/gpio_pipe
# Необходим файл с данными, например array.txt. Формат записи данных [0xE0, 0x01, 0x4C, 0x88]
# Запуск python3 emulator.py array.txt /tmp/gpio_pipe
Эмулятор чтения из файла и отправки в pipe.
Создание сокета: mkfifo /tmp/gpio_pipe
Формат файла: [0xE0, 0x01, 0x4C, 0x88]
Запуск: python3 emulator.py array.txt /tmp/gpio_pipe
"""
import sys
import time
import ast
@@ -49,6 +52,7 @@ def status_clear():
# ================= DATA =================
def load_array(path):
"""Загружает данные из файла."""
while True:
try:
with open(path, "r") as f:
@@ -73,6 +77,7 @@ def load_array(path):
# ================= PIPE =================
def open_pipe(path):
"""Открывает pipe для записи."""
while not stop_flag:
try:
fd = os.open(path, os.O_WRONLY | os.O_NONBLOCK)