Announcement

Collapse
No announcement yet.

Best way to rotate screen 180 degrees

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

  • Best way to rotate screen 180 degrees

    The design I am working on has an accelerometer to determine the display orientation. What is the best way to handle this in the Goldelox code? I will tell the display with a serial command which orientation it should be in. I tried toggling gfx_Set(SCREEN_MODE,LANDSCAPE) with gfx_Set(SCREEN_MODE,LANDSCAPE_R), but the images don't rotate, only their placement. Is it best to add another form with everything inverted?

  • #2
    Hello,

    Can you try to gfx_Cls(); and then redraw the images after you toggle gfx_Set(SCREEN_MODE,LANDSCAPE_R);

    I hope this helps

    Best regards

    Paul

    Comment


    • #3
      No difference there. I actually just took my application, which starts with gfx_Cls and changed the initial gfx_set to Landscape_R. Everything is flipped except the images.

      Comment


      • #4
        I should add that the "images" that are not rotating consist of a progress bar gauge and a static text object.

        Comment


        • #5
          Any other ideas on this? I have tried quite a few things but have not been successful with anything other than converting the entire project orientation (which won't work since I need both orientations in the same project).

          Comment


          • #6
            One more thing I should add. The gauge itself is rotate in terms of location, but the image pixel data is not rotated. On the example of the bar graph gauge, the red area remains on the same side of the display regardless of rotation setting.

            Comment


            • #7
              Goldelox image rotation is not straight forward.

              Note that when you 'paste code' you get a different result depending on the projects screen rotation.

              But since you can only have 'one' orientation for a project you will need 4 separate projects and place the GCI files at different offsets on the uSD. You can do this using scriptc and the WriteUsd script. You should then be able to address the individual images from Serial
              Mark

              Comment


              • #8
                Thanks, do you have any further details on how to do this? How does one load the different projects?

                Comment


                • #9
                  I've attached a file containing four projects that are simply the same image in different orientations. I've done a 'paste code' in each, so you can see the required positioning on the media_image commands.

                  It also contains a script to copy the 4 different GCIs to a single uSD card, refer to the comments in the script for more information.

                  Here's a commented Serial Commander log that demonstrates how the images can be used
                  Code:
                  media_Init[FFB1 ] 0.147 (ACK 1 0x0001)   // media needs initialising
                  ... various commands
                  gfx_ScreenMode[FF68 0000] 0.007 (ACK)  // display needs to be in Landscape orientation before displaying an image
                  media_SetSector[FFB8 0000 0000] 0.009 (ACK)  // set sector 0, location of first, Landscape mode, image
                  media_Image[FFB3 0008 0008] 0.017 (ACK)  // show image at position indicated by results of 'Paste code'
                  ... various commands
                  gfx_ScreenMode[FF68 0000] 0.007 (ACK) // display needs to be in Landscape orientation before displaying an image
                  media_SetSector[FFB8 0000 0064] 0.009 (ACK) // set sector 100, location of second, Landscape Reversed mode, image
                  media_Image[FFB3 0050 0050] 0.017 (ACK) // show image at position indicated by results of 'Paste code'
                  ... various commands
                  gfx_ScreenMode[FF68 0000] 0.007 (ACK) // display needs to be in Landscape orientation before displaying an image
                  media_SetSector[FFB8 0000 00C8] 0.009 (ACK) // set sector 200, location of third, Portrait mode, image
                  media_Image[FFB3 0008 0050] 0.017 (ACK) // show image at position indicated by results of 'Paste code'
                  ... various commands
                  gfx_ScreenMode[FF68 0000] 0.007 (ACK) // display needs to be in Landscape orientation before displaying an image
                  media_SetSector[FFB8 0000 012C] 0.009 (ACK) // set sector 300, location of fourth, Portrait Reversed mode, image
                  media_Image[FFB3 0050 0008] 0.017 (ACK) // show image at position indicated by results of 'Paste code'
                  ... various commands
                  Attached Files
                  Mark

                  Comment


                  • #10
                    How would I handle built-in widgets like the progress bar graph (or even custom widgets using the smart objects)? Will this work as intended or will they animate backwards? I am not sure how to generate the bar graphs in reverse.

                    Comment


                    • #11
                      Yes, that will work for them
                      Mark

                      Comment


                      • #12
                        I am getting CRC errors:

                        No Errors, code size = 40 bytes
                        Starting Script WriteUSDGoldy.4dscript
                        Log Command Times
                        Data error (cyclic redundancy check)
                        Data error (cyclic redundancy check)
                        ABORTING Script WriteUSDGoldy.4dscript

                        Any ideas?

                        Also, is it possible to do the same thing from within a VISI project (as opposed to serial)? Currently, our main processor sends several variables and the VISI code determines what to display based on that information. The main processor does not determine which images go where directly.
                        Last edited by jmracepoint; 13th September 2017, 12:32 AM.

                        Comment


                        • #13
                          At the surface a "Data error" should mean something is wrong with the uSD, but somehow I suspect another cause.

                          Are you running the script from an Admin mode prompt? (Windows will prevent access if that is not the case, I get 'access denied', but if your uSD driver comes from a different vendor who knows what error they are reporting in this case)
                          Are the specified offsets definitely withing the capacity of the card?
                          Could your AV be getting involved? (Some try to be too clever)

                          Yes, you can do the same thing from ViSi
                          Mark

                          Comment


                          • #14
                            Thanks, it was an issue with the uSD card and parallels. Now that part is working, however, my gui isn't working. When I compile the gui normally through the IDE, it wants to copy DIM0.g01, DIM0.gci, and DIM0.txf. Do I need to copy all of these files for each display orientation? If so, how do I determine the relative offsets in the script.

                            Comment


                            • #15
                              You need the GCI for each orientation.

                              The .g01 is a font and the .txf is strings. These come from a strings object. You will need the .g01 once. You only need the .txf if you used string constants. Just add them to the copy script the same way as you did the other files.
                              Mark

                              Comment

                              Working...
                              X