feat: added classes for work motors, added class FormResponse, added logic for motor control in service; docs: updated .env.example for commands motors

This commit is contained in:
Arduinum628
2025-09-16 09:57:02 +03:00
parent 576d3c145f
commit 72af2bc2f9
5 changed files with 225 additions and 39 deletions

View File

@@ -18,6 +18,26 @@ class CommandsRobot(ModelConfig):
backward: str
left: str
right: str
stop: str
def is_command(self, command: str) -> bool:
"""Есть ли команда в командах"""
return command in self.model_dump().values()
class GpioLines(ModelConfig):
"""Класс для линий GPIO"""
gpio_path: str
led_line: int
led_consumer: str
left_motor_line_in1: int
left_motor_line_in2: int
left_motor_consumer: str
right_motor_line_in1: int
right_motor_line_in2: int
right_motor_consumer: str
class Settings(ModelConfig):
@@ -26,6 +46,7 @@ class Settings(ModelConfig):
websocket_host: str
websocket_port: int
commands_robot: CommandsRobot = CommandsRobot()
gpio_lines: GpioLines = GpioLines()
settings = Settings()