I'm making a simple user interface using a 3.2 LCD Touch screen:
http://www.robotshop.com/en/3-2-tft-lcd-touch-shield-arduino.html
I'm using the UTFT libraries:
http://www.henningkarlsen.com/electronics/library.php?id=51
And having problems when it comes to using more than 2 drawBitmap commands. I start the whole program with a logo I created, then within the UI, I have two icons for weather and moon phases. Everything works fine if I have either the weather image OR the moon image, but not both. My guess is there's a memory issue. Here's my code:
Main:
#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>
#include <avr/pgmspace.h>
extern unsigned int logo[];
extern unsigned int New[];
extern unsigned int WaningCrescent[];
extern unsigned int ThirdQuarter[];
extern unsigned int WaningGibbous[];
extern unsigned int Full[];
extern unsigned int WaxingGibbous[];
extern unsigned int FirstQuarter[];
extern unsigned int WaxingCrescent[];
extern unsigned int Sunny[];
extern unsigned int PartlyCloudy[];
extern unsigned int Cloudy[];
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t Dingbats1_XL[];
int pressedButton;
int homeButton, settingsButton, alertButton, offButton, timeButton,
lightingButton, dosingButton, devicesButton, logButton, aboutButton;
UTFT mainDisplay(ITDB32S, 38,39,40,41);
UTouch inputTouch(6,5,4,3,2);
UTFT_Buttons inputButtons(&mainDisplay, &inputTouch);
void setup() {
mainDisplay.InitLCD();
mainDisplay.clrScr();
mainDisplay.drawBitmap(1,0,106,80,logo,3);
mainDisplay.setFont(BigFont);
inputTouch.InitTouch();
inputTouch.setPrecision(PREC_MEDIUM);
inputButtons.setTextFont(SmallFont);
inputButtons.setSymbolFont(Dingbats1_XL);
inputButtons.setButtonColors(VGA_YELLOW, VGA_RED, VGA_YELLOW, VGA_BLUE, VGA_GRAY);
delay(1000);
drawHomePage();
}
void loop() {
if (inputTouch.dataAvailable() == true)
{
pressedButton = inputButtons.checkButtons();
if(pressedButton == aboutButton)
drawAboutPage();
if(pressedButton == homeButton)
drawHomePage();
}
}
Load Pages:
void drawToolbar() {
//Top
mainDisplay.fillRoundRect(0,0,319,25);
//Bottom
mainDisplay.fillRoundRect(0,213,319,238);
homeButton = inputButtons.addButton( 1, 214, 80, 23, "HOME");
settingsButton = inputButtons.addButton( 81, 214, 79, 23, "SETTINGS");
alertButton = inputButtons.addButton( 160, 214, 79, 23, "ALERTS");
offButton = inputButtons.addButton( 239, 214, 80, 23, "POWER");
timeButton = inputButtons.addButton( 160, 1, 158, 23, "MM/DD/YYYY ##:##");
inputButtons.drawButtons();
}
void drawHomePage() {
mainDisplay.clrScr();
inputButtons.deleteAllButtons();
drawToolbar();
mainDisplay.drawBitmap(220, 30, 96, 96, WaxingCrescent);
//mainDisplay.drawBitmap(110, 30, 96, 96, PartlyCloudy);
lightingButton = inputButtons.addButton( 1, 30, 100, 34, "LIGHTING");
dosingButton = inputButtons.addButton( 1, 66, 100, 34, "QUALITY");
devicesButton = inputButtons.addButton( 1, 102, 100, 34, "DEVICES");
logButton = inputButtons.addButton( 1, 138, 100, 34, "LOG BOOK");
aboutButton = inputButtons.addButton( 1, 174, 100, 34, "ABOUT");
inputButtons.drawButtons();
}
Is there a command to clear memory of one of those bitmaps since I'm not using the logo at the same time as the weather and moon icons?
Thanks for any help!