HP Forums

Full Version: WaitLab: a utility for examining Wait(-1) command response to touchpad gestures
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
WaitLab is a utility for examining Wait(-1) command response to touch pad gestures. WaitLab prints the results of Wait(-1) in a continuous loop with a built in pause in the loop of Dly seconds. This simulates functional code that checks for user input and takes Dly seconds to process, then loops back and checks again. Every time Wait(-1) returns a list from the touchpad or a real number key press, the Mouse command is issued and the results are printed left to right: Wait(-1) result, time in milliseconds since the last result, Mouse result, velocity of drag in pixels per second if the result is a drag (code 1). Pressing the Esc key exits the program.

Here is a thread where WaitLab is referenced regarding Wait(-1) features and HP Prime freeze ups http://www.hpmuseum.org/forum/thread-1546.html

I have used WaitLab to deduce the following sequences for programmers using Wait(-1) to read the touchpad. This is supplemental to the calculator Help information which should be your starting point.

WAIT(-1) touch sequences, TYPE(WAIT(-1))==6, 5447:
Touch y>=219: {3,x,y}
Touch y<219: {0,x,y} {2} {3,x,y}
Long Touch y<219: {0,x,y} {7,x,y} {2} {3,x,y}
Drag: {0,x0,y0} {1,x1,y1}… {1,xn,yn} {2}
Long Touch & Drag:{0,x0,y0} {7,x0,y0} {1,x1,y1}… {1,xn,yn} {2}
Long Tch,Drg,Flick:{0,x0,y0} {7,x0,y0} {1,x1,y1}… {1,xm,ym} {1,65535,yn}{2}
Quick Flick: {0,x0,y0} {1,x1,y1} {1,65535,y2}{2}
Incoherent Flick {0,x0,y0} {1,65535,y1}{2}
Drag and Flick {0,x0,y0} {1,x1,y1}… {1,xm,ym} {1,65535,yn}{2}
Stretch: {0,ax0,ay0} {0,bx0,by0} {5,abx1…n,aby1…n,dx,dy} {2}***
Rotate: {0,ax0,ay0} {0,bx0,by0} {6,t0,t0…n,0,0}** {2}***

WAIT(-1) touch sequences, TYPE(WAIT(-1))==6 that are different with 6030:
Long Touch y<219: {0,x,y} {7,x,y} {2}
Long Tch,Drg,Flick:{0,x0,y0} {7,x0,y0} {1,x1,y1}… {1,xm,ym} {1,x,y}1 sec autodrag*
Quick Flick: N/A
Incoherent Flick N/A
Drag and Flick {0,x0,y0} {1,x1,y1}… {1,xm,ym} {1,x,y}1 sec autodrag*
Stretch: {0,ax0,ay0} {0,bx0,by0} {5,abx1…n,aby1…n,dx,dy} {2} {2}***
Rotate: {0,ax0,ay0} {0,bx0,by0} {6,t0,t0…n,0,0}** {2} {2}***

*1 sec autodrag (my word) are a series of Wait(-1) returns generated automatically after a flick or fast swipe in 6030 firmware in support of kinetic scrolling. They often return x,y coordinates off screen, have no trailing {2}, and can be stopped by a user touch. A keypress in the midst of autodrag is read correctly by Wait(-1), but the autodrag returns continue after the keypress until the second has timed out. The duration of the one second timeout is an educated guess on my part from experimenting with WaitLab.

**The meaning of t0…tn are n+1 angles from the second finger touched to the first in 1/32 circles, increasing ccw with 0 resulting from the first finger being directly right of the second finger. It is usually not important which finger is the reference finger but that the angle increases ccw.

***I am not 100% sure that the stretch / rotate trailing double {2} was a single {2} in 5447. I have it in my notes as a single {2} and noticed it as a double {2} after installing 6030. Unfortunately, I have no way of going back to 5447 on the actual calculator to check myself. I welcome confirmation one way or the other from anyone still operating 5447 on their calculator.

Here is some errata for the existing help screen and user manual description: 1)Change “happends” to “happens”. 2)The Stretch documentation is incorrect. The x,y values returned are current x,y location for whichever pointer is being returned, not “the delta since the last event” as the help screen states. The dx and dy values are dx and dy from the original touch location for whichever pointer is being returned as the help screen states.
Here's a slightly different approach to seeing the difference between wait(-1) and mouse(). Press [Apps] to clear the screen. Press [Symb] to toggle between showing wait(-1), mouse(), or both. Event types are color coded according to the result from wait(-1).


local run=1;
local key;
local n=0;
local cl:={#0h,#FF0000h,#FF00h,#FFh,#FFFF00h,#FFFFh,#A0A0A0h,#FF00AAh};
local cc:=1;
local mode:=0;


  while run do
    if TYPE(key)==6 then
      if mode<2 then
        if n>11 then n:=0;  end; 
      if mode then
        if n>11 then n:=0;  end; 
      if key==0 then rect_p(); n:=0; end;
      if key==1 then mode:=(mode+1) MOD 3; end;
      if n>11 then n:=0; rect_p(); end; 
      if key==4 then run:=0; end;


Reference URL's