Go Down

### Topic: New TFT Extension Library (Read 29402 times)previous topic - next topic

#### HazardsMind

#60
##### May 22, 2014, 02:04 amLast Edit: May 22, 2014, 02:16 am by HazardsMind Reason: 1
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.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### robtillaart

#61
##### May 22, 2014, 07:09 pm

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

Code: [Select]
`// Released to the public domainuint32_t start;uint32_t stop;float deg_to_rad = 3.14159265/180;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() {}void drawGauge(int value, int rad){  x = sin((value-90) * deg_to_rad) * (rad-2);  y = cos((value-90) * deg_to_rad) * (rad-2); }void drawGauge1(int value, int rad){  x = sin((value-90) * deg_to_rad);  y = sqrt(1-x*x) * (rad-2);            // cos = sqrt(1-sin*sin)  x = x * (rad-2);}`
Rob Tillaart

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

#### gromgsxr

#62
##### May 22, 2014, 09:07 pm
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?

#### robtillaart

#63
##### May 22, 2014, 09:30 pm
do   value =  100-value  ?
Rob Tillaart

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

#### HazardsMind

#64
##### May 22, 2014, 10:28 pm
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.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### HazardsMind

#65
##### May 23, 2014, 01:11 am
Update: look at SliderBar_Horizontal sketch.

Default is LTR.

Working on new Keyboard layout and adding sendable Smiley faces.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### gromgsxr

#66
##### May 23, 2014, 02:29 am
Ok got it great work.

#### HazardsMind

#67
##### May 25, 2014, 08:32 amLast Edit: May 26, 2014, 12:53 am by HazardsMind Reason: 1
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.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### HazardsMind

#68
##### Jun 05, 2014, 11:01 pmLast Edit: Jun 05, 2014, 11:03 pm by HazardsMind Reason: 1
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.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### HazardsMind

#69
##### Jun 07, 2014, 09:59 pm
UPDATE!

Library is below.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### HazardsMind

#70
##### Jun 15, 2014, 06:39 amLast Edit: Jun 15, 2014, 07:00 am by HazardsMind Reason: 1
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

My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### robtillaart

#71
##### Jun 15, 2014, 12:31 pm
good work!

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

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

Rob Tillaart

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

#### HazardsMind

#72
##### Jun 15, 2014, 06:29 pmLast Edit: Jun 16, 2014, 04:54 am by HazardsMind Reason: 1
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.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### HazardsMind

#73
##### Jul 06, 2014, 12:24 amLast Edit: Jul 28, 2014, 04:50 pm by HazardsMind Reason: 1
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

My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### HazardsMind

#74
##### Oct 02, 2014, 10:29 pmLast Edit: Oct 02, 2014, 11:55 pm by HazardsMind Reason: 1
(OPTIONAL)
Its been a while since I did anything with my library, but I spent some time slimming it down a little (mostly the functions that dealt with color). I also added in a simple RGB to 565 color converter function. ConvertRGB(...)

As per the changes, I only modified a few of the example sketches that come with the library, such as Paint, Latching_Buttons, DrawBox, Arc, and Keyboard.

I am also trying to fix some of the visual functions like the sliders and bargraphs to look more pleasant to the eye.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

Go Up

Please enter a valid email to subscribe