Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions dali/DALI/gear/gear_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ def write_gear_frame_and_wait(
) -> None:
logger.debug("write gear frame and wait for finish")
frame = address_byte << 8 | opcode_byte
dali.transmit(
DaliFrame(length=DaliFrameLength.GEAR, data=frame, send_twice=send_twice),
block=True,
)
dali.transmit(DaliFrame(length=DaliFrameLength.GEAR, data=frame, send_twice=send_twice), block=True)


@typechecked
Expand Down
6 changes: 4 additions & 2 deletions dali/DALI/gear/gear_enumerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@

def prepare_bus(dali: DaliInterface) -> None:
# INITIALISE ALL
write_gear_frame_and_wait(dali, GearSpecialCommandOpcode.INITIALISE, 0, True)
write_gear_frame_and_wait(dali, GearSpecialCommandOpcode.INITIALISE, 0xFF, True)


def clear_short_addresses(dali: DaliInterface) -> None:
set_gear_dtr0(dali, 0xFF)
address = GearAddress()
address.broadcast()
write_gear_frame_and_wait(dali, address.byte, GearConfigureCommandOpcode.SET_SHORT_ADDRESS, True)


def remove_from_all_groups(dali: DaliInterface) -> None:
for group in range(DaliMax.GEAR_GROUP):
address = GearAddress()
address.broadcast()
write_gear_frame_and_wait(dali, address.byte, GearConfigureCommandOpcode.REMOVE_GROUP + group, True)


Expand Down Expand Up @@ -64,7 +66,7 @@ def set_short_address(dali: DaliInterface, new_short_address: int) -> bool:
GearSpecialCommandOpcode.PROGRAM_SHORT_ADDRESS,
((new_short_address << 1) | 1),
)
data = (GearSpecialCommandOpcode.VERIFY_SHORT_ADDRESS << 8) + (((new_short_address << 1) | 1) & 0xFF)
data = (GearSpecialCommandOpcode.VERIFY_SHORT_ADDRESS << 8) | ((new_short_address << 1) | 1)
result = dali.query_reply(DaliFrame(length=DaliFrameLength.GEAR, data=data))
if result.length == DaliFrameLength.BACKWARD:
write_gear_frame(dali, GearSpecialCommandOpcode.WITHDRAW)
Expand Down
3 changes: 1 addition & 2 deletions dali/DALI/gear/gear_query.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""Control gear query command implementations."""

import click
from dali_interface import DaliInterface

from dali.DALI.device.device_query import device_address_option
from dali_interface import DaliInterface

from .gear_action import query_gear_and_display_reply, query_gear_value
from .gear_opcode import GearQueryCommandOpcode
Expand Down
1 change: 0 additions & 1 deletion tests/cli/test_device_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest
from click.testing import CliRunner

from dali.DALI.system.constants import DaliMax
from dali.dali_cli import cli

Expand Down
1 change: 0 additions & 1 deletion tests/cli/test_device_special.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest
from click.testing import CliRunner

from dali.dali_cli import cli


Expand Down
1 change: 0 additions & 1 deletion tests/cli/test_gear_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest
from click.testing import CliRunner

from dali.dali_cli import cli


Expand Down
1 change: 0 additions & 1 deletion tests/cli/test_gear_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest
from click.testing import CliRunner

from dali.dali_cli import cli


Expand Down
1 change: 0 additions & 1 deletion tests/cli/test_gear_special.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest
from click.testing import CliRunner

from dali.dali_cli import cli


Expand Down