Hi,
I’m having trouble with the Touchdisplay. It sometimes fires TouchUpEvent 3 to 6 times.
I have no clue what to do ?
Us this on production or insider engineering samples?
public class Input {
public static class Touch {
static FT5xx6Controller touch;
public static void InitializeTouch() {
var i2cController = I2cController.FromName(SC20260.I2cBus.I2c1);
var settings = new I2cConnectionSettings(0x38) {
BusSpeed = 100000,
AddressFormat = I2cAddressFormat.SevenBit,
};
var i2cDevice = i2cController.GetDevice(settings);
var gpioController = GpioController.GetDefault();
var interrupt = gpioController.OpenPin(SC20260.GpioPin.PJ14);
touch = new FT5xx6Controller(i2cDevice, interrupt);
touch.TouchDown += Touch_TouchDown;
touch.TouchUp += Touch_TouchUp;
}
private static void Touch_TouchUp(FT5xx6Controller sender, TouchEventArgs e) => Program.MainApp.InputProvider.RaiseTouch(e.X, e.Y, GHIElectronics.TinyCLR.UI.Input.TouchMessages.Up, System.DateTime.Now);
private static void Touch_TouchDown(FT5xx6Controller sender, TouchEventArgs e) => Program.MainApp.InputProvider.RaiseTouch(e.X, e.Y, GHIElectronics.TinyCLR.UI.Input.TouchMessages.Down, System.DateTime.Now);
}
And how do you know touch is fired 3-6 times?
Put break point, Writeline, or what UI element that we can see?
Anyway, if you know how to build TinyCLR Driver, you can change the TinyCLR-Drivers\FocalTech\FT5xx6\FT5xx6.cs,
this.interrupt.DebounceTimeout = TimeSpan.FromMilliseconds(1);
increase to 10 or 50, rebuild the project that will help, but we would like to know more detail to preproduce by self.
I found out something was wrong because a Button Click Event was turning a LED on and off.
Then i used WriteLine and my conclusion was the TouchUp event.