Skip to content

Commit

Permalink
Merge pull request #6 from Bloeckchengrafik/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Bloeckchengrafik authored Jan 7, 2024
2 parents a46c0d9 + 894c616 commit 1519442
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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

nav:
- Introduction: 'index.md'
- 'quickstart.md'
- Reference: '/reference'
- Reference: '/ftswarm.py/reference/swarm.html'
- 'Issue Tracker': 'https://github.com/Bloeckchengrafik/ftswarm.py'
21 changes: 10 additions & 11 deletions swarm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import logging
from swarm.swarm import *

from .serialhandler import SerialHandler
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion swarm/swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1519442

Please sign in to comment.