Add touch_probe and touch_reset actions to the Elecrow for a diagnosis over the API (0.2.97, firmware 0.2.83)
CI / checks (push) Has been cancelled
CI / firmware (add-on) (push) Has been cancelled
CI / firmware (min_version) (push) Has been cancelled

This commit is contained in:
Xandrossian
2026-09-21 14:03:05 -07:00
parent 4ec8c7a935
commit 6910f30d4c
8 changed files with 90 additions and 20 deletions
+8 -3
View File
@@ -58,14 +58,19 @@ class BoardFile(unittest.TestCase):
# The USB pins are the touch I2C: the header that frees them.
self.assertIn('<esphome/components/smart_display/elecrow_usb_phy.h>', TEXT)
# The V3.0's PCA9557 brings the GT911 out of reset before the driver runs (firmware 0.2.82).
self.assertIn(' elecrow_touch_reset:\n i2c_id: touch_bus\n address: 0x18', TEXT)
self.assertIn(' elecrow_touch_reset:\n id: touch_reset\n i2c_id: touch_bus\n address: 0x18', TEXT)
code = '\n'.join(line for line in TEXT.split('\n') if not line.lstrip().startswith('#'))
self.assertNotIn('reset_pin', code)
self.assertNotIn('interrupt_pin', code)
header = (ROOT / 'components/smart_display/elecrow_touch_reset.h').read_text()
for step in ('write(0x03, 0x00)', 'write(0x01, 0x00)', 'delay(20)', 'write(0x01, 0x01)', 'delay(100)', 'write(0x03, 0x02)'):
self.assertIn(step, header)
# Elecrow's own values at setup, and the sequence in that order.
self.assertIn('this->reset(0x00, 0x00, 0x01, 20, 100, 0x02)', header)
order = [header.index(step) for step in ("write_reg_(0x03, config)", "write_reg_(0x01, low)", "delay(hold_ms)",
"write_reg_(0x01, high)", "delay(wait_ms)", "write_reg_(0x03, final_config)")]
self.assertEqual(order, sorted(order))
self.assertIn('return 700.0f', header)
for action in ('touch_probe', 'touch_reset'):
self.assertIn(f'- action: {action}', TEXT)
self.assertIn('assertion_level: SILENT', TEXT)
def test_the_flash_fits_by_three_measures(self):