Pages: 1 ... 3 4 [5]   Go Down
 Author Topic: New TFT Extension Library  (Read 9883 times) 0 Members and 1 Guest are viewing this topic.
Queens, New York
Offline
Karma: 84
Posts: 3422
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
 « Reply #60 on: May 21, 2014, 07:04:17 pm » Bigger Smaller Reset

I should have mentioned this earlier, if you look at the code for drawArc, you will see
Quote
for(float rotate = start; rotate <= stop; rotate+=0.5)
To draw an arc that spans 0 - 180 degrees, with a radius of 50 pixels and filled in, it takes 12.9 seconds. However if I make it increment by 1 instead of 0.5, then the time is cut in half, 6.5 seconds. There is a reason why it takes SO long to make the gauge, and that is because of the appearance. If I make it increment by 0.5, the gauge is filled and it looks good, no dead spots. However (you can try this if you want) if I make it increment by 1, then yes it will take half the time, but it won't look as nice.

Maybe I make it an option, Appearance vs Speed, and have it draw the gauges based on that setting.

There is always a method to the madness.
 « Last Edit: May 21, 2014, 07:16:43 pm by HazardsMind » Logged

Created Libraries:
Will provide libraries if asked in PM or forum.

Global Moderator
Netherlands
Offline
Shannon Member
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #61 on: May 22, 2014, 12:09:42 pm » Bigger Smaller Reset

small test -     // cos = sqrt(1-sin*sin);  to calculate a faster cos()

Code:
// Released to the public domain
uint32_t start;
uint32_t stop;
int x;
int y;

void setup()
{
Serial.begin(115200);
Serial.println("Start ");

start = micros();
drawGauge(100, 10);
stop = micros();
Serial.println(stop - start);

start = micros();
drawGauge1(100, 10);
stop = micros();
Serial.println(stop - start);
Serial.println(x);
Serial.println(y);
}

void loop()
{
}

{
}

{
y = sqrt(1-x*x) * (rad-2);            // cos = sqrt(1-sin*sin)
}
 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline
Newbie
Karma: 5
Posts: 11
 « Reply #62 on: May 22, 2014, 02:07:31 pm » Bigger Smaller Reset

iv got one more for you how could i get the HorBarGraph function to be at 0% on the left hand side and 100% on the right? as its going the opposite way atm?
 Logged

Global Moderator
Netherlands
Offline
Shannon Member
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #63 on: May 22, 2014, 02:30:23 pm » Bigger Smaller Reset

do   value =  100-value  ?
 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Queens, New York
Offline
Karma: 84
Posts: 3422
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
 « Reply #64 on: May 22, 2014, 03:28:48 pm » Bigger Smaller Reset

I figured someone would want that so I modded the code to have it display both ways with a boolean variable.
Unfortunately, I am not home right now, so I can't post the library at the moment.
 Logged

Created Libraries:
Will provide libraries if asked in PM or forum.

Queens, New York
Offline
Karma: 84
Posts: 3422
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
 « Reply #65 on: May 22, 2014, 06:11:44 pm » Bigger Smaller Reset

Update: look at SliderBar_Horizontal sketch.

Default is LTR.

Working on new Keyboard layout and adding sendable Smiley faces.

Created Libraries:
Will provide libraries if asked in PM or forum.

Offline
Newbie
Karma: 5
Posts: 11
 « Reply #66 on: May 22, 2014, 07:29:09 pm » Bigger Smaller Reset

Ok got it great work.
 Logged

Queens, New York
Offline
Karma: 84
Posts: 3422
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
 « Reply #67 on: May 25, 2014, 01:32:30 am » Bigger Smaller Reset

Minor Update: Added new functions for _Draw buttons.

User gromgsxr got me thinking, my buttons use locks to prevent them from constantly redrawing on screen, so, if you want to use them in a menu system, they wont redraw when you reenter the screen. It is the exact same issue gromgsxr was having with his gauges, once he left the screen and came back, they wouldn't redraw. Well these new functions will (as there names imply) fix that issue as either individually or all (of the same type) at once.

New Functions:
ResetTouchButton(byte ID);
ResetTouchCircle(byte ID);
ResetTouchTriangle(byte ID);
ResetLatchButton(byte ID);
ResetLatchCircle(byte ID);
ResetLatchTriangle(byte ID);
ResetAllTouchButton();
ResetAllTouchCircle();
ResetAllTouchTriangle();
ResetAllLatchButton();
ResetAllLatchCircle();
ResetAllLatchTriangle();

The rounded_Square function draws MUCH faster.
 TFT_Extension.zip (64.93 KB - downloaded 10 times.) « Last Edit: May 25, 2014, 05:53:05 pm by HazardsMind » Logged

Created Libraries:
Will provide libraries if asked in PM or forum.

Queens, New York
Offline
Karma: 84
Posts: 3422
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
 « Reply #68 on: June 05, 2014, 04:01:09 pm » Bigger Smaller Reset

Notice:
I have a few new functions coming out soon. One is already done and its called TouchCircleByQuad
Basically it will return the quadrant of which you touched, (1,2,3 and 4) or you can specify a specific quadrant(s) and it will return true if it/they are touched.

The other two are Swipe and SwipeFromArea.
Swipe: Will return a value based on the direction you swiped on the screen from your initial touch(anywhere on screen). 1 = up, 2 = down, 3 = left and 4 = right. I am still fine tuning this function but it's not 100% yet.

SwipeFromArea: Needs an area to swipe from and a direction(x1, y1, x2, y2). This function will allow you to do things like, do something when only the bottom left side of the screen is swiped to the right or you can add multiple functions to do different things. Not 100% yet either.

I am also thinking of adding double tap buttons, but I don't know if they are really needed. But if someone wants them, I will add them.
 « Last Edit: June 05, 2014, 04:03:52 pm by HazardsMind » Logged

Created Libraries:
Will provide libraries if asked in PM or forum.

Queens, New York
Offline
Karma: 84
Posts: 3422
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
 « Reply #69 on: June 07, 2014, 02:59:12 pm » Bigger Smaller Reset

UPDATE!

Library is below.

Created Libraries:
Will provide libraries if asked in PM or forum.

Queens, New York
Offline
Karma: 84
Posts: 3422
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
 « Reply #70 on: June 14, 2014, 11:39:29 pm » Bigger Smaller Reset

Slight update:
I fixed some things in the Smiley face function and got rid of the extra pixel at 0 deg.

And put the keyboard characters in the PROGMEM

 TFT_Extension.zip (73.04 KB - downloaded 10 times.) « Last Edit: June 15, 2014, 12:00:27 am by HazardsMind » Logged

Created Libraries:
Will provide libraries if asked in PM or forum.

Global Moderator
Netherlands
Offline
Shannon Member
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #71 on: June 15, 2014, 05:31:36 am » Bigger Smaller Reset

good work!

small bug in the latest version  in the CPP file on the top
Code:
#include "TFT_Extension_old.h"

Think it is time to include a version string in the library like
Code:
#define TFT_EXTENSION_VERSION "TFT EXT LIB V0.1.00"

 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Queens, New York
Offline
Karma: 84
Posts: 3422
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
 « Reply #72 on: June 15, 2014, 11:29:40 am » Bigger Smaller Reset

Edit:

As for the version, there is most likely going to be one more coming out and that's the new keyboard layouts (iOS and Android style) and maybe a clock face, maybe.

Other than that, I think i'm finally done.

But I'll add the version in.

Below is just the .cpp file, you can replace the one you have with this one.
 TFT_Extension.cpp (96.52 KB - downloaded 11 times.) « Last Edit: June 15, 2014, 09:54:37 pm by HazardsMind » Logged

Created Libraries:
Will provide libraries if asked in PM or forum.

Queens, New York
Offline
Karma: 84
Posts: 3422
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
 « Reply #73 on: July 05, 2014, 05:24:27 pm » Bigger Smaller Reset

Ok, I think this is going to be the last update for this library, but I may tweak somethings here and there.

I started making this library, before it was ever a library, meaning at the time I was just adding functions to Karlsen's ITDB02 libraries, trying to make them better and more functional. Then before long I had written a LOT of new functions and decided to take what I made and make my own library that others can use. Its taken a collective 13 months, of both my ideas and help from other users (their names are in the .h file).

Thank you for finding this library helpful, and as always if there is something you want to add, by all means let me know. This is the last update from my ideas (because I'm all out), but if someone else has anything good that they want to add, I will add it.

Thank you again.

Edit: being that the iPhone and Android keyboards are very similar, I just made one new keyboard style, so now the library has Standard_Keyboard and Mobile_KeyBoard