HP Forums

Full Version: HP Prime -- App and non-app programming requests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

In programming apps, I have run into situations where I often think "Geez, I wish the calc did or did not do that."

1. When viewing the Plot view, we are always given an "error" if there are no equations entered and selected. So if I create an app in which I want to make custom graphs, the current state of apps is such that I have to start by copying the Function or Advanced Graphing app. If I then want to make use of the plot view, I will always have to deal with an error when no equations are entered and selected. Or, in my case, I have my users enter their functions, but they are not open sentences (in the case for Advanced Graphing) so that when I introduce the plot screen it barfs up an error about the user's function not being an open sentence.

2. Will we eventually be able to create apps without having to depend on existing apps? Or if we see bits and pieces of several apps we want to incorporate into our own app, this seems very tedious at best, and impossible at worst. I realize that certain parameters from one app can be used in another (e.g. MyApp.Variable1 can be used from MyApp even if I am running something else called YourApp). However, it does not seem that I am able to make use of a spreadsheet within an function-based app (at best I can mimic a spreadsheet with a matrix). App creation, at this point, seems very confined.

3. Is there anyway to have something similar to: << 0 WAIT >> on the HP48 in which the calc enters a low power state and "pauses" until woken up by input (either keyboard or "mouse"). The only way to get input is to force a continuous loop and constantly polling the keys and mouse. This seems like a big waste of battery power. (On the HP48, the calculator essentially "pauses" until a key is pressed when using << 0 WAIT >>)

Han

I agree, the Prime Apps are limited (and obviously made for high school students). The HP50G-style libraries are more versatile. I won't be throwing away my 50G any time soon!

Quote:
Is there anyway to have something similar to: << 0 WAIT >> on the HP48 in which the calc enters a low power state and "pauses" until woken up by input (either keyboard or "mouse"). The only way to get input is to force a continuous loop and constantly polling the keys and mouse. This seems like a big waste of battery power. (On the HP48, the calculator essentially "pauses" until a key is pressed when using << 0 WAIT >>)

WAIT(0) might be what you want. Has anybody tested the battery drain during Prime's WAIT(0) command? It returns the keycode sorta like in RPL, but sequentially 0 through 50 instead of RPL's rc.p format. It might be low-power, which would be massively cool. Unlike in RPL, it times out after 1 minute, but a simple loop can catch that, since it returns -1 if it times out.

My understanding (from the manual) was that WAIT(0) only partly behaves like << 0 WAIT >> on the HP48 series. On the older calcs, it would wait indefinitely in low power. On the Prime, it seems that it at least still animates the hourglass at the top (which burns power, even if very little). And then after 60 seconds, it terminates.

Quote:
In programming apps, I have run into situations where I often think "Geez, I wish the calc did or did not do that."

1. When viewing the Plot view, we are always given an "error" if there are no equations entered and selected. So if I create an app in which I want to make custom graphs, the current state of apps is such that I have to start by copying the Function or Advanced Graphing app. If I then want to make use of the plot view, I will always have to deal with an error when no equations are entered and selected. Or, in my case, I have my users enter their functions, but they are not open sentences (in the case for Advanced Graphing) so that when I introduce the plot screen it barfs up an error about the user's function not being an open sentence.

2. Will we eventually be able to create apps without having to depend on existing apps? Or if we see bits and pieces of several apps we want to incorporate into our own app, this seems very tedious at best, and impossible at worst. I realize that certain parameters from one app can be used in another (e.g. MyApp.Variable1 can be used from MyApp even if I am running something else called YourApp). However, it does not seem that I am able to make use of a spreadsheet within an function-based app (at best I can mimic a spreadsheet with a matrix). App creation, at this point, seems very confined.

3. Is there anyway to have something similar to: << 0 WAIT >> on the HP48 in which the calc enters a low power state and "pauses" until woken up by input (either keyboard or "mouse"). The only way to get input is to force a continuous loop and constantly polling the keys and mouse. This seems like a big waste of battery power. (On the HP48, the calculator essentially "pauses" until a key is pressed when using << 0 WAIT >>)

Han


4. I would like to add another request: please enable an auto-indent feature in the program editor. Even better would be a global variable (INDENT perhaps?) that sets the number of spaces auto-indent inserts.

Hello,

You can override the action when plot is pressed by having a Plot()
begin
end;

function in your program so that, either you 'turn off' the view, or you can test if a function is there and send them to the symb view...


0 WAIT is as close as you get from the 48 0 WAIT... with 60s as a timeout...

cyrille

Quote:
Hello,

You can override the action when plot is pressed by having a Plot()
begin
end;

function in your program so that, either you 'turn off' the view, or you can test if a function is there and send them to the symb view...

0 WAIT is as close as you get from the 48 0 WAIT... with 60s as a timeout...

cyrille


Regarding Plot() begin end; -- this allows me to override the plot view but it does not let me use the default graphing view to make my own plots if the corresponding Symb view has no functions selected. To rephrase the question: is it possible to use STARTVIEW(1,1); -- without error messages -- in order to create custom graphs and at the same time not have any functions selected in the Symb view? For example, what would be equivalent to the following code on the HP48:

<<
{ #0h #0h } PVIEW
... code here that draws special graphs ...
0 FREEZE
>>

It seems my choices are limited to resizing a built-in graphic object (G1 through G9) and then copying them into G0.

As for the WAIT command, it seems extremely unfortunate that there is a timeout of 60 seconds. It would be nice if WAIT(0) not only went into low-power mode and waited indefinitely, but also accepted and return MOUSE input as well.

I would disagree here.

Essentially, you have everything a library allows in a normal Prime program.


A library:

allows hidden variables? check

allows hidden function? check

allows user visible variables? check

allows user visible functions? check

As far as I can tell, the only thing missing is the ability to give it a number for loading order...

Have I missed something?

TW

Then returns a -1 after 60. This is a low power state and is the same thing. However, it allows the calculator to power off by acting this way, as well as handle incoming IO and other things. That is the reason for the difference. On the 48 the poweroff and IO is handled in a totally different way that could be completely replicated.

Now as for the other part, we were thinking of extending WAIT so that you could selectively do either key only events, or also mouse events. (eg: WAIT(-1) would also send mouse events through). It seems preferable to me to allow the programmer to either accept, or disallow mouse events triggering the wait loop.

Thoughts?

TW

Why is it extremely unfortunate that there is a timeout? Please explain what issues or problems that causes.

TW

If one should ever design an app or program in which user input is needed (and what I have in mind is basically some routine that waits for the user to press a button or swipe the screen), the current implementation requires an indefinite loop, or a recursion resembling a loop:

if WAIT(0) returns no key pressed, do WAIT(0) again

The calculator is always running. Even a timeout of 60 seconds on WAIT does not help because we want to constantly poll keys and therefore must reissue the WAIT command.

On the HP48/HP49/HP50G

<< 0 WAIT "Something was pressed" >>

You will never see "Something was pressed" unless a key was pressed, including the [ON] key. The calc shuts off after a while if nothing was pressed. Upon turning it back on, it will continue at the WAIT command until you press a key. When the calculator is on, the old WAIT would enter low power mode even while the calcutor is on. The Prime does not seem to do this. This leads to a waste of battery power.

Edit: So when constantly polling for input, is the CPU running at normal speed, or is it in a low power state?


Edited: 30 Sept 2013, 12:46 p.m.

Libraries for the 50G you can build from scratch - - they can all be different. An app needs to follow the format provided by the apps built into the Prime (then it can be modified - - to a certain extent. Or maybe I'missing something.

Quote:
Then returns a -1 after 60. This is a low power state and is the same thing. However, it allows the calculator to power off by acting this way, as well as handle incoming IO and other things. That is the reason for the difference. On the 48 the poweroff and IO is handled in a totally different way that could be completely replicated.

Now as for the other part, we were thinking of extending WAIT so that you could selectively do either key only events, or also mouse events. (eg: WAIT(-1) would also send mouse events through). It seems preferable to me to allow the programmer to either accept, or disallow mouse events triggering the wait loop.

Thoughts?

TW


Thank you for the info on WAIT and its power usage. I am a bit unclear on what you mean by "it allows the calculator to power off by acting this way." Is my understanding correct in assuming that even if we have

REAPEAT key:=WAIT(0) UNTIL key>0;

it would still properly time out and turn itself off no keys are pressed within a 10 minute interval -- and pick up there after we turn it back on?

And I think WAIT(-1) or something similar to enable mouse polling would be great.

Edited: 30 Sept 2013, 10:03 p.m.

Quote:
Libraries for the 50G you can build from scratch - - they can all be different. An app needs to follow the format provided by the apps built into the Prime (then it can be modified - - to a certain extent. Or maybe I'missing something.

I've been wondering this myself -- will we eventually be able to build apps that

1) do not have to be based on any particular app (so there is no waste of space on unwanted parts of a particular app)

or

2) has _all_ the built-in apps as a "base." As mentioned earlier, I would ideally like to be able to use the symb view from the advanced graphing as well as the Num view of the spreadsheet (and even better would be the ability to edit the column names and row names). Right now my choice is to either copy the advanced graphing app as a base, or the spreadsheet as a base -- but not both.

Han

Quote:

4. I would like to add another request: please enable an auto-indent feature in the program editor. Even better would be a global variable (INDENT perhaps?) that sets the number of spaces auto-indent inserts.


Yet another feature that I would like to suggest:

5. In the program editor (and similarly any other editing environment), once the BEGIN and END menu buttons are selected, could we put a little dot next to the menu label to designate that the begin or end have already been selected? Also once a selection is made, it seems the only way to "delete" is to use CUT. The backspace and/or DEL key should just delete (possibly asking for confirmation if the block is large) if we are not interested in saving the deleted block for future pastes. Right now, it just leaves the selection as is and of course executes a backspace (or single character delete).

Edit: And since the screen is now in color, how about adding a secondary cursor for begin and end (maybe in blue for begin and red for end)?

Edit: 6. When using STO> from the menu (in the home screen, for example) or even via [SHIFT][EEX], the alpha annuniciator should be set (and set to alpha-lock, even). Variables must start with an alpha character, and it would save an extra keystroke (or two in the case of a multi-char variable).

Han


Edited: 30 Sept 2013, 4:14 p.m.

I am talking about a single program file - not an app. The ability to save an existing application, easily modify or extend it, was never something available in the 48 series.

Program files are also built from scratch.

TW

Edited: 30 Sept 2013, 4:01 p.m.

OK, now I understand you. Single program file is of course fine.

My comparison was strictly between Prime-style apps and libraries (50G style).

As an aside, what other methods are available in the Prime regarding solving methods for fsolve (apart from the bisection_solver; see help screen for fsolve)?

Thanks so much for any info you can provide!

I found it in the XCAS manual

http://www-fourier.ujf-grenoble.fr/~parisse/giac/cascmd_en.pdf

I guess that should cover the HP Prime CAS commands (and then some), correct?

Hello,

Quote:
1) do not have to be based on any particular app (so there is no waste of space on unwanted parts of a particular app)

The wasted space, if you extend from function is in the order of 500 bytes... so not much...

You can also create a program which is not an app extention BTW...

What is missing is the ability to use and extend build in environments (such a working and modifying an exiting view)... but honnestly, this is not something that you could do in the HP48 either... unless you were to program in system RPL and use some of the building blocks innards..


Quote:
REAPEAT key:=WAIT(0) UNTIL key>0;
it would still properly time out and turn itself off no keys are pressed within a 10 minute interval -- and pick up there after we turn it back on?

No, such a program would NOT timeout and would NOT auto off. so, even if the power use would be 'low' (~70mA), it would not dimm the LCD and not turn off, thus using the battery down..

Quote:
Regarding Plot() begin end; -- this allows me to override the plot view but it does not let me use the default graphing view to make my own plots if the corresponding Symb view has no functions selected. To rephrase the question: is it possible to use STARTVIEW(1,1); -- without error messages -- in order to create custom graphs and at the same time not have any functions selected in the Symb view? For example, what would be equivalent to the following code on the HP48:

There is no equivalent to the 48 draw(function) function. sorry.
You can programaticaly put somehting in F1 and then use setview(1,1) to draw it if you want...
or you can draw the graph yourself...

Cyrille

Thank you for the clarifications.

Quote:
No, such a program would NOT timeout and would NOT auto off. so, even if the power use would be 'low' (~70mA), it would not dimm the LCD and not turn off, thus using the battery down..

Cyrille


This is what I meant by "extremely unfortunate" because there is no way to continuously poll for input that also allows the calculator to timeout (turn off) without breaking the input polling. The way that I know to produce continuous polling would eventually drain the battery.

Hello,

Quote:
<<
{ #0h #0h } PVIEW
... code here that draws special graphs ...
0 FREEZE
>>

how about this?

Plot
begin
for A:=1 to 1000 do pixon_p(randint(320),randint(240),randint(#FFFFFF));
end;
wait(0);
end;

or

Plot
begin
for X:=Xmin to Xmax step (Xmax-Xmin)/320 do
pixon(X, sin(x),0);
end;
wait(0);
end;

Cyrille

Actually, one of your other recent posts addressed the issue for me. This snippet of code gives a some ideas on how to address getting input from users after the graph has been created.

Thanks!