Start a new topic

Button Touch Leave option

Hello!


I'm new to the Netion LCDs but I like it very much so far! Thanks for putting up this project.


I have a question - is there any method to detect touch leave from button? When you keep the finger pressed on button and then move it away while still touching - the button stays pressed - it is unacceptable in my project due to safety reasons.


I thought about sending actual coordinates to MCU, but the Nextion device sends coordinates only when touching/releasing :(.


Please advice me or can you add such a feature? I would love to use Nextion in my projects and purcharse more of them, but this option is really necessary to me.


Take care, BR,

Simon


1 person likes this idea

the only object, which offers a slide-observation is the SliderBar ... so, maybe just using a SliderBar as a Button may work?


Without knowing exactly what you really like to do it is a bit hard to suggest any ... maybe when knowing exactly what you like to do we also can offer a working solution .... maybe ...


It is not very realistic, that such a "feature" is implemented ... at least not in the near future ...

ok, assuming, that you


    - click the button

    - trigger exactly one time an action which starts when you press the button


I think you are after a "button onetime-click and release functionality ..." ...


This can be done easily with this code inside your button OnPress action ... assume, your buttons name is b0


delay=100
click b0,0
//your action

   


    - the delay makes that you still can see the press color change

    - the click event release the button again after 100ms

    - and now just execute your code after this ...


On this way, you press the button, trigger your action, but also release the button automatically, independent where your finger still is ...


btw. there is no "do something as long as the button is pressed" functionality in general. When you press a button, exactly one action is triggered ... otherwise you need a timer ...

I have to send commands every 50ms while touching the button, here is my code:


b0 Touch press:

Active_mov_var.val=1


b0 Touch release:

Active_mov_var.val=0

print ";TS"

printh 0D 0A


Timer 0 (every 50ms):

if(Active_mov_var.val==1)

{

  print ";TU"

  printh 0D 0A

}


The way you have described it will only send one command. My code is working fine, I need to figure out the way to disable the button when still touching the LCD but leaving it's area.


The easiest way would be to add in the timer:

if( "COORDINATES IN RAGE OF BUTTON'S AREA") {


//send some command

} else

{

//do not send anything or send stop command

}


but in nextion there is no function to retrieve actual position of the finger.

ok, simple answer, no, it can't be done in the way you expect, sorry.

The Nextion does neither offer a real native function to detect your press position on screen, nor a SlideOut Object property ...

The only chance to do your project is (if possible), to rearange your overall underlaying logic workflow ...

 

Will Nextion support functions like "RetrieveTouchPosition" or "real-time sendxy" in the future? And possibly when?

you catched me ... but  "No VaporWare Policy ..."

sorry, when we have something to publish, we will be the very first who will do ...

We won't state any about things which are not finished. It wouldn't be very seriouse to give any ETA or other promise, which we maybe can't fulfill ... too many things can happen which may influence a given workflow ...

And there is nothing more bad than delay a given promise ... so, we just don't do ... sorry ...

But I also can tell you, great things will happen in 2017 ... :-)

 

Ok, thanks. Do you know some Nextion alternative that supports that function?

    - a simple Android based Tablet of your choice ...

    - a Compiler for Android of your choice ...

    - a lot of time to learn how to programm APK's in general ...

    - a lot of time to learn how to interface an Android device to the outside world ...


I have this application on Win(WPF) and Android as well. Now I need simplicity and fast boot-up time. I thought sendxy sends coordinates constantly, too bad it doesn't - every 30ms would be more than enough! Really is it that hard to add such a function? I think a lot of people want to use the nextion with servos etc. and they need such a function as well. Good luck with the developement :)

you can do work with servos, that's no issue. And I bet you also can exactly do what you want to achieve. Maybe not in the way you choosed to go, but nobody force you to do things in the way you try to do ...

Without exactly knowing what you really like to do, it is also hard to find a solution for you. What exactly do you like to do, what do you like to achieve? Maybe a plain and exact description of your project will help, at least we would have some more ideas ...

 

Let's say that I'm operating a motors, that are controlled from central MCU, I have several control devices - PC touch panel (windows) a tablet and now I wanted to add a LCD to the device itself - and for the safety reasons it is required that if your finger slips from the button - the motor should immediately stop.


The Nextion is a nearly perfect solution for my needs! All I needed more was retreiving actual touch position to check if the finger is still "in bounds" of the button.


Also if you would have that option you could track the finger position and set the mechanism's angles - that would be kick-ass.


Please consider adding such a function, I was so impressed that I could implement my HMI in a such a simple way and maybe in 3hours or so. I don't want to abandon this hardware - it's such a great idea, but it lacks some functions.

Wouldn't the attached do what you intend?

 

HMI
not really. He likes to press the button, keep it pressed, sliding away from the button and detect, that finger leave button area without lift up ...

that's just not doable ...


 

Michael Harwerth - I was using similar method to send commands every 50ms.


The attached video will probably show you the difference and explain the goal that I'm trying to achieve:


https://youtu.be/tb05twDrUrw


Thanks for your interest in this topic.

Login or Signup to post a comment