Announcement

Collapse
No announcement yet.

32PTU + visigenie readind current form

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 32PTU + visigenie readind current form

    Hi, picked a few of these dirt cheap and playing about.

    I have 5 forms (one is a splash) the other 4 each have the exact same 5 buttons along the bottom to navigate between screen options.
    I read from the 32ptu the switch selectively, but I noted in visigenie there is an option to assign a form to a button, making that happen on the 32tpu end of things, this will save me a LOT of switch work if I can figure out how to read from the display, what the current form is in arduino?

    i can get rid of most of this nonsense..

    Code:
    void checkScreen() {
    genieFrame Event;
    genie.DequeueEvent(&Event);
    if (Event.reportObject.cmd == GENIE_REPORT_EVENT) {
    if (Event.reportObject.object == GENIE_OBJ_WINBUTTON) {
    int pressed = (int)Event.reportObject.index;
    switch (pressed) {
    case 0: case 5: case 10: case 15: case 20: SetForm(0); break;
    case 1: case 6: case 11: case 16: case 21: SetForm(1); break;
    case 2: case 7: case 12: case 17: case 22: SetForm(2); break;
    case 3: case 8: case 13: case 18: case 23: SetForm(3); break;
    case 4: case 9: case 14: case 19: case 24: SetForm(4); break;
    case 25: record = true; break;
    case 26: record = false; break;
    case 27: leanMax = 0; break;
    case 28: speedMax = 0; break;
    case 29: DebugGPS; break;
    case 30: DebugKML; break;
    }
    }
    }
    }
    void SetForm(int form) {
    currentForm = form;
    genie.WriteObject(GENIE_OBJ_FORM, form, 0);
    }

    secondly, I have a splash loading screen, using a text over a bitmap, text property is set to transparent in visigenie, and displays correctly in visigenie, but on the actual screen background is black.. can that be fixed by a setting in visigenie?

    Click image for larger version  Name:	0.jpg Views:	1 Size:	29.6 KB ID:	63493 Click image for larger version  Name:	3.jpg Views:	1 Size:	39.8 KB ID:	63494 Click image for larger version  Name:	1.jpg Views:	1 Size:	36.4 KB ID:	63495 Click image for larger version  Name:	2.jpg Views:	1 Size:	32.8 KB ID:	63496 Click image for larger version  Name:	trans.JPG Views:	1 Size:	79.5 KB ID:	63497
    Last edited by CeeBee; 15th May 2018, 09:16 AM.

  • #2
    apologies cant upload more attachments on last post, from visie genie end I set the buttons as follows, which I assumed will work even if not actually connected to the arduino (the screen reads like the message sent will be that this screen selected was activated, and that visie genie would handle the code internally to do that, but it does not handle the screen change internally at all in pressing the buttons. any clues? Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	51.7 KB
ID:	63499

    Comment


    • #3
      apolgies, self resolved...getting old, I never actually uploaded the new code to the screen...

      for anyone else that follows thread, this works better than trying what I tried before.

      Code:
      void checkScreen() {
        genieFrame Event;
        genie.DequeueEvent(&Event);
        if (Event.reportObject.cmd == GENIE_REPORT_EVENT) {
          if (Event.reportObject.object == GENIE_OBJ_FORM) {
            currentForm = (int)Event.reportObject.index;
          }
          if (Event.reportObject.object == GENIE_OBJ_WINBUTTON) {
            int pressed = (int)Event.reportObject.index;
            switch (pressed) {
              case 25: record = true; break;
              case 26: record = false; break;
              case 27: leanMax = 0; break;
              case 28: speedMax = 0; break;
            }
          }
        }
      }

      Comment


      • #4
        PS. another tip for free, if you are using uno or nano with this, you are forced into a software serial library if you are also using something else that needs serial (putting gps on software serial is a crapshoot), and you are setting up interrupts on pins to take readings from sensors..

        I tested the built in softwareserial, neosoftwareserial, both gave me garbage characters at the high rate i was trying to read at if they occurred on an interrupt , and forced me into messy code to error check, and restart serial on a port after a fluch, which slowed things down dramatically,

        but I can highly recommend the AltSoftwareSerial, it can only use specific pins depending on your board, but all my serial issues stopped once I switched to it.
        LINK: https://github.com/PaulStoffregen/AltSoftSerial
        (even if not using interrupts, it seems to work better)

        Comment


        • #5
          Originally posted by CeeBee View Post
          Hi, picked a few of these dirt cheap and playing about.

          I have 5 forms (one is a splash) the other 4 each have the exact same 5 buttons along the bottom to navigate between screen options.
          I read from the 32ptu the switch selectively, but I noted in visigenie there is an option to assign a form to a button, making that happen on the 32tpu end of things, this will save me a LOT of switch work if I can figure out how to read from the display, what the current form is in arduino?

          i can get rid of most of this nonsense..

          Code:
          void checkScreen() {
          genieFrame Event;
          genie.DequeueEvent(&Event);
          if (Event.reportObject.cmd == GENIE_REPORT_EVENT) {
          if (Event.reportObject.object == GENIE_OBJ_WINBUTTON) {
          int pressed = (int)Event.reportObject.index;
          switch (pressed) {
          case 0: case 5: case 10: case 15: case 20: SetForm(0); break;
          case 1: case 6: case 11: case 16: case 21: SetForm(1); break;
          case 2: case 7: case 12: case 17: case 22: SetForm(2); break;
          case 3: case 8: case 13: case 18: case 23: SetForm(3); break;
          case 4: case 9: case 14: case 19: case 24: SetForm(4); break;
          case 25: record = true; break;
          case 26: record = false; break;
          case 27: leanMax = 0; break;
          case 28: speedMax = 0; break;
          case 29: DebugGPS; break;
          case 30: DebugKML; break;
          }
          }
          }
          }
          void SetForm(int form) {
          currentForm = form;
          genie.WriteObject(GENIE_OBJ_FORM, form, 0);
          }

          secondly, I have a splash loading screen, using a text over a bitmap, text property is set to transparent in visigenie, and displays correctly in visigenie, but on the actual screen background is black.. can that be fixed by a setting in visigenie?

          Click image for larger version Name:	0.jpg Views:	1 Size:	29.6 KB ID:	63493 Click image for larger version Name:	3.jpg Views:	1 Size:	39.8 KB ID:	63494 Click image for larger version Name:	1.jpg Views:	1 Size:	36.4 KB ID:	63495 Click image for larger version Name:	2.jpg Views:	1 Size:	32.8 KB ID:	63496 Click image for larger version Name:	trans.JPG Views:	1 Size:	79.5 KB ID:	63497
          Hi,

          Is the bitmap the Form5 Background or is it a Userimage. If you set the background of the form to the image then the text should get rendered correctly with a transparent background. You will need to set the Bgtype property to image and load the image into Form5.

          Best regards

          Paul

          Comment


          • #6
            Will give that a go now, I just assumed since it looks ok in the IDE that's how it would look on the device

            Comment


            • #7
              that worked, thank you.

              Comment

              Working...
              X