Post Reply 
Time and Battery Indicators
10-22-2017, 09:30 PM
Post: #1
Time and Battery Indicators
I created a completely custom INPUT replacement for a project I'm working on. The purpose is to allow mixed input types to be displayed nicely, like in the attached screen capture for example.

Is anyone aware of a call to show current time, battery, and angle indicators in the header? For that matter, also the Alpha and Shift indicators? I can make my own of course, but wondered if this was already available? If not available, is it a worthy feature request?

Thanks.

   
Visit this user's website Find all posts by this user
Quote this message in a reply
10-22-2017, 10:04 PM
Post: #2
RE: Time and Battery Indicators
There might be some settings variables that might have some of that. I know that the battery level is not available that way. However, a while back I wrote a function to get that from the screen icon...here..
http://www.hpmuseum.org/forum/thread-8610.html
Find all posts by this user
Quote this message in a reply
10-23-2017, 01:43 PM
Post: #3
RE: Time and Battery Indicators
Hello,

Nope, sorry :-(

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
10-24-2017, 05:45 AM
Post: #4
RE: Time and Battery Indicators
(10-23-2017 01:43 PM)cyrille de brébisson Wrote:  Hello,

Nope, sorry :-(

Cyrille

Ok thanks for the confirmation. I'll add my own indicator graphics as best as is possible with the available options.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-24-2017, 09:31 AM
Post: #5
RE: Time and Battery Indicators
You can get them by looking at the pixels set in the graphics and store them in global variables and then redraw them using the values gleaned. Look at the battery value I mentioned in a previous post on this thread.
Find all posts by this user
Quote this message in a reply
10-25-2017, 02:47 AM
Post: #6
RE: Time and Battery Indicators
(10-24-2017 09:31 AM)webmasterpdx Wrote:  You can get them by looking at the pixels set in the graphics and store them in global variables and then redraw them using the values gleaned. Look at the battery value I mentioned in a previous post on this thread.

Thanks, yeah I saw the previous example of obtaining the battery level by pixels, however for my purposes it isn't really suitable. At first what I did was simply "paint over" the default header and not touch the battery & time graphic area, which is probably fine for short use, but the application I'm working on could potentially be run for extended periods (hours) without exiting. I would have to periodically call a dummy command for a brief fraction of a second that would repaint the default header to update the information to make it current, which is what I wanted to avoid. The 50g had annunciator display commands that I was thinking of, different scope for those of course since they were not part of the main display area, completely different logic for modes too, etc.

This falls into the "nice to have" category but certainly not critical, but I still think it would be handy to have commands that would just draw over top of whatever is on G0 the desired info in the header area.

FYI, in case anyone is interested, this is what I used to draw over top of the default header:
Code:
  // IF B→R(Theme(1))==1 THEN
  //   LINE_P(G0,0,1,270,1,RGB(41,99,165));
  //   LINE_P(G0,0,2,270,2,RGB(41,90,156));
  //   RECT_P(G0,0,3,270,6,RGB(41,82,148));
  //   RECT_P(G0,0,7,270,10,RGB(41,82,156));
  //   RECT_P(G0,0,11,270,13,RGB(33,90,165));
  //   RECT_P(G0,0,14,270,15,RGB(33,90,173));
  //   LINE_P(G0,0,16,270,16,RGB(33,90,181));
  // ELSE
  //   RECT_P(G0,0,1,270,6,RGB(57,57,57));
  //   RECT_P(G0,0,7,270,9,RGB(66,66,66));
  //   RECT_P(G0,0,10,270,11,RGB(74,74,74));
  //   RECT_P(G0,0,12,270,14,RGB(82,82,82));
  //   LINE_P(G0,0,15,270,15,RGB(90,90,90));
  //   LINE_P(G0,0,16,270,16,RGB(107,107,107));
  // END;
Visit this user's website Find all posts by this user
Quote this message in a reply
10-25-2017, 05:33 AM
Post: #7
RE: Time and Battery Indicators
Well, I do know that you can run an app and there are system timer functions that run regardless. e.g. The LCD refresh and getting the battery value. Now, I just checked and ran a program that takes a time. It doesn't update the clock on the display, but it takes the time to display an animated hourglass in the top right (makes no sense that it'd do one and not the other). I'll ask the HP guys and see what they say.
It might be possible to direct your output to one grob and have the system output to another grob. I'll let you know what I find out.
Find all posts by this user
Quote this message in a reply
10-25-2017, 06:11 AM (This post was last modified: 10-25-2017 06:26 AM by webmasterpdx.)
Post: #8
RE: Time and Battery Indicators
Jacob, you can get the Time from the system variable called Time (case matters)...this is in CAS mode.
Get the time value and the value to the left of the decimal point is the hour (24 hour clock).
Then, subtract the hour and multiply by 60 to get the minute left of decimal point. Then subtract the minute from that and multiply by 60 to get the seconds (round to nearest by adding 0.5 and getting integer of).
e.g.

Time 23.0669444444 11PM

Ans-23 0.0669444444

Ans*60 4.016666664 11:04 PM

Ans-4 0.016666663997

Ans*60 0.99999983 11:04:01 PM (1 second)

In Home mode, Time is returned using degree-minute-second mode, except degrees is hours. You can access the CAS Time by using CAS.Time

Note that I tried a program running and Time is updated while running.
Find all posts by this user
Quote this message in a reply
10-25-2017, 05:38 PM
Post: #9
RE: Time and Battery Indicators
I was aware of the Time variable and had that part, and a date display, updating with these little programs to create the strings to display. I had not yet discovered CAS.Time, thanks for that, I saved a conversion as a result.

Code:
// return 12 hour string of current time
TimeString()
BEGIN
  LOCAL h,m,dtime:=CAS.Time;
  h:=IP(dtime) MOD 12;
  m:=IP(FP(dtime)*60);
  RETURN(STRING(h,1,0)+":"+IFTE(m<10,"0","")+STRING(m,1,0)+IFTE(dtime>12,"PM","AM"));
END;

// convert the internal value for Date to a date string in the format MMM DD
DateString()
BEGIN
  LOCAL date_val:=Date,year,month,day,month_list:={"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"};
  year:=IP(date_val);
  month:=IP((date_val-year)*100);
  day:=FP(FP(date_val)*100)*100;
  RETURN(month_list(month)+" "+STRING(day,1,0));
END;
Visit this user's website Find all posts by this user
Quote this message in a reply
10-25-2017, 06:02 PM
Post: #10
RE: Time and Battery Indicators
Just call HMS-> on the time if you want to turn that off.

LOCAL h,m,dtime:=HMS→(Time);

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
10-25-2017, 06:46 PM
Post: #11
RE: Time and Battery Indicators
(10-25-2017 06:02 PM)Tim Wessman Wrote:  Just call HMS-> on the time if you want to turn that off.

LOCAL h,m,dtime:=HMS→(Time);

I take it that you are implying that HMS→(Time) is actually faster/preferred to CAS.Time? That was the way I was doing it before I found out CAS.Time was an option.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-25-2017, 07:03 PM (This post was last modified: 10-25-2017 07:06 PM by Tim Wessman.)
Post: #12
RE: Time and Battery Indicators
Yes, it will be the fastest. HMS-> and ->HMS do nothing but flip a bit that is handled by display/calculations on the BCD encoded HP real.

The other one, it will pass the variable by name to the CAS, which then will end up calling the same exact getter code for "Time", call some conversion code to convert the BCD code HP real to a decimal double, then return back the decimal double which runs back through the converter to turn it back into a BCD encoded HP real value. So yeah, not too efficient. Smile

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
10-25-2017, 09:42 PM
Post: #13
RE: Time and Battery Indicators
I noticed that a USB plug-in incident on the physical calculator causes the top right of the screen to be repainted, approximately 38px by 20px. Now if we could make that happen from a program Smile
Visit this user's website Find all posts by this user
Quote this message in a reply
10-26-2017, 06:26 AM
Post: #14
RE: Time and Battery Indicators
The variable HAngle (Settings variable) will tell you the angle mode, so all you need now is the battery value or a way to get it to update the screen while running a program, so you can figure out the value.
Find all posts by this user
Quote this message in a reply
Post Reply 




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