Skip to content

Commit

Permalink
Merge pull request #983 from quartiq/py
Browse files Browse the repository at this point in the history
Py
  • Loading branch information
jordens authored Dec 13, 2024
2 parents 62948e7 + 7e2c595 commit 23149d1
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 161 deletions.
4 changes: 2 additions & 2 deletions encoded_pin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ impl<'a, P, const N: usize> EncodedPin<'a, P, N> {
}
}

impl<'a, P: ErrorType, const N: usize> ErrorType for EncodedPin<'a, P, N> {
impl<P: ErrorType, const N: usize> ErrorType for EncodedPin<'_, P, N> {
type Error = P::Error;
}

impl<'a, P: OutputPin, const N: usize> OutputPin for EncodedPin<'a, P, N> {
impl<P: OutputPin, const N: usize> OutputPin for EncodedPin<'_, P, N> {
fn set_low(&mut self) -> Result<(), Self::Error> {
// assert
for (i, cs) in self.cs.borrow_mut().iter_mut().enumerate() {
Expand Down
9 changes: 2 additions & 7 deletions hitl/loopback.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import json
import os

from miniconf import Client, Miniconf, MQTTv5, discover, MiniconfException
from miniconf import Client, Miniconf, MQTTv5, one, discover, MiniconfException
from stabilizer import voltage_to_machine_units

if sys.platform.lower() == "win32" or os.name.lower() == "nt":
Expand Down Expand Up @@ -100,12 +100,7 @@ async def test():
args.broker, protocol=MQTTv5, logger=logging.getLogger("aiomqtt-client")
) as client:
if not args.prefix:
devices = await discover(client, "dt/sinara/dual-iir/+")
if len(devices) != 1:
raise MiniconfException(
"Discover", f"No unique Miniconf device (found `{devices}`)."
)
prefix = devices.pop()
prefix, _alive = one(await discover(client, "dt/sinara/dual-iir/+"))
logging.info("Found device prefix: %s", prefix)
else:
prefix = args.prefix
Expand Down
8 changes: 3 additions & 5 deletions hitl/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ async def _main():
) as client:
prefix = args.prefix
if not args.prefix:
devices = await miniconf.discover(client, "dt/sinara/dual-iir/+")
assert (
len(devices) == 1
), f"Not a single unique Stabilizer found: {devices}."
prefix = devices.pop()
prefix, _alive = miniconf.one(
await miniconf.discover(client, "dt/sinara/dual-iir/+")
)

logging.basicConfig(level=logging.INFO)

Expand Down
4 changes: 2 additions & 2 deletions py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ text = "MIT"
[project]
name = "stabilizer"
# Note: keep this in sync with Cargo.toml
version = "0.10.0"
version = "0.11.0"
description = "Utilities for configuring Stabilizer"
authors = [
{ name = "Robert Jördens", email = "[email protected]" },
Expand All @@ -18,7 +18,7 @@ dependencies = [
"numpy",
"scipy",
"matplotlib",
"miniconf-mqtt@git+https://github.com/quartiq/miniconf@v0.17.0#subdirectory=py/miniconf-mqtt",
"miniconf-mqtt@git+https://github.com/quartiq/miniconf@v0.18.2#subdirectory=py/miniconf-mqtt",
]

[project.urls]
Expand Down
Loading

0 comments on commit 23149d1

Please sign in to comment.