implement eq subcommand group + on subcommand

attach it to parent command group strip.
we can't do the same for bus because VBAN doesn't yet define a packet structure defining those parameters.
This commit is contained in:
onyx-and-iris 2026-02-27 17:41:05 +00:00
parent 1e76c2afd9
commit 837d63d789
3 changed files with 58 additions and 1 deletions

View File

@ -7,6 +7,9 @@ from .context import Context
from .help import CustomHelpFormatter
app = App(name='bus', help_formatter=CustomHelpFormatter())
# The VBAN protocl does not yet define a packet structure for these bus parameters.
# Hopefully that will come in the form of a 'VBAN_VMPARAMBUS_PACKET'.
# app.command(eq.app.meta, name='eq')
@app.meta.default

53
src/vmr_cli/eq.py Normal file
View File

@ -0,0 +1,53 @@
from typing import Annotated
from cyclopts import App, Argument, Parameter
from .context import Context
from .help import CustomHelpFormatter
app = App(name='eq', help_formatter=CustomHelpFormatter())
@app.meta.default
def launcher(
band: Annotated[int, Argument()] = None,
*tokens: Annotated[str, Parameter(show=False, allow_leading_hyphen=True)],
index: Annotated[int, Argument()] = None,
ctx: Annotated[Context, Parameter(show=False)] = None,
):
"""Control the EQ parameters.
Only channel 0 is supported, as the VBAN protocol only exposes parameters for this channel.
"""
additional_kwargs = {}
command, bound, _ = app.parse_args(tokens)
if index is not None:
additional_kwargs['index'] = index
if band is not None:
additional_kwargs['band'] = band
if ctx is not None:
additional_kwargs['ctx'] = ctx
return command(*bound.args, **bound.kwargs, **additional_kwargs)
@app.command(name='on')
def on(
new_state: Annotated[bool, Argument()] = None,
*,
index: Annotated[int, Parameter(show=False)] = None,
band: Annotated[int, Parameter(show=False)] = None,
ctx: Annotated[Context, Parameter(show=False)] = None,
):
"""Get or set the on state of the specified EQ band.
Parameters
----------
new_state : bool
If provided, sets the on state to this value. If not provided, the current on state is printed.
"""
if new_state is None:
# This doesn't work because the VBAN protocol doesn't send an initial NBS1 packet.
# console.out.print(ctx.client.strip[index].eq.channel[0].cell[band].on)
return
ctx.client.strip[index].eq.channel[0].cell[band].on = new_state

View File

@ -2,11 +2,12 @@ from typing import Annotated, Optional
from cyclopts import App, Argument, Parameter
from . import console
from . import console, eq
from .context import Context
from .help import CustomHelpFormatter
app = App(name='strip', help_formatter=CustomHelpFormatter())
app.command(eq.app.meta, name='eq')
@app.meta.default