LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reinitialize a slide to default is late

This is a simple hack to get a latching slider. It lacks in that the mouse up requires you to still be hovering over the control, so optimally you'd need to either check any Mouse up (not just on the control) and/or add Value check event that don't trigger while mouse is still pressed, or similar.

Latching slider.png

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 11 of 18
(621 Views)

@Aqua- wrote:

@Darin.K wrote:

Buttons have a built-in capability that your slider will be lacking: latching.  With a button, you can easily achieve a single transition per button press (or release).  Your slider-switch is not going behave like that out-of-the-box.  Instead, it will keep trying to achieve a certain value as long as the mouse button is down.  What is happening in your code is that you move the slider to say 'inverse', if the motion is fast enough, the reinitialization occurs while the mouse button is still down, and the value immediately reverts to 'inverse'.  Once the user releases the mouse button, the reinitialization finally 'sticks'.  This is why it seems to work normally when the motion step takes long enough and is buggy when the motion is quick.

 

You are going to have to change something to get this to work the way you want.  You could use buttons (one for normal and one for inverse).  If you really want a slider you are going to have to add a delay (quick and dirty, not 100% effective) or use an event structure to try to fake it (many corner cases here to consider).


Hi darin thanks for replying.

What you are saying is interesting, but the reality is quite the contrary.

When ithe movement is fast, i.e. when i insert a movement of 10mm with a velocity of 10mm/sec the bug is gone. The problem occurs when the motion is slow, i.e. movement of 10mm with velocity 1mm/sec.

 

What you are saying about the button make sense to me, i wonder if the "double click" is what make the problem.

 

I use the slid to make my code more compact. If i use 2 regular buttons i have to duplicate the whole chunk of code for relative movement just for that, and this is something i dont like to do. I like the idea of a 3 way button/switch cause its more intuitive, and TBH i work with a witeless mouse 3-4 meters from the computer so it's easier to see.

 

Is it really that difficult to make a 3 way button? Why there is not such a default option in the program? I'be seen so many requests in this forum for such functionality.


I'll just mention here that Darin is pretty much always right.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 12 of 18
(610 Views)

Looks like you solved the problem (havent tried it yet, but im sure you know what you're saying.), however those are the kind of things i try to avoid - expending and complicating my code, and make unnecessary commands execute with no need.

 

You pointed the problem with your solution, i wouldnt like this event to trigger on every mouse click, plus from what you suggest i need to even complicate thing more by adding a case for not triggering while the mouse still pressed...

 

In that cost i rather take the 2 buttons solution which is less complicated to program, more compact, less wasteful in resources and guarentee to work.

 

Dont get me wrong, it's amazing that you have a solution to my problem so easily, but it just seems like too much for a simple task, and i like to keep things as simple as possible in my code.

 

It strikes me strange that no multy state button is implemented in the program. i tried to use an enum ring with pictures, but it doesnt look like a button and it is awkward to use.

Lately I've thought of a cluster with 3 buttons (the arrow buttons from the system pallete i think). those buttons behave like button, so i wonder if there is a bypass to through that... even in this case i think i still have to reinitialilze/write value manually to make it work. i wish the would have been like an old VCR/radio tape 3 button state where a press on one button cancels the pressing of the others immidiately...

0 Kudos
Message 13 of 18
(595 Views)

Coming late to the party but when I finally took at a look at the code my main thought was, "oh! error handling problems!"

 

My theory: whatever you changed in your "Move Relative" vi really IS the source of the problem.  Long, slow motions now return an error (probably some kind of timeout?) which prevents your "Reinit to default" from executing!

 

Whatever you did to speed up the code in "Move Relative" made you more prone to some kind of error, probably a timeout, that's MY theory.   

 

 

-Kevin P

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 14 of 18
(589 Views)

@Kevin_Price wrote:

Coming late to the party but when I finally took at a look at the code my main thought was, "oh! error handling problems!"

 

My theory: whatever you changed in your "Move Relative" vi really IS the source of the problem.  Long, slow motions now return an error (probably some kind of timeout?) which prevents your "Reinit to default" from executing!

 

Whatever you did to speed up the code in "Move Relative" made you more prone to some kind of error, probably a timeout, that's MY theory.   

 

 

-Kevin P

 


all in all sounds reasonable.

Today im gonna put my hands on the Vi and fix everything you guys suggested.

i will try to display the error out from the SubVi and see if i get any clue.

Thanks

0 Kudos
Message 15 of 18
(570 Views)


Update:

 

I fixed the typographical error, but it did not solve the problem.

I changed the interface to a 2 button panel instead of a slider and it works perfect as expected.

I had limited time to work on the code and top priority was to prepare the program to work this afternoon.

 

I might just leave the 2 buttons interface just because my colleague want me to stop try and fix what's already working, but this bug drives me insane and i wasted several hours on it, so i'd like to try and waste a few more try and fix it just to feel good (and maybe learn something on the way).

So i will keep update about my attempts, but with even lower frequancy.

 

Thanks a lot for the help

Message 16 of 18
(563 Views)

2nd update:

 

I tried the "defer front panel update" property solution, but i didnt work...

I am not sure 100% i did it right as it doubles the error & ref wires in my code and it made me a bit confused, but i followed a  thread in this forum giving an example of how to use it and it looked quite like similar. The property definitely worked cause i have an indicator that refresh every so long and display the current position of the stage. In the while that the property is set to "True" the position stops the update. This is another problem with this solution (in my case), as i want the front panel to keep updating to show current position.

 

Another thing i tried was displaying the error out of the "Move Relative" SubVi to see if any error is shooting out when the slider works abnormally, but the "error out indicator" was empty and unchanged no matter what i did, so either i dont know how to use it (though in the past i have seen errors shooting out in such indicators), or everything is fine and therefore the error node stays clear.

0 Kudos
Message 17 of 18
(531 Views)

Actually I suggested reading the help file for that method because it has excellent information about how front panel controls are updated.   It is not meant as a means to resolve the issue but to explain why the reinitialize to default is not the real reason for the behavior you said you saw.


"Should be" isn't "Is" -Jay
0 Kudos
Message 18 of 18
(522 Views)