HP Forums
Setting calculator's auto shutoff - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Setting calculator's auto shutoff (/thread-2815.html)



Setting calculator's auto shutoff - Thomas_Sch - 01-08-2015 04:27 PM

Setting calculator's auto shutoff, by Wolfgang

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.
Wolfgang

Slider-addon by Thomas.
- graphic display of value 'Toff'
- change 'Toff' by clicking in slider

Code:

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

SLIDER_INIT();
SLIDER_DRAW();

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
//
//   add-on: slider (version 0.01); Thomas; 150108 

BEGIN

  LOCAL m,m1,mx,my,TF, TMul;
  LOCAL TF0, xt;
  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);
  SLIDER_INIT(); 
  xt:=SLIDER_DRAW(TF, TF);

  // 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
        TF0:=TF;
    TF:=TF+1*TMul;
        IF TF>60 THEN TF:=60; END; 
    xt:=SLIDER_DRAW(TF, TF0);
        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
        TF0:=TF;
    TF:=TF-1*TMul;
        IF TF < 1 THEN TF:=1; END;
        xt:=SLIDER_DRAW(TF, TF0);
        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

    // slider?
    IF my>=101 AND my<=119 THEN
      IF mx>30 AND mx<300 THEN
        TF0:=TF; 
        TF:=1+IP((59.5*((mx-30)/270))); 
        xt:=SLIDER_DRAW(TF, TF0);
        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;
    END;   // slider

END;
END;

SLIDER_INIT()
BEGIN
  // box for slider, min, max 
  //   t odo: (global?) constants: 
  //    position (x,y), size (x,y), value(s)(min, max)
  RECT_P(G0, 28,100, 302,120, #0, #FFFFFF);
  TEXTOUT_P("1" , 20,105,2);
  TEXTOUT_P("60",304,105,2);
END;

SLIDER_DRAW(TF, TF0)
BEGIN
  // (re)draws slider.
  //   todo: constans! (see SLIDER_INIT)
  //   conversion of value(e) <--> position
  LOCAL xTF, xTF0, off, br;
  off:=2;
  br:=3;  // width of slider
  // x pos slider
  xTF  := IP( 32 + (((TF -0.99)/59) *266));
  xTF0 := IP( 32 + (((TF0-0.99)/59) *266));
  // redraw slider
  RECT_P(G0, (xTF0-3),101, (xTF0+3),119, #FFFFFF, #FFFFFF);
  RECT_P(G0, (xTF -3),101, (xTF +3),119, RGB(255,0,0), RGB(255,0,0));
  // value 
  off:=2;
  IF TF>9 THEN off:=5; END;
  RECT_P(G0, xTF0-5,123, xTF0+15,133, #FFFFFF, #FFFFFF);
  TEXTOUT_P(TF+" ",xTF-off,125,1);
  RETURN xTF;
END;



RE: Setting calculator's auto shutoff - Wolfgang - 09-12-2016 03:13 PM

Here's an further version without slider action going with FW 10637:


Code:



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

EXPORT TOFF()
// Firmware 6975 // 10637
// integer systems settings are not recommended
// Number Format: Standard
// Setting the auto shutoff system-variable TOff
// limits are set between 1 minute and 1 hour
// 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
// ***** new   ***************
// ***** new   ***************
// WMWK 2016-09-12 Version 1.0
// Firmware 10637 killroyed
// steps of 0.5, 1, 2, 5, 15, 30, 60 minutes
// limits extended to 1 day / 1440 mins
// instant adjusting TOff to standard 5 minutes via 6th Softkey 
// wolfgang.kuehn@vodafone.de

BEGIN

  LOCAL m,m1,mx,my,TF, TMul;
  RECT();
 
  //TF = readout actual 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 6 buttons
  DRAWMENU("TOff +","TOff -","SET","TOff *","BYE", "5M&Go");
  //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>1440 THEN TF:=1440; 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:=15;END;
            IF TMul=15 THEN TMul:=30;END;                    
            IF TMul=30 THEN TMul:=60;END;
            IF TMul=60 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;
  // menu button 5
       IF mx>=265 AND mx<=319 THEN
          TOff:=#493E0h;     
          RETURN;
       END;
// inner loop
  END;
// outer loop
END;
END;
[/quote]