mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-11-11 13:07:36 +00:00
Four defects found by hardware testing of the Expansion Kit V2. Touch never registered. The panel's controller does not use the point-count encoding the reference CHSC6X drivers document: byte 0 reads 0x00 idle and 0x1F while a finger is down, so testing for a count of 1 never fired. A partly-failed read leaves 0xFF, which must not count as a press either, so the test is now != 0x00 && != 0xFF. Touch polling could stall the UI loop for ~1 s at a time. The controller NACKs its address whenever it has nothing to report, and calling requestFrom() unconditionally logged a bus error on every 50 ms poll and, once the bus wedged, burned a full ESP_ERR_TIMEOUT inside loop(). Probe the address first, which reports the same NACK quietly, and bound the read with setTimeOut(). The display could not be woken once it blanked; only RST brought it back. turnOn() re-ran the whole display.init(), which re-enters SPI setup, spends ~500 ms in Adafruit's reset delays and pulses GPIO 21 - the line shared with TP_RST, so it reset the touch controller on every wake. Since turnOff() no longer parks that line low, the panel stays configured while dark and waking is just the backlight. Toggling also clears the refresh deadline so the current frame is drawn immediately instead of the stale one. Power-off rebooted instead of staying off. powerOff() went through enterDeepSleep(), which always arms an ext1 wake on P_LORA_DIO_1; a deep-sleep wake is a full reboot, so a node in live traffic restarted within seconds of showing "Turning OFF". It now disables every wake source, so the node stays down until RST or a power cycle. Note that the display off/on cycle had never been exercised on this board before: observer builds pinned AUTO_OFF_MILLIS=0, so the panel never blanked until display.timeout made it a runtime setting.