HP Forums

Full Version: Setting calculator's auto shutoff
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Since FW 6940 there is the system variable TOff setting auto shutoff.
For further information please take a look at prime's help.

Attachment:
Program setting the auto shutoff.

My special comment to Fw 6975: Wonderful!

Thx to the development team.
(01-05-2015 07:51 PM)Wolfgang Wrote: [ -> ]Since FW 6940 there is the system variable TOff setting auto shutoff.
For further information please take a look at prime's help.

Attachment:
Program setting the auto shutoff.

Thanks, Wolfgang!

Tom L
(01-05-2015 07:51 PM)Wolfgang Wrote: [ -> ]Since FW 6940 there is the system variable TOff setting auto shutoff.
For further information please take a look at prime's help.

Attachment:
Program setting the auto shutoff.

My special comment to Fw 6975: Wonderful!

Thx to the development team.

When copying the source text, I get some invalid characters in the first line below the initial comment that begins //TF = readout catual...
Line 21 just below reads:
TF:=(B→R(TOff)/60000); (cannot paste exact same chars here)

These errors prevent compilation (using Emu).

The same invalid chars are in lines 21, 26
There are also similar invalid chars in lines 30, 32, 60, 61, 69, 70, 74

I presume this is some sort of language issue, but I've no idea from context what those chars should be.
(01-06-2015 01:06 AM)rprosperi Wrote: [ -> ]When copying the source text, I get some invalid characters in the first line below the initial comment that begins //TF = readout catual...
Line 21 just below reads:
TF:=(B→R(TOff)/60000); (cannot paste exact same chars here)

Replace every B???R with B→R, and every R???B with R→B. Somehow the "→" (right arrow) character got replaced with its three-character code. In CAS, type asc("→") (asc must be lowercase!) to see these three numbers.
(01-06-2015 01:06 AM)rprosperi Wrote: [ -> ]When copying the source text, I get some invalid characters in the first line below the initial comment that begins //TF = readout catual...
Line 21 just below reads:
TF:=(B→R(TOff)/60000); (cannot paste exact same chars here)
...
The source code file is (should be) encoded in UTF-8.
Please try to change the encoding in your editor before copying.

Maybe Wolfgang can provide the source in a code block.

Thomas
Code:

#pragma mode( separator(.,;) integer(h32) )

EXPORT TOFF()
// Firmware 6975
// integer systems settings are not recommended
// Number Format: Standard
// Setting the auto shutoff system-variable TOff
// limits are set between 1 minute and 60 minutes
// Softmenu with 5 soft buttons
// selectable increment and decrement steps 
// steps of 1, 2, 5, 0.5 minutes
// WMWK 2015-01-05 Versin 0.97
// wolfgang.kuehn@vodafone.de

BEGIN

  LOCAL m,m1,mx,my,TF, TMul;
  RECT();
 
  //TF = readout catual TOff in minutes 
  TF:=(B→R(TOff)/60000);
  TEXTOUT_P("Setting Calculator's auto shutoff V 0.97",26,1,3);
  TEXTOUT_P("TOFF = ",26,50,2);
  // actual TOff
  // actual TOff in minutes
  TEXTOUT_P(B→R(TOff)/60000,65,50,2);
  TEXTOUT_P("min", 95,50,2);
  //actual TOff hex
  // 
  TEXTOUT_P(R→B(TF*60000,32,4)+"    ",139,50,2,#000000,100,#FFFFFF);
  //actual TOff decimal
  TEXTOUT_P(R→B(TF*60000,32,3)+"    ",229,50,2,#000000,100,#FFFFFF);

  // Softmenu 5 buttons
  DRAWMENU("TOff +","TOff -","SET","TOff *","BYE");
  //Multiplier incr / decr
   TMul:=1;
     
//outer loop 
While Z <= 9999 DO
 WHILE MOUSE(1)>=0 DO   END;
//inner loop
    REPEAT
      m:=MOUSE;
      m1:=m(1);
    UNTIL SIZE(m1)>0;
      
    mx:=m1(1);
    my:=m1(2);

    // query softbuttons
    IF my>=220 AND my<=239 THEN

    // menu button 1
      IF mx>=0 AND mx<=51 THEN
        TF:=TF+1*TMul;
        IF TF>60 THEN TF:=60; END; 

        TEXTOUT_P(TF+"   ",65,50,2,#000000,30,#FFFFFF);
        TEXTOUT_P(R→B(TF*60000,32,4)+"    ",139,50,2,#000000,140,#FFFFFF);
        TEXTOUT_P(R→B(TF*60000,32,3)+"    ",229,50,2,#000000,100,#FFFFFF);
      END;
      // menu button 2
      IF mx>=53 AND mx<=104 THEN
        TF:=TF-1*TMul;
        IF TF < 1 THEN TF:=1; END;

        TEXTOUT_P(TF+"   ",65,50,2,#000000,30,#FFFFFF);
        TEXTOUT_P(R→B(TF*60000,32,4)+"    ",139,50,2,#000000,140,#FFFFFF);
        TEXTOUT_P(R→B(TF*60000,32,3)+"    ",229,50,2,#000000,100,#FFFFFF);
      END;
       // menu button 3
      IF mx>=106 AND mx<=157 THEN
        TOff:=R→B(TF*60000);
        TEXTOUT_P("TOff set",112,205,1,#000000,50,#FFFFFF);
      END;     
       // menu button 4
       IF mx>=159 AND mx<=210 THEN
            CASE
                    IF TMul=1 THEN TMul:=2;END;
                    IF TMul=2 THEN TMul:=5;END;
                    IF TMul=5 THEN TMul:=0.5;END;
                    IF TMul=0.5 THEN TMul:=1;END;
             END;

                    TEXTOUT_P("TMul = "+TMul+"    ", 164,205,1,#000000,50,#FFFFFF);

      END;

        // menu button 5
       IF mx>=212 AND mx<=263 THEN
        RETURN;
      END;
// inner loop
  END;
// outer loop
END;
END;
Strange,
i just copied the Txt content, pasted in the Emu and worked flawlessly. I didn't have to type the B->R commands myself.

Very nice program. I totally skipped this command with the last firmware.

Nice finding,

Giancarlo
Hello,

just a hint: since binaries get automatically converted to reals when used in real number operations, one may omit the explicit conversion, e.g.
B→R(TOff)/60000 = TOff/60000
B→R(#123h) = 1*#123h = 0+#123h

Greetings

P.S. that holds for rev. 6975 but may change eventually (don't know if it's officially documented behaviour)
(01-06-2015 11:02 AM)Snorre Wrote: [ -> ]P.S. that holds for rev. 6975 but may change eventually (don't know if it's officially documented behaviour)

That will always stay the same. Basically, there is an internal GetReal function used everywhere that will pull out a valid real from an integer, real, packed real, or complex with a 0 component in the second part.
I've added a simple graphical display to the code. (Wolfgang knows that already..)

Hints and tips are welcome.
Is there already a "construction kit" for slideres etc., so I do not reinvent the wheel?

Code moved to http://www.hpmuseum.org/forum/thread-2815.html

Thomas
(01-08-2015 08:33 AM)Thomas_Sch Wrote: [ -> ]I've added a simple graphical display to the code. (Wolfgang knows that already..)

Hints and tips are welcome.
Is there already a "construction kit" for slideres etc., so I do not reinvent the wheel?

What's the little artifact after whole numbers when the multiplier is 0.5?

Tom Lake
Thanks for testing,
I'm deleting the old text previous to re-drawing.
The box was to small. Please replace
Code:
  RECT_P(G0, xTF0-5,123, xTF0+13,133, #FFFFFF, #FFFFFF);
with
Code:
  RECT_P(G0, xTF0-5,123, xTF0+16,133, #FFFFFF, #FFFFFF);
(4th line counting from end of program).
Hello,

Nice work, coders.
You should post this program to the HP Prime Software Library, so it doesn't get lost on page 2ff eventually.

Greetings
(01-08-2015 01:23 PM)Thomas_Sch Wrote: [ -> ]Thanks for testing,
I'm deleting the old text previous to re-drawing.
The box was to small. Please replace
Code:
  RECT_P(G0, xTF0-5,123, xTF0+13,133, #FFFFFF, #FFFFFF);
with
Code:
  RECT_P(G0, xTF0-5,123, xTF0+16,133, #FFFFFF, #FFFFFF);
(4th line counting from end of program).

Thanks for that!
How about adding the ability to drag the slider?
(Some people are NEVER satisfied!)

Tom L
(01-08-2015 06:42 PM)toml_12953 Wrote: [ -> ]..
How about adding the ability to drag the slider?
(Some people are NEVER satisfied!)
Tom L
You are not alone ...
At the moment you can "click" within the box changing the value, but a real slider would be fine.
I'm thinking about it, therefor my questions regarding a toolbox.
@ All:

Thank you very much for notes, hints and help!

Is there any (in-)official documentation about HP PPL explaining the Prime's touch?

e.g. tapping and holding down == for incrementing or decrementing

I want to use touch gestures in further programs, if reasonable.


Greetings
Wolfgang
look at Hans Graph3D app. There he as implemented some touch support (zoom). Maybe in his source you can find some info.

I think, in this Forum there was a thread about retrieving mouse inputs with the wait command. Maybe in the "brakout" game could be some Information too.

[EDIT]Take a look at this[/EDIT]

reagards Wolfgang
@ww63

Thanks for your information.

Is there any official guide relating to 'programming around the touch' in progress?


Wolfgang
I can post a short article later this evening on what I have learned about MOUSE() and WAIT(-1) if that will help.
@ Han: That would be wunderbar! :-)

Thanks a lot!
Reference URL's