This is not the first time I've encountered an error like this so I'm skeptical of the actual exceptions that are being thrown.
I'm happily writing my code, using native functions like drawing text, rectangles, etc. when all of a sudden I need to draw a line and the code spews out all sorts of errors when I try to compile. Checked the syntax a million times, nothing wrong with that. In fact a nearly identical piece of code with the drawLine function works without a hitch. I decided to try if I could get my working program to break so I deleted some lines that merely used the serial function to display some text in the terminal window and it also broke, saying all this stuff about "undefined reference to..." this or that in PDQ_ILI9341.h.
There's nothing wrong with that header file, I checked. But when I do a certain random thing... like draw a line, when I've already drawn a bunch of other stuff with no issues, the code suddenly takes a dump and I'm like WTF?
Either of the 2 lines that are currently commented out, will cause the code not to compile.
#include <SPI.h> // must include this here (or else IDE can't find it)
#include <PDQ_GFX.h> // PDQ: Core graphics library
#include "PDQ_ILI9341_config.h" // PDQ: ILI9341 pins and other setup for this sketch
#include <PDQ_ILI9341.h> // PDQ: Hardware-specific driver library
PDQ_ILI9341 tft; // PDQ: create LCD object (using pins in "PDQ_ILI9341_config.h")
#include <Fonts/FreeSerif12pt7b.h> // include fancy serif font
#include <Fonts/FreeSans12pt7b.h> // include fancy sans-serif font
#define ILI9341_GREY 0x8410
#define ILI9341_PINK 0xF8FF
void setup() {
tft.begin(); // initialize LCD
}
void loop(void)
{
tft.setRotation(3);
tft.fillScreen(ILI9341_BLACK);
statusDisp();
while(1) {}
}
void statusDisp(void) {
tft.setCursor(35, 5);
tft.setTextColor(ILI9341_WHITE);
tft.setTextSize(3);
tft.println("STATUS DISPLAY");
tft.drawFastHLine(0, 30, 320, ILI9341_WHITE);
tft.drawFastVLine(85, 45, 120, ILI9341_WHITE);
tft.drawFastVLine(145, 45, 120, ILI9341_WHITE);
tft.drawFastVLine(205, 45, 120, ILI9341_WHITE);
tft.drawFastVLine(265, 45, 120, ILI9341_WHITE);
tft.drawRect(1, 45, 318, 120, ILI9341_WHITE);
tft.drawFastHLine(1, 73, 318, ILI9341_WHITE);
tft.drawFastHLine(1, 103, 318, ILI9341_WHITE);
tft.drawFastHLine(1, 133, 318, ILI9341_WHITE);
tft.drawRoundRect(5, 175, 130, 60, 12, ILI9341_WHITE);
tft.drawRoundRect(140, 175, 175, 60, 12, ILI9341_WHITE);
// tft.drawLine(0, 0, 64, 64, ILI9341_WHITE);
// tft.drawTriangle(10, 200, 20, 195, 20, 205, ILI9341_WHITE);
tft.setCursor(45, 195);
tft.setTextColor(ILI9341_WHITE);
tft.setTextSize(2);
tft.println("OPTIONS");
tft.setCursor(147, 195);
tft.println("CNTRL PANEL");
tft.setCursor(5, 55);
tft.setTextColor(ILI9341_PINK);
tft.setTextSize(1);
tft.println("POWER SUPPLY");
tft.setCursor(90, 55);
tft.setTextColor(ILI9341_GREEN);
tft.println("ENABLED");
tft.setCursor(150, 55);
tft.setTextColor(ILI9341_RED);
tft.println("ERROR");
tft.setCursor(210, 55);
tft.println("HOT");
tft.setCursor(270, 55);
tft.setTextColor(ILI9341_CYAN);
tft.println("96.3 V");
tft.setCursor(5, 85);
tft.setTextColor(ILI9341_PINK);
tft.println("SUPERCHARGER");
tft.setCursor(90, 85);
tft.setTextColor(ILI9341_GREEN);
tft.println("ENABLED");
tft.setCursor(150, 85);
tft.println("NOMINAL");
tft.setCursor(210, 85);
tft.println("IDLE");
tft.setCursor(270, 85);
tft.setTextColor(ILI9341_CYAN);
tft.println("3 %");
tft.setCursor(5, 115);
tft.setTextColor(ILI9341_PINK);
tft.println("NITROUS");
tft.setCursor(90, 115);
tft.setTextColor(ILI9341_GREY);
tft.println("DISABLED");
tft.setCursor(150, 115);
tft.println("NOMINAL");
tft.setCursor(210, 115);
tft.println("UNSTABLE");
tft.setCursor(270, 115);
tft.println("CLOSED");
tft.setCursor(5, 145);
tft.setTextColor(ILI9341_PINK);
tft.println("KNOCK");
tft.setCursor(90, 145);
tft.setTextColor(ILI9341_GREEN);
tft.println("ENABLED");
tft.setCursor(150, 145);
tft.println("NOMINAL");
tft.setCursor(210, 145);
tft.setTextColor(ILI9341_YELLOW);
tft.println("CAUTION");
tft.setCursor(270, 145);
tft.setTextColor(ILI9341_CYAN);
tft.println("0.9");
}
void controls(void) {
}
void options(void) {
}