diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-10 10:42:37 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-10 10:42:37 +0100 |
| commit | b4893a1d51763a81380d8cff35c393236c379ec5 (patch) | |
| tree | 41df161211e4857146d3d934e2eea8638b26ad31 /tests | |
| parent | e3583dca51ce4b1e5d045147d939a0544622b194 (diff) | |
| download | deck-it-b4893a1d51763a81380d8cff35c393236c379ec5.tar.gz deck-it-b4893a1d51763a81380d8cff35c393236c379ec5.zip | |
fix(k1c): read the part fan from Creality's output_pin fan0
Creality's K1C firmware drives the part cooling fan as `output_pin fan0`
and reports the standard `fan` object with speed null, so the tab showed
no fan speed. The standard object still wins when it has a value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_k1c.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_k1c.py b/tests/test_k1c.py index b82869e..47c25ec 100644 --- a/tests/test_k1c.py +++ b/tests/test_k1c.py @@ -80,6 +80,13 @@ class K1C(unittest.TestCase): m.state(), m.state() self.assertEqual(sum("/server/files/metadata" in u for u, _ in fake.calls), 1) + def test_part_fan_falls_back_to_crealitys_output_pin(self): + st = k1c.summarize({"fan": {}, "output_pin fan0": {"value": 0.5}}) + self.assertEqual(st["fan"], 0.5) + # What the K1C actually reports: the key present, the value null. + self.assertEqual(k1c.summarize({"fan": {"speed": None}, "output_pin fan0": {"value": 1.0}})["fan"], 1.0) + self.assertEqual(k1c.summarize({"fan": {"speed": 0.3}, "output_pin fan0": {"value": 1}})["fan"], 0.3) + def test_off_backs_off_instead_of_polling_every_tick(self): fake = Fake(down=True) m = k1c.make({"k1c": {"url": URL}, "http": fake}) |
