Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

problem with GFX fillTriangle() functtion
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

problem with GFX fillTriangle() functtion

by iesre on Tue Jun 23, 2020 12:16 pm

Here is code for filling a triangle on Adafruit's 2.2" TFT board from an UNO. Regardless of whether I use fillTriangle() or drawTriangle(), sometimes it compiles and sometimes not. Sometimes it will compile when I press just the compile button, but won't compile when I press the upload button. When it doesn't compile this is the error message:
C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX\Adafruit_SPITFT.cpp: In member function 'writeFastVLine':

C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX\Adafruit_SPITFT.cpp:1536:1: internal compiler error: Segmentation fault
What's going on here??

Code: Select all | TOGGLE FULL SIZE
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#define DEG2RAD 0.0174532925
#define TFT_DC 9
#define TFT_CS 10
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
#define BLACK 0x0000
//#define BLUE 0x001F
//#define RED 0xF800
#define GREEN 0x07E0
//#define CYAN 0x07FF
//#define MAGENTA 0xF81F
//#define YELLOW 0xFFE0
//#define WHITE 0xFFFF
const int xSize=320,ySize=240; // For 2.2" Adafruit TFT display
uint16_t x0=xSize/2,y0=ySize/2;
uint16_t x1=x0,x2=x0+100,x3=x0+50,y1=0,y2=y0,y3=y0-70;
void setup(void) {
  tft.begin();
  tft.setRotation(1);
  tft.fillScreen(BLACK);
  //tft.fillTriangle(x0,y0,x1,y1,x2,y2,GREEN);
  tft.drawTriangle(x0,y0,x1,y1,x2,y2,GREEN); 
}
void loop() {}

iesre
 
Posts: 227
Joined: Mon Jun 10, 2013 1:58 pm

Re: problem with GFX fillTriangle() functtion

by mikeysklar on Tue Jun 23, 2020 6:07 pm

Hello iesre,

Which version of our Adafruit_FGX library are you using?

The latest release is on GitHub and has been under active development. I would like to know if this resolves your issue.

https://github.com/adafruit/Adafruit-GFX-Library

mikeysklar
 
Posts: 1644
Joined: Mon Aug 01, 2016 8:10 pm

Re: problem with GFX fillTriangle() functtion

by iesre on Tue Jun 23, 2020 8:28 pm

Earlier today I deleted whatever GFX version I had before (I don't know what it was) and reinstalled from the IDE. it says it's Version 1.9.0 which is the same version as on the github link -- yes? BTW, The purpose of the code I sent was to try to figure out if I could come up with some kind of a "fill arc" function, so I can create nice-looking pie charts that don't take too long to draw. Trying to create a pie chart with successive line draws takes forever and still leaves some blank pixels along the way.

iesre
 
Posts: 227
Joined: Mon Jun 10, 2013 1:58 pm

Re: problem with GFX fillTriangle() functtion

by iesre on Tue Jun 23, 2020 9:33 pm

When I try to compile these codes, there are sometimes references to other files used by other devices, like this:
Not used: C:\Users\David.000\Documents\Arduino\libraries\Adafruit_VEML7700_new
In file included from C:\Users\David.000\Documents\Arduino\libraries\Adafruit_GFX_Library\Adafruit_MonoOLED.cpp:20:0:

C:\Users\David.000\Documents\Arduino\libraries\Adafruit_GFX_Library\Adafruit_MonoOLED.h:31:32: fatal error: Adafruit_SPIDevice.h: No such file or directory

Are there possible conflicts in the GFX library with other libraries??

iesre
 
Posts: 227
Joined: Mon Jun 10, 2013 1:58 pm

Re: problem with GFX fillTriangle() functtion

by iesre on Wed Jun 24, 2020 12:20 pm

I see several online posts about newer versions of the GFX library no longer working for code that previously worked. Is it possible to install an older version of this library to see if that's my problem?

iesre
 
Posts: 227
Joined: Mon Jun 10, 2013 1:58 pm

Re: problem with GFX fillTriangle() functtion

by mikeysklar on Wed Jun 24, 2020 1:01 pm

Yes, you can install an older vesion of the GFX library using the Arduino Apps library manager.

mikeysklar
 
Posts: 1644
Joined: Mon Aug 01, 2016 8:10 pm

Re: problem with GFX fillTriangle() functtion

by iesre on Wed Jun 24, 2020 9:55 pm

OK. I see how to do that. But is that really the probem? Here's the compile time message from another sketch that USED to work with the 2.2" TFT display but now won't compile. The GFX library is clearly looking for something it can't find...

In file included from C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX_Library\Adafruit_MonoOLED.cpp:20:0:

C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX_Library\Adafruit_MonoOLED.h:31:32: fatal error: Adafruit_SPIDevice.h: No such file or directory

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

iesre
 
Posts: 227
Joined: Mon Jun 10, 2013 1:58 pm

Re: problem with GFX fillTriangle() functtion

by iesre on Wed Jun 24, 2020 10:21 pm

Please excuse me for wasting forum time (I think!) for a problem I should have been able to see and fix myself. The missing files in the compile failures were apparently due to somehow the GFX library getting corrupted. When I erased the GFX library and reinstalled it (although I thought I already did this before!) the code seems to work now.
It would still be nice to add drawArc and fillArc primitives to the library!

iesre
 
Posts: 227
Joined: Mon Jun 10, 2013 1:58 pm

Re: problem with GFX fillTriangle() functtion

by mikeysklar on Thu Jun 25, 2020 12:37 pm

Thanks for getting back to us with this. The missing header file (Adafruit_SPIDevice.h) is a solid clue that the library installation might be compromised.

mikeysklar
 
Posts: 1644
Joined: Mon Aug 01, 2016 8:10 pm

Re: problem with GFX fillTriangle() functtion

by iesre on Thu Jun 25, 2020 1:25 pm

Hmm... I spoke too soon. In this code, only the uncommented line will compile under GFX 1.9.0. I haven't tried earlier versions, but there is no reason why all of these statements shouldn't compile.
//tft.drawCircle(190,60,10,10,BLUE);
//tft.fillCircle(190,60,10,10,BLUE);
tft.drawRect(190,60,10,10,BLUE);
//tft.fillRect(190,60,10,10,BLUE);

Trying to compile tft.fillRect() gives these messages:
Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.

lto-wrapper.exe: fatal error: C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc returned 1 exit status

compilation terminated.

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

iesre
 
Posts: 227
Joined: Mon Jun 10, 2013 1:58 pm

Re: problem with GFX fillTriangle() functtion

by mikeysklar on Thu Jun 25, 2020 2:28 pm

Is it tft.fillRect() or tft.drawRect() this is giving the compile error? I ask because only tft.drawRect() is uncommented in the code you pasted in.

I have seen related compile errors. The suggestion at that time was to contact the TFT manufactorer.
https://github.com/adafruit/Adafruit_FT ... y/issues/8

mikeysklar
 
Posts: 1644
Joined: Mon Aug 01, 2016 8:10 pm

Re: problem with GFX fillTriangle() functtion

by iesre on Thu Jun 25, 2020 3:16 pm

Of the four statements, only drawRect() will compile. Also, perhaps not surprisingly, neither drawRoundRect() nor fillRoundRect() will compile either. I'm not using a TFT with a touch screen. Contacting the TFT manufacturer seems like a very inadequate suggestion for a hardware and software product supported by Adafruit. Because some of the GFX primitives work and others don't, I assume this is actually a GFX problem and not a hardware problem. I suppose it's POSSIBLE that the problem is specific to this particular TFT device, but
that seems highly unlikely to me. Am I wrong? Even if that turns out to be true, it's no excuse...

iesre
 
Posts: 227
Joined: Mon Jun 10, 2013 1:58 pm

Re: problem with GFX fillTriangle() functtion

by iesre on Mon Jun 29, 2020 11:22 am

pieChart.jpg
pieChart.jpg (147.4 KiB) Viewed 56 times
Still haven't figured out why there are sometimes compile and upload problems with sketches using the GFX libary, and I still think that library should include primitives for drawing and filling arcs. Having said that, I did write a sketch that generates a passable pie chart. This is part of an online document about displaying data collected from Arduinos. Most of the hardware in that document is from Adafruit. You can see it here:
http://www.instesre.org/ArduinoDataDisp ... isplay.pdf

iesre
 
Posts: 227
Joined: Mon Jun 10, 2013 1:58 pm

Please be positive and constructive with your questions and comments.