[gsl3670] Add a model configuration for the Guition JC8012P4A1 (#17843)

This commit is contained in:
Michael Pöttgen
2026-07-25 11:33:17 +10:00
committed by GitHub
parent 6648ccc278
commit eb7575f59e
2 changed files with 40 additions and 0 deletions
+15
View File
@@ -68,6 +68,21 @@ MODELS = {
CONF_SHA256: "2e50501ad83656fb6fa3d92591f9f31add4d442c8e8a79f29f5c4d335bd127a4",
},
},
"GUITION-JC8012P4A1": {
CONF_SWAP_XY: True,
CONF_MIRROR_X: True,
CONF_MIRROR_Y: False,
CONF_X_MIN: 20,
CONF_Y_MIN: 20,
CONF_X_MAX: 880,
CONF_Y_MAX: 1648,
CONF_RESET_PIN: 22,
CONF_INTERRUPT_PIN: 21,
CONF_FIRMWARE: {
CONF_URL: f"{FIRMWARE_BASE_URL}/seeed-d1001-fw.bin",
CONF_SHA256: "2e50501ad83656fb6fa3d92591f9f31add4d442c8e8a79f29f5c4d335bd127a4",
},
},
"CUSTOM": {},
}
@@ -254,6 +254,31 @@ def test_config_seeed_model_applies_defaults(tmp_path: Path) -> None:
assert CONF_RESET_PIN in result
def test_config_guition_model_applies_defaults(tmp_path: Path) -> None:
"""The GUITION model populates transform and calibration defaults."""
fw = _write_firmware(tmp_path)
result = gsl.CONFIG_SCHEMA(
{
"model": "guition-jc8012p4a1",
"firmware": {"file": str(fw)},
}
)
assert result[CONF_MODEL] == "GUITION-JC8012P4A1"
# Transform defaults from the model.
assert result[CONF_TRANSFORM] == {
"swap_xy": True,
"mirror_x": True,
"mirror_y": False,
}
# Calibration defaults from the model.
assert result[CONF_CALIBRATION]["x_min"] == 20
assert result[CONF_CALIBRATION]["x_max"] == 880
assert result[CONF_CALIBRATION]["y_min"] == 20
assert result[CONF_CALIBRATION]["y_max"] == 1648
assert result[CONF_INTERRUPT_PIN]["number"] == 21
assert result[CONF_RESET_PIN]["number"] == 22
def test_config_rejects_non_dict() -> None:
"""A non-dict configuration is rejected."""
with pytest.raises(cv.Invalid, match="expected a dictionary"):