Bugfixs
parent
4dd870f755
commit
c32640deab
|
@ -1 +0,0 @@
|
||||||
/home/jbenicek/Programovani/SequentMicrosystems_API/.venv/bin/python
|
|
18
pdm.lock
18
pdm.lock
|
@ -4,11 +4,8 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
groups = ["default"]
|
groups = ["default"]
|
||||||
strategy = ["cross_platform", "inherit_metadata"]
|
strategy = ["cross_platform", "inherit_metadata"]
|
||||||
lock_version = "4.5.0"
|
lock_version = "4.4.1"
|
||||||
content_hash = "sha256:b833a7bb8997b54c2b61879638963fef2bf4d8265bc9f0cd0d381cb8af3dd6b1"
|
content_hash = "sha256:3e08a1de12505708e4539230fe7dc372f7fe295cf966f3097b3e2a12fac77e49"
|
||||||
|
|
||||||
[[metadata.targets]]
|
|
||||||
requires_python = ">=3.12"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "annotated-types"
|
name = "annotated-types"
|
||||||
|
@ -16,9 +13,6 @@ version = "0.7.0"
|
||||||
requires_python = ">=3.8"
|
requires_python = ">=3.8"
|
||||||
summary = "Reusable constraint types to use with typing.Annotated"
|
summary = "Reusable constraint types to use with typing.Annotated"
|
||||||
groups = ["default"]
|
groups = ["default"]
|
||||||
dependencies = [
|
|
||||||
"typing-extensions>=4.0.0; python_version < \"3.9\"",
|
|
||||||
]
|
|
||||||
files = [
|
files = [
|
||||||
{file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"},
|
{file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"},
|
||||||
{file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"},
|
{file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"},
|
||||||
|
@ -31,10 +25,8 @@ requires_python = ">=3.9"
|
||||||
summary = "High level compatibility layer for multiple asynchronous event loop implementations"
|
summary = "High level compatibility layer for multiple asynchronous event loop implementations"
|
||||||
groups = ["default"]
|
groups = ["default"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"exceptiongroup>=1.0.2; python_version < \"3.11\"",
|
|
||||||
"idna>=2.8",
|
"idna>=2.8",
|
||||||
"sniffio>=1.1",
|
"sniffio>=1.1",
|
||||||
"typing-extensions>=4.1; python_version < \"3.11\"",
|
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "anyio-4.6.2.post1-py3-none-any.whl", hash = "sha256:6d170c36fba3bdd840c73d3868c1e777e33676a69c3a72cf0a0d5d6d8009b61d"},
|
{file = "anyio-4.6.2.post1-py3-none-any.whl", hash = "sha256:6d170c36fba3bdd840c73d3868c1e777e33676a69c3a72cf0a0d5d6d8009b61d"},
|
||||||
|
@ -49,7 +41,6 @@ summary = "Composable command line interface toolkit"
|
||||||
groups = ["default"]
|
groups = ["default"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"colorama; platform_system == \"Windows\"",
|
"colorama; platform_system == \"Windows\"",
|
||||||
"importlib-metadata; python_version < \"3.8\"",
|
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"},
|
{file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"},
|
||||||
|
@ -90,9 +81,6 @@ version = "0.14.0"
|
||||||
requires_python = ">=3.7"
|
requires_python = ">=3.7"
|
||||||
summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
|
summary = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
|
||||||
groups = ["default"]
|
groups = ["default"]
|
||||||
dependencies = [
|
|
||||||
"typing-extensions; python_version < \"3.8\"",
|
|
||||||
]
|
|
||||||
files = [
|
files = [
|
||||||
{file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"},
|
{file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"},
|
||||||
{file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"},
|
{file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"},
|
||||||
|
@ -263,7 +251,6 @@ summary = "The little ASGI library that shines."
|
||||||
groups = ["default"]
|
groups = ["default"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyio<5,>=3.4.0",
|
"anyio<5,>=3.4.0",
|
||||||
"typing-extensions>=3.10.0; python_version < \"3.10\"",
|
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "starlette-0.41.3-py3-none-any.whl", hash = "sha256:44cedb2b7c77a9de33a8b74b2b90e9f50d11fcf25d8270ea525ad71a25374ff7"},
|
{file = "starlette-0.41.3-py3-none-any.whl", hash = "sha256:44cedb2b7c77a9de33a8b74b2b90e9f50d11fcf25d8270ea525ad71a25374ff7"},
|
||||||
|
@ -290,7 +277,6 @@ groups = ["default"]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"click>=7.0",
|
"click>=7.0",
|
||||||
"h11>=0.8",
|
"h11>=0.8",
|
||||||
"typing-extensions>=4.0; python_version < \"3.11\"",
|
|
||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
{file = "uvicorn-0.32.1-py3-none-any.whl", hash = "sha256:82ad92fd58da0d12af7482ecdb5f2470a04c9c9a53ced65b9bbb4a205377602e"},
|
{file = "uvicorn-0.32.1-py3-none-any.whl", hash = "sha256:82ad92fd58da0d12af7482ecdb5f2470a04c9c9a53ced65b9bbb4a205377602e"},
|
||||||
|
|
|
@ -53,13 +53,15 @@ def set_0_10_out_stack(stack: int, value: float):
|
||||||
"""
|
"""
|
||||||
Set output voltage of 0-10V output on specified card
|
Set output voltage of 0-10V output on specified card
|
||||||
"""
|
"""
|
||||||
(set_0_10_out(stack=stack, channel=channel, value=value) for channel in range(1, 5))
|
for channel in range(1, 5):
|
||||||
|
set_0_10_out(stack=stack, channel=channel, value=value)
|
||||||
|
|
||||||
def set_0_10_out_all(value: float):
|
def set_0_10_out_all(value: float):
|
||||||
"""
|
"""
|
||||||
Set output voltage of 0-10V output on all card
|
Set output voltage of 0-10V output on all card
|
||||||
"""
|
"""
|
||||||
(set_0_10_out_stack(stack=stack, value=value) for stack in stacks)
|
for stack in stacks:
|
||||||
|
set_0_10_out_stack(stack=stack, value=value)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,11 +158,13 @@ def set_4_20_out_stack(stack: int, value: float):
|
||||||
"""
|
"""
|
||||||
Set output value to all 4-20mA on specified card
|
Set output value to all 4-20mA on specified card
|
||||||
"""
|
"""
|
||||||
(set_4_20_out(stack=stack, channel=channel, value=value) for channel in range(1, 5))
|
for channel in range(1, 5):
|
||||||
|
set_4_20_out(stack=stack, channel=channel, value=value)
|
||||||
|
|
||||||
def set_4_20_out_all(value: float):
|
def set_4_20_out_all(value: float):
|
||||||
"""
|
"""
|
||||||
Set output value to all for 4-20mA outputs
|
Set output value to all for 4-20mA outputs
|
||||||
"""
|
"""
|
||||||
(set_4_20_out_stack(stack=stack, value=value) for stack in stacks)
|
for stack in stacks:
|
||||||
|
set_4_20_out_stack(stack=stack, value=value)
|
||||||
|
|
||||||
|
|
|
@ -9,28 +9,28 @@ router = APIRouter(prefix="/RTD8", tags=["Modules --> RTD8 card"])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("/all", summary="Read all RTD8 cards values in Celsius", response_model=Dict[int, Dict[int, float]])
|
@router.get("/temp/all", summary="Read all RTD8 cards values in Celsius", response_model=Dict[int, Dict[int, float]])
|
||||||
def get_all_celsius():
|
def get_all_celsius():
|
||||||
return service.read_temp_all()
|
return service.read_temp_all()
|
||||||
|
|
||||||
@router.get("/{stack}", summary="Read specified RTD8 card values in Celsius", response_model=Dict[int, float])
|
@router.get("/temp/{stack}", summary="Read specified RTD8 card values in Celsius", response_model=Dict[int, float])
|
||||||
def get_stack_celsius(stack: int):
|
def get_stack_celsius(stack: int):
|
||||||
return service.read_temp_stack(stack)
|
return service.read_temp_stack(stack)
|
||||||
|
|
||||||
@router.get("/{stack}/{channel}", summary="Read specified RTD8 card value of specified channel in Celsius", response_model=float)
|
@router.get("/temp/{stack}/{channel}", summary="Read specified RTD8 card value of specified channel in Celsius", response_model=float)
|
||||||
def get_channel_celsius(stack: int, channel: int):
|
def get_channel_celsius(stack: int, channel: int):
|
||||||
return FloatValueModel(service=service.read_temp(stack, channel))
|
return FloatValueModel(service=service.read_temp(stack, channel))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("/all/resistance", summary="Read all RTD8 cards values in Ohm", response_model=Dict[int, Dict[int, float]])
|
@router.get("/res/all", summary="Read all RTD8 cards values in Ohm", response_model=Dict[int, Dict[int, float]])
|
||||||
def get_all_celsius():
|
def get_all_celsius():
|
||||||
return service.read_resistance_all()
|
return service.read_resistance_all()
|
||||||
|
|
||||||
@router.get("/{stack}/resistance", summary="Read specified RTD8 card values in Ohm", response_model=Dict[int, float])
|
@router.get("/res/{stack}", summary="Read specified RTD8 card values in Ohm", response_model=Dict[int, float])
|
||||||
def get_stack_celsius(stack: int):
|
def get_stack_celsius(stack: int):
|
||||||
return service.read_resistance_stack(stack)
|
return service.read_resistance_stack(stack)
|
||||||
|
|
||||||
@router.get("/{stack}/{channel}/resistance", summary="Read specified RTD8 card value of specified channel in Ohm", response_model=FloatValueModel)
|
@router.get("/res/{stack}/{channel}", summary="Read specified RTD8 card value of specified channel in Ohm", response_model=FloatValueModel)
|
||||||
def get_channel_celsius(stack: int, channel: int):
|
def get_channel_celsius(stack: int, channel: int):
|
||||||
return FloatValueModel(value=service.read_resistance(stack, channel))
|
return FloatValueModel(value=service.read_resistance(stack, channel))
|
|
@ -32,7 +32,7 @@ def read_temp_all() -> dict:
|
||||||
"""
|
"""
|
||||||
Read all RTD8 cards inputs in Celsius
|
Read all RTD8 cards inputs in Celsius
|
||||||
"""
|
"""
|
||||||
return {stack: read_resistance_stack(stack=stack) for stack in stacks}
|
return {stack: read_temp_stack(stack=stack) for stack in stacks}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,17 +9,20 @@ router = APIRouter(prefix="/rel4hvi4", tags=["Modules --> Rel4HVI4"])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/relay/all", description="Set all relays to required state (1/0)")
|
@router.post("/relay/all", description="Set all relays to required state (1/0)", response_model=Dict[int, Dict[int, bool]])
|
||||||
def post_relay_all(state: BoolValueModel):
|
def post_relay_all(state: BoolValueModel):
|
||||||
service.set_relay_all(value=state.value)
|
service.set_relay_all(value=state.value)
|
||||||
|
return service.read_relay_all()
|
||||||
|
|
||||||
@router.post("/relay/{stack}", description="Set all relays on specified card to required state (1/0)")
|
@router.post("/relay/{stack}", description="Set all relays on specified card to required state (1/0)", response_model=Dict[int, float])
|
||||||
def post_relay_stack(stack: int, state: BoolValueModel):
|
def post_relay_stack(stack: int, state: BoolValueModel):
|
||||||
service.set_relay_stack(stack=stack, value=state.value)
|
service.set_relay_stack(stack=stack, value=state.value)
|
||||||
|
return service.read_opto_stack(stack=stack)
|
||||||
|
|
||||||
@router.post("/relay/{stack}/{channel}", description="Set all relays on specified card to required state (1/0)")
|
@router.post("/relay/{stack}/{channel}", description="Set all relays on specified card to required state (1/0)", response_model=BoolValueModel)
|
||||||
def post_relay_stack(stack: int, channel, state: BoolValueModel):
|
def post_relay_stack(stack: int, channel: int, state: BoolValueModel):
|
||||||
service.set_relay(stack=stack, relay=channel, value=state.value)
|
service.set_relay(stack=stack, relay=channel, value=state.value)
|
||||||
|
return BoolValueModel(value=service.read_relay(stack=stack, relay=channel))
|
||||||
|
|
||||||
|
|
||||||
@router.get("/relay/all", description="Get state of all relays", response_model=Dict[int, Dict[int, bool]])
|
@router.get("/relay/all", description="Get state of all relays", response_model=Dict[int, Dict[int, bool]])
|
||||||
|
|
|
@ -21,13 +21,15 @@ def set_relay_stack(stack: int, value: bool):
|
||||||
"""
|
"""
|
||||||
Set all relays to requested state on specified stack/card
|
Set all relays to requested state on specified stack/card
|
||||||
"""
|
"""
|
||||||
(set_relay(stack=stack, relay=ch, value=value) for ch in range(1, 5))
|
for ch in range(1, 5):
|
||||||
|
set_relay(stack=stack, relay=ch, value=value)
|
||||||
|
|
||||||
def set_relay_all(value: bool):
|
def set_relay_all(value: bool):
|
||||||
"""
|
"""
|
||||||
Set all relays to requested state
|
Set all relays to requested state
|
||||||
"""
|
"""
|
||||||
(set_relay_stack(stack=stack, value=value) for stack in stacks)
|
for stack in stacks:
|
||||||
|
set_relay_stack(stack=stack, value=value)
|
||||||
|
|
||||||
|
|
||||||
def read_relay(stack: int, relay: int):
|
def read_relay(stack: int, relay: int):
|
||||||
|
|
Loading…
Reference in New Issue