Fix swapped pan directions for smartcam pantilt module (#1858)
Some checks are pending
CI / Perform Lint Checks (3.15) (push) Waiting to run
CI / Python 3.11 on macos-latest (push) Blocked by required conditions
CI / Python 3.12 on macos-latest (push) Blocked by required conditions
CI / Python 3.13 on macos-latest (push) Blocked by required conditions
CI / Python 3.14 on macos-latest (push) Blocked by required conditions
CI / Python 3.15 on macos-latest (push) Blocked by required conditions
CI / Python 3.11 on ubuntu-latest (push) Blocked by required conditions
CI / Python 3.12 on ubuntu-latest (push) Blocked by required conditions
CI / Python 3.13 on ubuntu-latest (push) Blocked by required conditions
CI / Python 3.14 on ubuntu-latest (push) Blocked by required conditions
CI / Python 3.15 on ubuntu-latest (push) Blocked by required conditions
CI / Python 3.11 on windows-latest (push) Blocked by required conditions
CI / Python 3.12 on windows-latest (push) Blocked by required conditions
CI / Python 3.13 on windows-latest (push) Blocked by required conditions
CI / Python 3.14 on windows-latest (push) Blocked by required conditions
CI / Python 3.15 on windows-latest (push) Blocked by required conditions
CodeQL Checks / Analyze (python) (push) Waiting to run

This commit is contained in:
Anubhav Lal
2026-11-28 20:49:35 +05:30
committed by GitHub
parent 0580eacc3e
commit 84eacf432e
2 changed files with 24 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ class PanTilt(SmartCamModule):
"pan_right",
"Pan right",
container=self,
attribute_setter=lambda: self.pan(self._pan_step * -1),
attribute_setter=lambda: self.pan(self._pan_step),
type=Feature.Type.Action,
)
)
@@ -45,7 +45,7 @@ class PanTilt(SmartCamModule):
"pan_left",
"Pan left",
container=self,
attribute_setter=lambda: self.pan(self._pan_step),
attribute_setter=lambda: self.pan(self._pan_step * -1),
type=Feature.Type.Action,
)
)

View File

@@ -210,3 +210,25 @@ async def test_pantilt_no_presets_in_data(dev: Device, mocker: MockerFixture) ->
assert pantilt_mod._presets == {}
assert pantilt_mod.presets == {}
@pantilt
@pytest.mark.parametrize(
("feature_id", "x_coord", "y_coord"),
[
("pan_right", "30", "0"),
("pan_left", "-30", "0"),
("tilt_up", "0", "10"),
("tilt_down", "0", "-10"),
],
)
async def test_pantilt_direction_features(
dev: Device, mocker: MockerFixture, feature_id: str, x_coord: str, y_coord: str
) -> None:
mock_protocol_query = mocker.patch.object(dev.protocol, "query", return_value={})
await dev.features[feature_id].set_value(None)
mock_protocol_query.assert_called_with(
request={"do": {"motor": {"move": {"x_coord": x_coord, "y_coord": y_coord}}}}
)