mirror of
https://github.com/esphome/esphome.git
synced 2026-09-27 22:16:47 +08:00
[gsl3670] Add a model configuration for the Guition JC8012P4A1 (#17843)
This commit is contained in:
@@ -68,6 +68,21 @@ MODELS = {
|
|||||||
CONF_SHA256: "2e50501ad83656fb6fa3d92591f9f31add4d442c8e8a79f29f5c4d335bd127a4",
|
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": {},
|
"CUSTOM": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -254,6 +254,31 @@ def test_config_seeed_model_applies_defaults(tmp_path: Path) -> None:
|
|||||||
assert CONF_RESET_PIN in result
|
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:
|
def test_config_rejects_non_dict() -> None:
|
||||||
"""A non-dict configuration is rejected."""
|
"""A non-dict configuration is rejected."""
|
||||||
with pytest.raises(cv.Invalid, match="expected a dictionary"):
|
with pytest.raises(cv.Invalid, match="expected a dictionary"):
|
||||||
|
|||||||
Reference in New Issue
Block a user