diff --git a/mkdocs.yml b/mkdocs.yml index e3f7c2e..3de1379 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,6 +1,6 @@ site_name: ftSwarm.py - Help and Reference copyright: "© Christian Bergschneider & Stefan Fuss" -site_url: https://ftswarm-py.bloeckchengrafik.de +site_url: https://bloeckchengrafik.de/ftswarm.py theme: name: material @@ -8,5 +8,5 @@ theme: nav: - Introduction: 'index.md' - 'quickstart.md' - - Reference: '/reference' + - Reference: '/ftswarm.py/reference/swarm.html' - 'Issue Tracker': 'https://github.com/Bloeckchengrafik/ftswarm.py' \ No newline at end of file diff --git a/swarm/__init__.py b/swarm/__init__.py index ec2295e..3d08ca4 100644 --- a/swarm/__init__.py +++ b/swarm/__init__.py @@ -1,5 +1,4 @@ import asyncio -import logging from swarm.swarm import * from .serialhandler import SerialHandler @@ -98,20 +97,20 @@ async def get_thermometer(self, port_name: str) -> FtSwarmThermometer: async def get_ldr(self, port_name: str) -> FtSwarmLDR: return await self._get_object(port_name, FtSwarmLDR) - async def get_motor(self, port_name: str) -> FtSwarmMotor: - return await self._get_object(port_name, FtSwarmMotor) + async def get_motor(self, port_name: str, high_precision: bool = False) -> FtSwarmMotor: + return await self._get_object(port_name, FtSwarmMotor, high_precision) - async def get_tractor_motor(self, port_name: str) -> FtSwarmTractorMotor: - return await self._get_object(port_name, FtSwarmTractorMotor) + async def get_tractor_motor(self, port_name: str, high_precision: bool = False) -> FtSwarmTractorMotor: + return await self._get_object(port_name, FtSwarmTractorMotor, high_precision) - async def get_xm_motor(self, port_name: str) -> FtSwarmXMMotor: - return await self._get_object(port_name, FtSwarmXMMotor) + async def get_xm_motor(self, port_name: str, high_precision: bool = False) -> FtSwarmXMMotor: + return await self._get_object(port_name, FtSwarmXMMotor, high_precision) - async def get_encoder_motor(self, port_name: str) -> FtSwarmEncoderMotor: - return await self._get_object(port_name, FtSwarmEncoderMotor) + async def get_encoder_motor(self, port_name: str, high_precision: bool = False) -> FtSwarmEncoderMotor: + return await self._get_object(port_name, FtSwarmEncoderMotor, high_precision) - async def get_lamp(self, port_name: str) -> FtSwarmLamp: - return await self._get_object(port_name, FtSwarmLamp) + async def get_lamp(self, port_name: str, high_precision: bool = False) -> FtSwarmLamp: + return await self._get_object(port_name, FtSwarmLamp, high_precision) async def get_valve(self, port_name: str) -> FtSwarmValve: return await self._get_object(port_name, FtSwarmValve) diff --git a/swarm/swarm.py b/swarm/swarm.py index aeef380..ac1115c 100644 --- a/swarm/swarm.py +++ b/swarm/swarm.py @@ -290,8 +290,12 @@ class FtSwarmActor(FtSwarmIO): Don't use this class directly, use one of the derived classes instead """ + def __init__(self, swarm: FtSwarmBase, port_name: str, high_precision: bool = False) -> None: + super().__init__(swarm, port_name) + self._high_precision = high_precision + async def post_init(self) -> None: - await self._swarm.send(self._port_name, "setActorType", await self.get_actor_type()) + await self._swarm.send(self._port_name, "setActorType", await self.get_actor_type(), self._high_precision) async def get_actor_type(self) -> Actor: return Actor.UNDEFINDED