LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable external slider update while opperator is sliding.

Solved!
Go to solution

Hi All,

 

I'm new to using the forum for questions, hope i have not missed any rules to do so.

 

Situation:

A front panel slider value gets updated every 200ms to show the value that is read from an external device (Modbus) (done elsewhere in the code and updated via a local variable).

So simulate this behavior i made a eventcase timeout to set a slider to 50.

 

User wants to set a new value by sliding the slider, a user event with e.g. mouse up would send the new value via modbus to the external divice.

01.JPG02.JPG

 

Problem / Question:

While the user is still sliding (mouse not up), the value will be updated (to 50 in this case) every 200ms. This results in flashing the slider at 50, and flashing back at the user mouse location.

Is there a way of preventing this behavior? By a setting (or fixing my method 🙂 )

 

I would prefer the slider sticking to the mouse 'while sliding', instead of the flashing actual value. Hope it makes sense.

I could maybe update local variables only if the value is unequal, but that does seems quite a bit of work (of course it is not about only one slider 🙂 )

 

Thanks !,  Marcel

0 Kudos
Message 1 of 7
(1,827 Views)

Hi Marcel,

 


@MarcelRo wrote:

Is there a way of preventing this behavior? By a setting (or fixing my method 🙂 )


You can correct this by "fixing your method"! 😄

 


@MarcelRo wrote:

Situation:

A front panel slider value gets updated every 200ms to show the value that is read from an external device (Modbus) (done elsewhere in the code and updated via a local variable).

So simulate this behavior i made a eventcase timeout to set a slider to 50.

 

User wants to set a new value by sliding the slider, a user event with e.g. mouse up would send the new value via modbus to the external divice.


So there is a control, which is abused as an indicator to constantly show data from an external device.

And you want to use this very same control to have the user input new data!? What should happen with the user input when your external device is overwriting the user input within several milliseconds?

 

Suggestion: show the device data in a real indicator. Place the slider next to it and have it act solely as user input. Decide later on what to do with user input (in relation to device data)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(1,822 Views)

As has been said, you cannot have two masters for one control so you need some form of conflict resolution.

 

For example you can have mouse up/mouse down events (and some others) that would set a state to ignore the modbus reading update for the duration where the slider is operated.

 

Another possibility would be to have two siders (one operational (not filled, slider visible) and one for the current reading (filled, hidden slider))

 

Also, to get more specific help, you need to attach your code. Pictures are insufficient to demonstrate the problem because we cannot even tell how the events are configured.

 

Maybe take a step back and describe in words how it will be used from the operator perspective.

0 Kudos
Message 3 of 7
(1,789 Views)
Solution
Accepted by MarcelRo

@altenbach wrote:

Another possibility would be to have two siders (one operational (not filled, slider visible) and one for the current reading (filled, hidden slider))

 


Here's how that could look like ( Very simplified. More code needed. Simulated instrument response).

 

altenbach_0-1658505284012.png

 

Message 4 of 7
(1,775 Views)

You could just have the timeout value be a shift register so when you start the mouse down event it stops running, then resumes on mouse up:

Kyle97330_0-1658514259907.png

This can be dangerous on rare occasions if the "Mouse up" event is missed (usually because the user lifts up the mouse button while not over the control).  So you also might want to turn the timeout back on when a "Mouse leave" event happens as well.

Message 5 of 7
(1,751 Views)

Thank you all for the feedback, and both options for solving this behavior / bad programming 🙂 

I think indeed looking at it from the perspective of having a setpoint and a actual reading is the best way to go.

 

Reason i have not really thought of this is because in my application there might now be a third variable in this situation.

I'll have to figure out if i will even show this in the screen or not, but at least i can now go and play with this for a while.

 

Just for the extra information: In this case, (although i have a lot more controls), i'm 'setting' the speed/RPM of a combustion engine in a lab. So with LV i set the 'setpoint' that is in the engine ECU. ECU is polled for the 'setpoint' every 200ms, AND 'engine actual speed' is polled every 200ms. So for the solution you mentioned I can use the slider to both show the labview setpoint and the ECU setpoint. And a indicator to show the actual engine speed for instance. 

 

Thanks, I can go further from here! 

0 Kudos
Message 6 of 7
(1,714 Views)

Hi Marcel,

 


@MarcelRo wrote:

Just for the extra information: In this case, (although i have a lot more controls), i'm 'setting' the speed/RPM of a combustion engine in a lab. So with LV i set the 'setpoint' that is in the engine ECU. ECU is polled for the 'setpoint' every 200ms, AND 'engine actual speed' is polled every 200ms. So for the solution you mentioned I can use the slider to both show the labview setpoint and the ECU setpoint. And a indicator to show the actual engine speed for instance. 


You should have told this example right from the beginning…

 

Each slider/gauge allows you to show a digital display, so you don't need an additional indicator!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(1,702 Views)