Post Reply 
Application(App) anomolies and questions
12-26-2013, 05:41 PM
Post: #1
Application(App) anomolies and questions
This is a small App I created to familiarize myself with the operation of Apps. I used the Solve App as my template. The following is my code:
Code:

//Variables... 
DegF;Mph;wct;wcto;ft;

WindChillIntroDisplay();
InputPgm();
FrostBiteEqn();
WindChillEqn();
OutputPgm();

EXPORT WindChillApp()
BEGIN
END;

VIEW "Start Windchill",START()
BEGIN
LOCAL K;

REPEAT
STARTVIEW(-1,1);
WindChillIntroDisplay();
FREEZE;
REPEAT
WAIT(1);
GETKEY▶K;
UNTIL K>−1;

IF K==42 OR K==43 THEN
InputPgm(); 
END;

IF K==30 THEN
WindChillEqn();
FrostBiteEqn();
STARTVIEW(-1,1);
OutputPgm();
//FREEZE;
WAIT(0);
END;

UNTIL K==4;
MSGBOX("test1");
STARTVIEW(-4,0);
END;

WindChillIntroDisplay()
BEGIN
TEXTOUT("1: DegF= "+DegF,-15,9);
TEXTOUT("2: Mph= "+Mph,-15,7);
TEXTOUT("Enter: Calculate WindChill",-15,1);
TEXTOUT("Esc=Quit",-15,-1);
END;


InputPgm()
BEGIN
INPUT({DegF,Mph},"Input Values",{"DegF= :","Mph= :"},{"Air Temperature (-45 to 40 °F)","Wind Speed (3 to 60 Mph)"},{DegF,Mph});
END;


FrostBiteEqn()
BEGIN

//LOCAL tmp;
// Could not get the following equation
// to work properly
//­24.5*(.667*10*Mph*(8/5)+4.8)+2111▶tmp
//tmp*(­4.8-(DegF-32)*(5/9))^(­1.668)▶ft
//round(ft,0)▶ft

//Calculate frostbite time
CASE
IF DegF≤-45 AND Mph≥12 THEN 5▶ft END;
If DegF≤-45 and Mph≥0 Then 10▶ft END;
If DegF≤-40 and Mph≥14 Then 5▶ft END;
If DegF≤-40 and Mph≥0 Then 10▶ft END;
If DegF≤-35 and Mph≥17 Then 5▶ft END;
If DegF≤-35 and Mph≥7 Then 10▶ft END;
If DegF≤-35 and Mph≥0 Then 30▶ft END;
If DegF≤-30 and Mph≥21 Then 5▶ft END; 
If DegF≤-30 and Mph≥7 Then 10▶ft END;
If DegF≤-30 and Mph≥0 Then 30▶ft END;
If DegF≤-25 and Mph≥26 Then 5▶ft END;
If DegF≤-25 and Mph≥9 Then 10▶ft END;
If DegF≤-25 and Mph≥0 Then 30▶ft END;
If DegF≤-20 and Mph≥37 Then 5▶ft END;
If DegF≤-20 and Mph≥12 Then 10▶ft END;
If DegF≤-20 and Mph≥0 Then 30▶ft END;
If DegF≤-17 and Mph≥35 Then 5▶ft END;
If DegF≤-15 and Mph≥42 Then 5▶ft END;
If DegF≤-15 and Mph≥16 Then 10▶ft END;
If DegF≤-15 and Mph≥45 Then 30▶ft END;
If DegF≤-12 and Mph≥45 Then 5▶ft END;
If DegF≤-10 and Mph≥57 Then 5▶ft END;
If DegF≤-10 and Mph≥22 Then 10▶ft END;
If DegF≤-10 and Mph≥0 Then 30▶ft END;
If DegF≤-5 and Mph≥33 Then 10▶ft END;
If DegF≤-5 and Mph≥7 Then 30▶ft END;
If DegF≤-2 and Mph≥35 Then 10▶ft END;
If DegF≤0 and Mph≥54 Then 10▶ft END;
If DegF≤0 and Mph≥12 Then 30▶ft END;
If DegF≤2 and Mph≥55 Then 10▶ft END; 
If DegF≤2 and Mph≥15 Then 30▶ft END;
If DegF≤5 and Mph≥28 Then 30▶ft END;
If DegF≤7 and Mph≥30 Then 30▶ft END;
If DegF≤10 and Mph≥52 Then 30▶ft END;
If DegF≤12 and Mph≥55 Then 30▶ft END; 
" NOT LIKELY"▶ft;
END;
END;

WindChillEqn()
BEGIN
//New WindChill Equation
35.74+.6215*DegF−35.75*Mph^.16+.4275*DegF*Mph^.16▶wct;
round(wct,0)▶wct;

//Old WindChill Equation(Prior to 2001)
.0817*(3.71*Mph^.5+5.81-.25*Mph)*(DegF-91.4)+91.4▶wcto;
round(wcto,0)▶wcto;
END;


OutputPgm()
BEGIN
TEXTOUT("DegF= "+DegF,-15,9);
TEXTOUT("Mph= "+Mph,-15,7);
TEXTOUT("New WindChill= "+wct,-15,5);
TEXTOUT("Old WindChill= "+wcto,-15,3);
TEXTOUT("Frostbite,≤min "+ft,-15,1);
TEXTOUT("Enter=Back",-15,-1);
END;

Questions:
EXPORT WindChillApp()
BEGIN
END;
What is intended to go between the BEGIN and END?

//FREEZE;
WAIT(0);
If I uncomment FREEZE; and comment out WAIT(0); why does the program blow right through the FREEZE instruction?

MSGBOX("test1");
STARTVIEW(-4,0);
On exiting the App, If I comment out MSGBOX("test1"); why does the program blow right through the STARTVIEW(-4,0); instruction, if I use the "Start" soft menu on the emulator Application Library screen? Otherwise it operates the way I want it to.

Anomilies:
When saving the App from the connectivity kit to the emulator, why must I hit the save icon at least 2 times to get it to save my changes to the emulator?

Thanks for any information you can provide.
rcf
Find all posts by this user
Quote this message in a reply
09-01-2015, 06:02 AM
Post: #2
RE: Application(App) anomolies and questions
I'm not sure if this will help, but I read that FREEZE doesn't pause the program at that point like a WAIT. When the program ends, the screen remains visible.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
09-02-2015, 06:27 AM
Post: #3
RE: Application(App) anomolies and questions
Hello,

The purpose of the freeze instruction is to block the calculator from re-displaying the normal screen after evaluation of the program.
This is to be used if your program leave data/drawing/text ON the screen and you want to let the user see that data after the program ends rather than have it being overridden by the normal screen repaint.

Cyrille
Find all posts by this user
Quote this message in a reply
09-02-2015, 04:44 PM
Post: #4
RE: Application(App) anomolies and questions
(12-26-2013 05:41 PM)Bob Frazee Wrote:  EXPORT WindChillApp()
BEGIN
END;
What is intended to go between the BEGIN and END?

Nothing really. That is just an example of a function so you don't go in with an "empty" screen and not really know where you are. You can delete it.

Quote: blow right through the STARTVIEW(-4,0); instruction, if I use the "Start" soft menu on the emulator Application Library screen? Otherwise it operates the way

It actually has switched, but it has not triggered a draw yet. If you click the up key you'll see it appear. Change that 0 to a 1 to immediately perform a draw. It is very common that there is something you are displaying or showing and don't want the view to show quite yet.

Quote:When saving the App from the connectivity kit to the emulator, why must I hit the save icon at least 2 times to get it to save my changes to the emulator?

I wasn't able to see this one. Could you describe in detail your steps? Thanks.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
09-02-2015, 11:13 PM
Post: #5
RE: Application(App) anomolies and questions
Well, I thank you all for your replies, even though my original post was written over a year and a half ago. There has been at least 2 firmware updates since then, so some of the questions don't apply anymore.

This comment is directed to Tim's answer on the BEGIN END; under the EXPORT command.
Tim, if you cut and paste the code from the program listed at the beginning of the thread to either the virtual or real calculator, and comment out or delete the BEGIN END; the code will not run (or at least I haven't been able to get it to run), in either my virtual calculator or real calculator. Also, if I comment out BEGIN END: and the VIEW statement, the check program will show no errors, but the program will still not run. I'm sure Cyrille has said, in another thread, that those 2 instructions are not needed, and you have just said the same. Remember, this is an APP, not a Program. If it were a Program, I do not need that BEGIN END; So... maybe you can answer what was intended to go between those 2 instructions.
Thanks rcf
Find all posts by this user
Quote this message in a reply
09-03-2015, 02:22 PM
Post: #6
RE: Application(App) anomolies and questions
Wow, I did not realize someone had necro-posted at all. :-D

That default bit of text "EXPORT <appname>() BEGIN END;" is and was purely to put something there. It does require a begin/end block to establish the start and finish of the function. The intent really was to rename the function to something else if you wanted an exported function...

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)