From 0548367982869445b173e7bcb3f5b08de8055220 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Mon, 22 Nov 2021 20:04:42 +0100 Subject: [PATCH] Prevent touch driver crash --- src/drv/touch/touch_driver_ft6336u.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/drv/touch/touch_driver_ft6336u.h b/src/drv/touch/touch_driver_ft6336u.h index e0cdc53b..b7d35253 100644 --- a/src/drv/touch/touch_driver_ft6336u.h +++ b/src/drv/touch/touch_driver_ft6336u.h @@ -81,9 +81,13 @@ class TouchFt6336u : public BaseTouch { LOG_INFO(TAG_DRVR, F("Touch freq. : %d"), I2C_TOUCH_FREQUENCY); LOG_INFO(TAG_DRVR, F("Touch address : %x"), I2C_TOUCH_ADDRESS); + LOG_VERBOSE(TAG_DRVR, F("%s %d"), __FILE__, __LINE__); + ft6336u_touch = new FT6336U(TOUCH_SDA, TOUCH_SCL, TOUCH_RST, TOUCH_IRQ); + LOG_VERBOSE(TAG_DRVR, F("%s %d"), __FILE__, __LINE__); ft6336u_touch->begin(); + LOG_VERBOSE(TAG_DRVR, F("%s %d"), __FILE__, __LINE__); // From: M5Core2/src/M5Touch.cpp // By default, the FT6336 will pulse the INT line for every touch // event. But because it shares the Wire1 TwoWire/I2C with other @@ -91,12 +95,13 @@ class TouchFt6336u : public BaseTouch { // handle these events. So instead, we set the INT wire to polled mode, // so it simply goes low as long as there is at least one valid touch. // ft6336u_touch->writeByte(0xA4, 0x00); - Wire1.beginTransmission(I2C_TOUCH_ADDRESS); - Wire1.write(0xA4); // address - Wire1.write(0x00); // data - Wire1.endTransmission(); + // Wire1.beginTransmission(I2C_TOUCH_ADDRESS); + // Wire1.write(0xA4); // address + // Wire1.write(0x00); // data + // Wire1.endTransmission(); - touch_scan(Wire1); + LOG_VERBOSE(TAG_DRVR, F("%s %d"), __FILE__, __LINE__); + // touch_scan(Wire1); if(ft6336u_touch->read_chip_id() != 0) { LOG_INFO(TAG_DRVR, F("FT6336U touch driver started chipid: %d"), ft6336u_touch->read_chip_id());