WAIT()
|
09-04-2017, 08:41 AM
(This post was last modified: 09-04-2017 08:46 AM by webmasterpdx.)
Post: #1
|
|||
|
|||
WAIT()
Does WAIT(1) return the same values as the MOUSE() function? Does it put the calculator into low power mode while it's waiting? If not, it should....as code without that hogs a lot of battery power as it's stuck in a loop calling MOUSE().
I notice that the docs say that WAIT returns a keycode if a key is pressed. Are there any examples of WAIT vs MOUSE anywhere? Also is there a way to make the code wait less than 1 second?....like 200mS? Thx -Donald |
|||
09-04-2017, 09:31 AM
Post: #2
|
|||
|
|||
RE: WAIT()
I think I've figured out how to make it work...
In a normal menu loop, a press of a menu selection actually is 5 selections (the time your finger is touching the screen...it loops 5 times in that time). So, in the normal code call WAIT(-1); at the bottom of the menu loop, and it'll wait until an event. Then the regular MOUSE call can handle the next event. The docs on WAIT describe the different options. You could use the WAIT command itself to get the event info if you'd prefer....is in the docs too. Still would like to know if it uses low power mode when in wait. Also would like to know if it can be made to wait less than one second. |
|||
09-04-2017, 09:34 AM
Post: #3
|
|||
|
|||
RE: WAIT()
I think WAIT(0.2) waits 200ms....anyone know if I'm correct?
|
|||
09-04-2017, 09:51 AM
Post: #4
|
|||
|
|||
RE: WAIT()
Prove it for yourself. You can encapsulate it in a timer, perhaps multiple times, collect the run times in the statistics app to reconcile your results.
|
|||
09-04-2017, 10:18 AM
(This post was last modified: 09-04-2017 10:20 AM by webmasterpdx.)
Post: #5
|
|||
|
|||
RE: WAIT()
Here is an example using WAIT to handle menus...I'm using the common PUTMENU and GETMENU functions...
First, here are the PUTMENU and GETMENU functions... Code:
And here is the example using these and WAIT to implement a simple test. This example is called by MBase(4,5,6). The menu has HEX, which outputs the first input number to the terminal, OCT, which outputs the second input number to the terminal, DEC, which prints the 3rd input number, BIN which clears the terminal and EXIT which exits the program. Note that I check for the event type to be a 3 or a 7 (Click or Long Click). Code:
|
|||
09-04-2017, 11:05 AM
Post: #6
|
|||
|
|||
RE: WAIT()
I did try WAIT(0.2) and it does seem to be faster than a second, so I'd like confirmation of this. Also be nice to know if WAIT goes into low power mode.
Thx -D |
|||
09-04-2017, 12:04 PM
Post: #7
|
|||
|
|||
RE: WAIT()
(09-04-2017 11:05 AM)webmasterpdx Wrote: I did try WAIT(0.2) and it does seem to be faster than a second, so I'd like confirmation of this. TEVAL(WAIT(0.2)) --> 0.198_s in Home view. Close enough for government work. Note: TEVAL doesn't work in CAS view. If you need an execution time in a CAS program, use time(whatever), an undocumented function, but be sure to spell 'time' in all lowercase letters. It returns the time in seconds with no unit attached. It also works in Home view. <0|ɸ|0> -Joe- |
|||
09-04-2017, 09:24 PM
Post: #8
|
|||
|
|||
RE: WAIT()
Thanks!
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 8 Guest(s)