TinyCircuits

From landscape to portrait

From landscape to portrait
« on: August 16, 2018, 05:03:32 AM »
Hi all, Newby and this could be a simple question for you all.
I'm starting with the TinyScreen and eventualy I want to build a little instrument for the cockpit from my scaleglider.
To do that, the first thing I have to learn is rotating the example on the screen, that is now horizontal.
Anyone who could help me? I assume this is the part where the change has to come? Rectangle to something else?

void hardwareDrawCommands(){
  //Accelerated drawing commands are executed by the display controller
  //clearScreen();//clears entire display- the same as clearWindow(0,0,96,64)
  display.clearScreen();
  //drawRect(x stary, y start, width, height, fill, 8bitcolor);//sets specified OLED controller memory to an 8 bit color, fill is a boolean- TSRectangleFilled or TSRectangleNoFill
  display.drawRect(10,10,76,44,TSRectangleFilled,TS_8b_Red);
  //drawRect(x stary, y start, width, height, fill, red, green, blue);//like above, but uses 6 bit color values. Red and blue ignore the LSB.
  display.drawRect(15,15,66,34,TSRectangleFilled,20,30,60);
  //clearWindow(x start, y start, width, height);//clears specified OLED controller memory
  display.clearWindow(20,20,56,24);
  //drawLine(x1, y1, x2, y2, 8bitcolor);//draw a line from (x1,y1) to (x2,y2) with an 8 bit color
  display.drawLine(0,0,95,63,TS_8b_Green);
  //drawLine(x1, y1, x2, y2, red, green, blue);//like above, but uses 6 bit color values. Red and blue ignore the LSB.
  display.drawLine(0,63,95,0,0,63,0);
  delay(1000);
  //use 16 bit version of drawLine to fade a rectangle from blue to green:
  for(int i=0;i<64;i++){
    display.drawLine(0,i,95,i,0,i,63-i);
  }
  delay(1000);
}

Thanks
Martin

Re: From landscape to portrait
« Reply #1 on: August 17, 2018, 07:06:15 PM »
Hey Martin,

I'm not completely sure of the application you're going for, but I hope I can provide some insight you may find useful. This may get mildly confusing, but I'll do my best to make everything as clear as possible.

As of now, there is no existing low-level code to "flip" the screen 90 degrees into a "portrait mode." This is because such a function isn't exactly necessary. Regardless of the orientation of the screen, any desired image or display (within the capabilities of the screen) can be shown on the screen. Basically, you either have to think through how to display the proper image by using the default coordinates, OR write a function that will convert coordinates in your desired "portrait mode" format to the default-style coordinates such that the lower-level code is able to work with it.

It's a little difficult to explain so I understand if you have more questions. Feel free to reach out.

Also, I'm not sure how much you plan on working with the TinyScreen, but I gained a significantly better understanding of how to use the TinyScreen+ by going through the "How to Develop a Game for the TinyArcade" tutorial found at (https://tinycircuits.com/blogs/learn/how-to-develop-a-game-for-the-tinyarcade-new).

I hope this helps.

-Hunter

Re: From landscape to portrait
« Reply #2 on: August 21, 2018, 04:48:22 AM »
Hi Hunter. Thanks for the fast reply. I think that I untherstand it. ( Sorry for the bad english, but I live in Belgium :-)  )
The only reason that I'm using the TinyScreen is for my hobby. I'm trying to build a scale instrument with it for my (very ) big scale glider. So, in the end, it have to schow me some tekst at start up, few moments later it have to show a map. Already succeded with writing the tekst and adjusting the millisec that it is displayed.
Below a link with the LX9000 navigation instrument. That's what I want to build with the TinyScreen in scale 1/3,75 wich is more or less the 0,96 inch screen.
https://gliding.lxnav.com/products/lx9000/

I'm not a programmer, never build anything like this, so it's a bit of a struggle. Any help is welcome to reach my goal
:-)
Thanks
Martin


Re: From landscape to portrait
« Reply #3 on: August 21, 2018, 11:43:44 AM »
Looks like a pretty fun project!

How are you loading the map? Are you using bluetooth, WiFi, or GPS?

Re: From landscape to portrait
« Reply #4 on: August 21, 2018, 02:36:15 PM »
Well, untill I know what I'm doing with this Tinyproject, I'll simply want to use a converted image from a map. ( Have to learn that to ). So the gap in the dashboard from the glider is closed at the least. Then I would like to learn how I can use GPS signal and get the glider simbol moving over the map. Switching between sensordata and map would be nice. Sensor data could be height, batterylevel, groundspeed. I know that's still a long way, but got plenty of time. For now, the tekst and the image are prioity.


Martin