Post Reply 
G1 problem with WAIT in latest firmware
07-29-2021, 07:53 PM
Post: #1
G1 problem with WAIT in latest firmware
I am finding that the WAIT command on G1 is problematic with the latest 2021 firmware, reproduced on multiple calculators. No problems on G2 or emulators.

Here's an example program, what it should do is clear the screen, then instruct user to press a key on the keyboard. Once a key is pressed, the key code is displayed for half a second and then screen is cleared again while waiting for next key press. On the G1, the WAIT(-1) is not working properly. It returns -1 immediately on subsequent calls (after the first successful run).

Should be easy to reproduce. This breaks every UI routine that relies on WAIT(-1). Anyone else found this and either have a workaround or has reported it?

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

EXPORT TEST()
BEGIN
  LOCAL m:=0;
  RECT_P();
  TEXTOUT_P("Press a key, ENTER to exit",G0,0,0);
  REPEAT
    RECT_P(G0,0,50,200,70);
    REPEAT
      m:=WAIT(-1);
    UNTIL TYPE(m)==0;
    TEXTOUT_P("Key " + STRING(m) + " was pressed",G0,0,50);
    WAIT(0.5);
  UNTIL m==30;
END;
Visit this user's website Find all posts by this user
Quote this message in a reply
07-30-2021, 01:29 AM (This post was last modified: 07-30-2021 01:52 AM by Jacob Wall.)
Post: #2
RE: G1 problem with WAIT in latest firmware
Does someone have a copy of previous firmware for G1? Looks like only latest version is available on hpcalc.org. I'm thinking that's probably the only realistic solution, to downgrade.

EDIT: Found it here https://www.educalc.net/2336439.page

EDIT 2: Downgrade of course solves the issue
Visit this user's website Find all posts by this user
Quote this message in a reply
07-30-2021, 02:05 PM
Post: #3
RE: G1 problem with WAIT in latest firmware
All old firmware versions are available on my site, just you have to log in first to see them.
Visit this user's website Find all posts by this user
Quote this message in a reply
07-30-2021, 11:22 PM
Post: #4
RE: G1 problem with WAIT in latest firmware
(07-30-2021 02:05 PM)Eric Rechlin Wrote:  All old firmware versions are available on my site, just you have to log in first to see them.

Good to know, thanks!
Visit this user's website Find all posts by this user
Quote this message in a reply
08-06-2021, 06:44 AM (This post was last modified: 08-06-2021 11:21 PM by Gene222.)
Post: #5
RE: G1 problem with WAIT in latest firmware
(07-29-2021 07:53 PM)Jacob Wall Wrote:  On the G1, the WAIT(-1) is not working properly. It returns -1 immediately on subsequent calls (after the first successful run).

Should be easy to reproduce. This breaks every UI routine that relies on WAIT(-1). Anyone else found this and either have a workaround or has reported it?

WAIT(-1) works on my G1 hardware A calculator. WAIT(-1) will pause for 60 seconds, so the second loop is not needed. Review the help on WAIT. You need to address the three return actions, a key press, mouse tap, and timeout.

Code:
EXPORT TEST()
BEGIN
  LOCAL m=0;
  REPEAT
    RECT_P();
    TEXTOUT_P("Press a key, Esc to exit",G0,0,0);
    m:=WAIT(-1);
    IF TYPE(m)==0 THEN
      IF m==-1 THEN
        BREAK 1;
      ELSE
        TEXTOUT_P("Key " + m + " was pressed",G0,0,50);
        WAIT(0.7);
      END;
    ELSE
      TEXTOUT_P("Screen " + m + " was tapped",G0,0,50);
      WAIT(0.7);
      m:=0;
    END;
  UNTIL m==4;
END;

The above code was tapped out on my phone. So, there maybe some typos. EDIT. Corrected some typos.

EDIT. The mouse tap is kind of weird, because it returns three sets of information. This allows for gestures, such as a slide to the right.
Find all posts by this user
Quote this message in a reply
08-06-2021, 05:46 PM
Post: #6
RE: G1 problem with WAIT in latest firmware
Hmmm. I thought I got the previous code to work on the physical calculator, but I can't get it to work anymore. It works on the virtual G1. I guess the OP was right.
Find all posts by this user
Quote this message in a reply
08-06-2021, 11:36 PM
Post: #7
RE: G1 problem with WAIT in latest firmware
I corrected a bad argument error in the above code, but the program still does not work on the physical calculator. The problem is that the WAIT statement is not pausing execution and is not waiting for a key press or screen tap on version 2021-05-05.

The connectivity kit and virtual calculator are both running version 2021-06-09, but the physical calculator is running version 2021-05-05. So, the real problem is that the physical calculator is not being updated to 2021-06-09.
Find all posts by this user
Quote this message in a reply
08-08-2021, 06:03 PM (This post was last modified: 08-22-2021 07:56 PM by Gene222.)
Post: #8
RE: G1 problem with WAIT in latest firmware
I was not able to downgrade the hardware A physical calculator to version 2020-01-16. Oh well.

Below is the test program I used for WAIT(-1). It is not very good, as I don't understand how to handle time dependent variables.

When tapping the screen, the screen handler captures the first data set, and prints it. The program moves on to the menu handler procedures, but the system is still returning the screen tap data. I had to add a third test condition, datMK(3) greater than 220, to avoid capturing the screen tap data.

Code:
// 8/22/2021
EXPORT WaitTest2improved()
BEGIN
  LOCAL dynMK=0, LoopExit;
  REPEAT
    LoopExit := 0;
    dynMK := 0;
    RECT_P();
    DRAWMENU("tab1", "tab2", "tab3", "tab4", "", "exit");
    TEXTOUT_P("Press a red button, app key or menu tab.",G0,0,0);
    RECT_P(G0, 10, 80, 40, 100, RGB(196,0,0));
    RECT_P(G0, 10, 110, 40, 130, RGB(196,0,0));
    dynMK := WAIT(-1);
    dynMK := B→R(dynMK);
    CASE
      // Timeout event
      IF TYPE(dynMK)==0 AND dynMK==-1 THEN
        BREAK 1;
      END;
      // Key event
      IF TYPE(dynMK)==0 THEN
        CASE
          IF dynMK==4 THEN //Exc key
            BREAK 1;
          END
          IF dynMK==1 THEN //Symb key
            TEXTOUT_P("Symb key press",G0,170,110);
            TEXTOUT_P(dynMK,G0,170,130);
          END
          IF dynMK==6 THEN //Plot key
            TEXTOUT_P("Plot key press",G0,170,110);
            TEXTOUT_P(dynMK,G0,170,130);
          END
          IF dynMK==11 THEN //Num key
            TEXTOUT_P("Num key press",G0,170,110);
            TEXTOUT_P(dynMK,G0,170,130);
          END
          IF dynMK==9 THEN //View key
            TEXTOUT_P("View key press",G0,170,110);
            TEXTOUT_P(dynMK,G0,170,130);
          END
          IF dynMK==13 THEN //Menu key
            TEXTOUT_P("Menu key press",G0,170,110);
            TEXTOUT_P(dynMK,G0,170,130);
          END
        END; //case
      END;
      // Mouse Down event in screen area
      IF TYPE(dynMK)==6 AND dynMK[1]==0 AND dynMK[3]<219 THEN
        CASE
          // button 1
          IF 10<dynMK[2]<40 AND 80<dynMK[3]<100 THEN
            TEXTOUT_P("button 1 press",G0,60,90);
            TEXTOUT_P(dynMK,G0,60,110);
          END
          // button 2
          IF 10<dynMK[2]<40 AND 110<dynMK[3]<130 THEN
            TEXTOUT_P("button 2 press",G0,60,90);
            TEXTOUT_P(dynMK,G0,60,110);
          END
        END; //case
      END;
      // Mouse Click event in menu area
      IF TYPE(dynMK)==6 AND dynMK[1]==3 AND dynMK[3]>219 THEN
        CASE
          IF dynMK[2]<52 THEN
            TEXTOUT_P("menu tab 1 press",G0,40,150);
            TEXTOUT_P(dynMK,G0,40,170);
          END
          IF 52<dynMK[2]<105 THEN
            TEXTOUT_P("menu tab 2 press",G0,40,150);
            TEXTOUT_P(dynMK,G0,40,170);
          END
          IF 105<dynMK[2]<158 THEN
            TEXTOUT_P("menu tab 3 press",G0,40,150);
            TEXTOUT_P(dynMK,G0,40,170);
          END
          IF 158<dynMK[2]<211 THEN
            TEXTOUT_P("menu tab 4 press",G0,40,150);
            TEXTOUT_P(dynMK,G0,40,170);
          END
          IF 211<dynMK[2]<264 THEN
            //TEXTOUT_P("menu tab 5 press",G0,40,150);
            //TEXTOUT_P(dynMK,G0,40,170);
          END
          IF 264<dynMK[2]<=319 THEN
            BREAK 1;
            //TEXTOUT_P("menu tab 6 press",G0,40,150);
            //TEXTOUT_P(dynMK,G0,40,170);
          END
        END; //case
      END;
    END; //case
    WAIT(.7);
  UNTIL LoopExit=1;
END;

8/22/21. Corrected case statement to the newer format. Also, removed default statement. Corrected tab coordinates.
Find all posts by this user
Quote this message in a reply
08-09-2021, 03:38 AM
Post: #9
RE: G1 problem with WAIT in latest firmware
My program was intentionally short and limited to clearly illustrate the failure of WAIT in the latest firmware for G1. I don't expect this to be fixed any time soon, just surprised nobody else has complained about it.

Procedure to downgrade:
1. Download the previous firmware files from hpcalc.org (must be logged in)
2. Open the folder at C:\Users\USERNAME\Documents\HP Connectivity Kit\Firmware\PrimeG1
3. Delete everything from that folder
4. Copy the contents of the ZIP folder downloaded in Step 1 to this folder
5. Start Connectivity Kit
6. Plug in USB to calculator
7. In Connectivity Kit, right-click on your calculator’s name
8. Choose ‘Update Firmware’
9. The firmware is installed
Visit this user's website Find all posts by this user
Quote this message in a reply
06-06-2022, 01:51 PM
Post: #10
RE: G1 problem with WAIT in latest firmware
In fact, this bug is creating issues with CSTMENU that took some time to be discovered:
https://www.hpmuseum.org/forum/thread-16...#pid160951

Ramón
Valladolid, Spain
TI-50, Casio fx-180P, HP48GX, HP50g, HP Prime G2
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: