PDA

View Full Version : arLCD - 320x240 color LCD with touch screen



PaulStoffregen
09-27-2013, 07:47 PM
Randy from EarthLCD sent me an arLCD (http://store.earthlcd.com/arLCD) for testing with Teensy.

My first impression of arLCD it's a bit spendy, but you get quite a lot. It's a touch-sensitive 320x240 screen with 16 bit color. There's a GPU that runs separately. The GPU is controlled by serial communication, but it caches fonts, images, even strings, so the messages are short and pretty efficient. I'm actually pretty impressed with how well it performs.

It also has an Arduino ('328 AVR) clone on board. Honestly, for simple projects, you'd probably just use the built-in Arduino clone. Yeah, I should of course try to sell a Teensy, but for simple stuff the on-board AVR is probably fine. For more processor intensive work that's not practical on 8 bit AVR, like real-time music visualization, connecting a Teensy3 could be worthwhile? Maybe I'll give that a try after the upcoming Arduino board and library are released.......

When you first get the arLCD, it's on-board Arduino clone has "arLCDTest" programmed. The code is one of the many examples in their library.

980
(on all these images, click for full size)

Of course, the thing I'm interested in doing is trying to use it from Teensy3.

First, you'll need these modified files: 981. These changes work on Teensy and also the build-in Arduino clone, and they probably also work on other boards. Hopefully EarthLCD will release these changes in a future version.

Before connecting Teensy, you need to program the on-board Arduino clone with a dummy program. The blink from File > Examples > 01.Basics > Blink is fine. As long as it doesn't use Serial.begin() or the library's begin() function, the built-in '328 chip will not drive the serial line, so you can connect a Teensy (or other board) to control the LCD.

It turns out the LCD is able to work fine by applying 5 volts from the Teensy for power. Here's how I connected it. Even though pins 0 to 6 are connected, only 0, 1 and 2 are actually used. 2 is for attachInterrupt() used by some of the examples.

979

Here it is running the "analogMeter" example. That blue trim-pot I connected is supplying the variable voltage to the A0 analog input.

978

The display can be really bright. My camera didn't capture this too well. It really does look very nice in real life.

One small caveat I ran into is the GPU's bootup time. If you just upload code to Teensy3, it works great. But at powerup, the GPU spends about 2 seconds booting up and displaying a splash screen.

I believe the GPU holds the on-board '328 chip in reset mode while it's busy. But if you connect an external board like Teensy to use the LCD, a delay is needed. Here's the modified setup() function for that analogMeter example.



void setup()
{
lcd.begin( EZM_BAUD_RATE );
lcd.cls( BLACK, WHITE );
lcd.font("0");
lcd.light(50);
lcd.xy(55,0);
lcd.printString("delay for LCD bootup");
delay(2500);

lcd.begin( EZM_BAUD_RATE );
lcd.cls( WHITE );
lcd.fontw( 1, "0" );
lcd.string( 1, "ALOG_0" ); // stringId 1
lcd.theme( 1, 155 ,152, 3, 3, 3, 1, 4, 5, 0, 16 );
lcd.analogMeter( 1, xPos,yPos, width, height, option, 0, 0, 1023, 1, 1, type );
}


As it starts up, you'll see this for a brief moment before the analog meter appears. The delay could probably be less than 2.5 seconds. But without any delay, the GPU doesn't hear some of the initial setup.

977

Edit: the arLCD comes with those nice metal mounting posts that are conveniently flush with the surface of the display. It does not come with the screws. I added those as I was working with the display and adding the Teensy3, so the beautiful screen wouldn't rub and scratch on my well-worn workbench. One thing I really like is the holes are big enough for normal 4-40 or M3 screws (most LCDs have tiny holes), which is really nice for putting this display into a nicely assembled project.

If you do buy an arLCD, please tell them you saw it here. ;)

nekidfrog
10-01-2013, 09:28 PM
Paul, you stated it's bright... would you say it's good enough for outdoors/sunlight?

PaulStoffregen
10-04-2013, 10:14 PM
I just took it outside. Today is a fairly sunny day for October at 3pm, certainly not as bright as the height of summer, but it is clear and bright out there.

When I turned the LCD brightness up all the way, the screen is still readable, but not easily so, when sunlight shines directly on it. Of course, it's impossible to see anything if the glass directly reflects the sunlight into your eyes (yes, I managed to do that a few times while looking at it). When viewed with the display rotated so it's not getting sunlight directly shining onto the surface, it's pretty readable. Not as easily as indoors, but still ok.

I don't have any good way to measure, but that's my subjective opinion. It's pretty hard but not impossible to read with direct sunlight, and pretty reasonable but not as vivid and easy as indoors with indirect sunlight.

nekidfrog
10-04-2013, 10:30 PM
Man why is there very few options for outdoor lcd's?

CRC
11-18-2013, 02:22 AM
Hello all,

I picked up one of these at Microcenter on a whim because it looked like a neat addition to a project I'm working on. I didn't realize the serial port is utilized by the GPU. My project involves writing to the serial port and displaying data from it. It appeared my only option was the use of software serial but the device the project interfaces with requires ODD parity. |Is there a way to use ODD parity with soft serial?

As for brightness, this thing is nice and bright but I haven't tried it outside yet. I will try to get a decent picture of it in the sun tomorrow for those interested.

PaulStoffregen
11-18-2013, 11:20 AM
Are you asking about programming a Teensy connected to arLCD, or programming the Arduino Uno clone that's on the arLCD circuit board?

If you're using a Teensy 3.0, as I did in photos above, it has 2 more serial ports. Serial2 and Serial3 are available.

CRC
11-18-2013, 06:50 PM
I should have been more specific. I was referring to the on board Uno since they tied up the hardware serial totally with the newest firmware release. I just read on the support email group that they are trying to come up with a solution by using the GPU. I really wish they would have gone with something like a Teensy or at least a Mega from the start. Isolating the product from outside comms seems like a major limitation. To get back to the main point I had planned on using software serial but was unable to resolve the issue of parity settings other than the default of none.

CRC
12-04-2013, 02:41 PM
I ordered up a couple of Teensy 3.0s and would like to use them with my arlcd. They have since updated their library a bit. Would you consider modifying the current LCD library?

PaulStoffregen
12-04-2013, 04:16 PM
Well, looks Earth did not merge my edits the first time around. Is that right?

If they commit to merging the Teensy3 changes into their published code, I might redo this. But it hardly seems worthwhile to go through the effort again, if they're not going to merge it and I'll only have to keep redoing it over and over.

I really need to hear from Randy on this one.

CRC
12-04-2013, 07:03 PM
Yea I see your point. It doesn't look like the edits are in the current release. I hope they do decide to merge it. I have been trying to use the arLCD to control a device and display information from it via RS232. They were kind enough to work on freeing up a serial port through the GPU but the delays are just too much. When my device responds to a button command and returns updated information for the display there is a delay that accumulates to the point the display has to catch up once the button is released. It would be nice to have the extra horsepower of the Teensy with the advantages their graphics system provides. Then again it could very well be me not knowing what the heck I'm doing. That's likely a safe bet. :p

PaulStoffregen
12-04-2013, 07:37 PM
Teensy3 should be perfect for that. There's 3 hardware serial points, all with proper interrupt-based buffering. You can send or receive stuff on the other 2 while using Serial1 for arLCD.

Hopefully Randy will chime in here regarding Earth's intentions with Teensy and arLCD. I'm willing to redo the code, but only if they're going to merge it. Otherwise, I think the best approach would be to recommend a different LCD (I do have a really nice one in mind, with a GPU, and it's about the same price as arLCD). Edit: But arLCD is really quite nice and has some great advantages.... if only Earth would be willing to merge the code.

CRC
12-04-2013, 08:05 PM
The Teensy sounds great. I can't wait for them to arrive!

CRC
12-05-2013, 07:41 AM
What's the LCD you speak of?

Robermeyer
12-06-2013, 11:39 PM
There are other options for outdoor readable displays. The ezLCD313 is outdoor readable and 320x240 also.

PaulStoffregen
12-07-2013, 12:01 AM
Robermeyer, does the ezLCD313 have an Arduino library that would work with Teensy?

I just downloaded ezLCD313.zip and ezLCD313p.zip from this page (http://store.earthlcd.com/Downloads/ezLCD-3xx-210_Firmware), which was linked from here (http://store.earthlcd.com/ezLCD-313). Neither contains ANY .cpp or .h files, nor anything else that looks like a library which could be imported to Arduino and compiled with Arduino+Teensyduino.

Robermeyer
12-07-2013, 12:02 AM
As Randy has already mentioned to you, the arLCDLib has evolved a lot since you looked at it.
Considerable changes were made to it. See 2.11 Beta5 on the arLCD/Yahoo site.

Today is the first I have seen of your changes. Most of them are related to changing Serial to arSerial which are not of concern to me.
The other changes relate to the timeout function which testing has shown your delays are not usable. (To small)
Since timeouts are only in place to protect the application should something bad happen, having them long should not be an issue.
The commands end when the CR comes back, not related to timeout. With timeout too short various commands will fail what will seem randomly.

Robermeyer
12-07-2013, 12:12 AM
The ezLCD313 can simply be connected to the Teensyduino primary serial port and use the same arLCDLib files. No Arduino required.
The connections are the same for all of our ezLCD3xx displays. I am not clear on how you get to Serial1 so your library tweeks might be required.
You need to connect, TX, RX, RESETn, 3.3V and GND.

There is a new board called EarthMake+ that does it for you if you don't want to wire it up.
I would think connecting your Teensyduino would be a perfect match since the Arduino is redundant and much slower.
With the file system additions in 2.11 this would be a pretty nice combination.

Robermeyer
12-07-2013, 12:54 AM
One small caveat I ran into is the GPU's bootup time. If you just upload code to Teensy3, it works great. But at powerup, the GPU spends about 2 seconds booting up and displaying a splash screen.

I believe the GPU holds the on-board '328 chip in reset mode while it's busy. But if you connect an external board like Teensy to use the LCD, a delay is needed. Here's the modified setup() function for that analogMeter example.



The arLCD does not hold or change the Atmel CPU reset except when it is used to program the Atmel (FTDI emulation). The Arduino has a delay of ~3.5 seconds on reset. If the Teensy does not have that delay it will come up before the GPU expects. The GPU can reset the Atmel and/or Teensy by connecting IO1 to RESETn. Then in the startup file drive IO1 low and then high for 10msec and it will all be in sync.
"
CFGIO 1 OUTPUT
IO 1 LOW
pause 10
IO 1 HIGH
CFGIO 1 INPUT

PaulStoffregen
12-07-2013, 01:59 AM
Today is the first I have seen of your changes.


It's unfortunate Randy didn't forward my work to you. I put in a least a few hours editing the code and testing Teensy3 with arLCD, with the expectation we could look forward to have these 2 products work together nicely.



Most of them are related to changing Serial to arSerial which are not of concern to me.


I'm trying to understand what you mean by this? When you say it's "of no concern", does that mean you'd be willing to merge those changes into the arLCD library? Or does it mean you couldn't care less?

The change from Serial to arSerial, where arSerial can be either Serial or Serial1, is necessary for Teensy. On all Teensy boards, and on Arduino's Leonardo and Yun and others, "Serial" is a USB virtual serial port which can't be connected to those 2 pins on an arLCD. If the library can't adapt to using Serial1, then it's simply not possible to use Teensy with arLCD (nor Leonardo, Yun & others), because all the commands that ought to go to arLCD would be send to the USB port.



The other changes relate to the timeout function which testing has shown your delays are not usable. (To small)
Since timeouts are only in place to protect the application should something bad happen, having them long should not be an issue.


I tried to measure the timing and substitute code that would give the same timeouts. Looks like I got it wrong?

The trouble I saw was that the timeouts, at least in the code I edited weeks ago, were based on the number of times a busy loop executes. That's perfectly fine if the library always runs on the exact same AVR chip. But when running this code on a much faster ARM processor, like the one on Teensy 3.0, the loop will execute in less time, thereby shortening the timeout.

My intention was never to shorten or change the timeout length in any way. I only wanted to change it from depending upon the CPU speed to relying on Arduino's millis() function, so the timeout will remain exactly the same when the code runs on different Arduino compatible boards.



The ezLCD313 can simply be connected to the Teensyduino primary serial port and use the same arLCDLib files.


That's great.

But if arLCDlib is missing these changes, how could anyone who wants to buy a ezLCD313 expect to use it with a Teensy?

That's the main issue here. I made these changes so people could use arLCD or ezLCD with Teensy 3.0. Sadly, it seems Randy did not communicate these changes to you, and now much more development has happened on arLCDlib without these changes included, which means people can't use arLCD with a Teensy 3.0.

Constantin
12-07-2013, 03:07 AM
I have perhaps a silly question, so please bear with me.

For the price point involved, it seems that there are alternatives out there. Specifically, I would consider the combination of the $40 800x400 TFT (http://www.adafruit.com/products/1596), a optional $10 touch screen controller (http://www.adafruit.com/products/1571), and a $35 driver board (http://www.adafruit.com/products/1590) to achieve something that on paper has better specs and which does much of the work in hardware for you. This combination does not come with a nice flush-mount system but offers a higher resolution. Mount the TFT in a appropriate enclosure and you have yourself a very sleek 5" touchscreen with a 800x400 resolution for about $80 (plus 4 analog pins your teensy 3 board).

Robermeyer
12-07-2013, 04:17 AM
Paul,
You and I are not in disagreement here. Randy keeps me busy pretty much 24/7. He is extremely busy as well. They say the squeaky wheel gets the grease. I got this link from Randy today with a discussion to look it. My comments were based on what I saw here. I did not do any testing of your library because of time constraints.
Since our library is way ahead of what you had it only makes sense to update the latest instead of me trying to backup 2 months and try and merge anything. I will not be making any changes to that library for a week or so. This would allow time to tweak the library and test it as the new formal release.

My comments of no concern means, I have no concerns about those changes. I see no reason your changes would not work. You probably have more idea of the impact on products beyond the arLCD than we do. Your timeout changes based on a timer make more sense but when your comments in the library indicate a delay of half year I am concerned. We only need 500ms delay max. However that comes out in your timer routine should work. The function waitforcrno means wait for CR with no time out. Your comments indicated you think we want a timeout.

Bottom line is if you make the updates to the new library I will test and release it if it gets done in time.
I will also release an app note showing how to connect the complete ezLCD3xx line to the Teensy including the startup files and libraries. With the 2.11 release we will be including the Arduino library with the ezLCD3xx products too.

Constantin,
Your solution is not the same functionality as an arLCD. The widgets and messaging for that solution is not complete. It's going to take a lot of work by the user to make it useful.

PaulStoffregen
12-07-2013, 04:43 AM
Since our library is way ahead of what you had it only makes sense to update the latest instead of me trying to backup 2 months and try and merge anything.


Ok, I'll give this another try. If I turn this around within the next week, it's not going to be forgotten or go unused, right?

Can you please post the latest code I should use?

EDIT: I do not have access to whatever yahoo group you're using. I do not even know its name. I found this (http://groups.yahoo.com/neo/groups/arLCD/info), but nothing is visible and clicking the "Group Website" link says the page doesn't exist. Can you please post the zip file here? This forum allows zip files to be attached to messages. When replying, click the "Go Advanced" button, then the page will have a button you can use to attach a zip file. You can also email the code directly to me (paul at pjrc dot com), if it's confidential. But I'd prefer if you posted the 2.11 beta5 (or whatever version I should use as a starting point) zip file here, if that's ok?

PaulStoffregen
12-07-2013, 05:48 AM
Constantin,
Your solution is not the same functionality as an arLCD. The widgets and messaging for that solution is not complete. It's going to take a lot of work by the user to make it useful.


I just took a quick look. Limor & Kevin appear to have written a pretty nice Arduino library (https://github.com/adafruit/Adafruit_RA8875) for this chip+LCD, which builds on top of their GFX library that provides a pretty complete set of drawing features. I imported the 2 libraries into Arduino 1.0.5 and both compile without error for Teensy 3.0. I don't have the actual LCD to verify if it actually works with Teensy3, but maybe I ought to buy one? I looked briefly at their code. It appears to be built very cleanly on top of the SPI library (no AVR SPSR & SPDR as many of their older libs... which work on Teensy3 anyway), so I'm pretty sure it will "just work" on Teensy 3.0 and any other Arduino compatible board with SPI.

So far, Adafruit's library has only 3 pretty minimal examples, whereas arLCD has many. It's not clear to me if Adafruit's code really leverages the GPU and display buffer for bitmaps or custom font. The code seems to GPU optimize only text with 4 sizes of a built-in font and basic shapes.

Constantin
12-07-2013, 11:28 AM
I don't have the actual LCD to verify if it actually works with Teensy3, but maybe I ought to buy one?

Adafruit order #391239 should arrive at your doorstep sometime next week. It's the least I can do after all you have done for the community here. Yet another project that you can add to the large stack you already have but if it works, it would fill a hole in terms of the product offerings that people can assemble with a Teensy 3. Merry Christmas, Fröhlicher Advent, Happy Hannukah, Joyous Kwanzaa, and all that. :D

Robermeyer
12-07-2013, 10:55 PM
Paul here is the latest beta version from the yahoo arlcd site.
i think it should be pushed to Github after the update. Are you familiar with that process?

we should consider making a cable to connect any ezLCD3xx to the Teensy.
what is that second ARM processor on the Teensy3.0 for?
How do you connect up the power? 5V or 3.3

PaulStoffregen
12-08-2013, 12:37 AM
I'm working with the code now.

Last time, I replaced timeOutCount with timeOutMilliseconds, which is in units of actual milliseconds using Arduino millis() function.

timeOutCount is assigned values 665000, 65000, 2000000, and 128000. I believe these will actually implement about 3.8 sec, 0.37 sec, 11.6 sec, and 0.74 sec timeouts, when running on the 16 MHz '328 chip. Are those the timeouts you intended?

PaulStoffregen
12-08-2013, 01:23 AM
Ok, here it is, working again with Teensy3.

CRC
12-08-2013, 01:35 AM
I'll be waiting like a dog by the mail box Monday. I can't wait to try this. Thanks to all of you for working on it.

Robermeyer
12-10-2013, 12:54 AM
Ok, here it is, working again with Teensy3.

I copied it over and it worked on my latest arLCD Pong game out of the box.
I ran the file system test and button static test and they worked OK too.
Still got some more tests but I'm willing to give you high five so far.:cool:

CRC
12-11-2013, 02:52 AM
I think I found some sort of bug. The arLCD list a more appropriate place for this most likely but figured I would post here as well since I'm using the Teensy3 and the latest posted modded library. I have not tried this screen configuration with the imbedded Arduino driving the device yet to try to duplicate the error.

I have 1/2 of my lower screen filled with buttons. I want to setup four touch zones above the buttons to activate upon press of changing "soft button" text. Above that is the main displayed information. To facilitate an easier visualization of where the touch zones would go I created duplicate sized buttons and placed them first. I then un-commented them and enabled the touch zones with duplicate sizing and placement. While doing so I noticed that not all the temporary viual buttons would indicate. I tried resizing and moving around a bit but no matter how hard I tried only two would show up. They were widget numbers 18-21 and the last in the list in setup. I noticed that upon bootup the device seems to draw the widgets in order of their numerical value. I placed the four temporary buttons at the beginning of setup and found they drew fine. However, my last two buttons went missing instead. It's as if 19 buttons can be drawn max and the rest are pushed out of some list. I tested this with the touch zones and they behave the same. Although they can't be seen their lack of response indicates they follow the same pattern or rule or whatever. I have attached some pictures to try to illustrate what I'm describing. The touch zones would be where the four large buttons above the keypad are behind the changing "soft menu" text that comes in via serial from the device and changes in response to being touched.

How it is inteded to lookin final configuration when using only touch zones (T/R and BAND work but the SQ and DSP do not) they are missing like the second image and are non functional.
1178

four "visual test" buttons placed at the end of the widget list in setup cause the SQ and DSP positions to disappear
1179

four "visual test" buttons placed at the beginning of the widget list in setup cause TUNE UP and TUNE DOWN buttons to disappear
1180

Robermeyer
12-11-2013, 03:53 AM
Instead of putting a button to show where the touchzone is, turn on shadow and the touchzone area show up.
Shadow ON color linetype linethickness
You can turn it back off after you know it works.
I would have to see your code to understand what's not working or what is causing the problem.
I have a Teensy if that causes the problem.
Its hard to say what it is without seeing it in action.

CRC
12-11-2013, 05:42 AM
Thanks for the tip on the shadow technique I will try that.

Also, do you know of any ideas on speeding up the drawing of larger than size 1 or 0 fonts? Since the device spits out that text all in one string I'm trying to figure out a way to only print what changes. That was part of why I went to the trouble of printing each character individually, the hope of coming up with a way to do that, instead of just one row at a time.







//Radio serial interface uses ODD parity
//Appears widgets must be listed in order as they appear on the screen from top to bottom
//characters printed individually for detailed placement control, soft menu text must be separated into groups


#include <ezLCDLib.h>
#define LED_PIN 13
ezLCD3 lcd;
int option = 1; // 1=draw, 2=disabled, 3=toggle pressed, 4=toggle not pressed,
// 5=toggle pressed disabled, 6=toggle not pressed disabled.
int touch=0;
char rxdata[30];
uint8_t opCode;
uint8_t subopCode;
uint8_t packetBegin;
uint8_t packetLength;
uint8_t appendedLength;

uint8_t specialReports[9] = {
0x24,0x04,0x18,0x29,0x00,0x01,0x2E,0x98,0x03}; // enable serial data reporting
uint8_t acknowledge[6] = { // ack requred to get next packet from radio
0x24,0x01,0x10,0xF3,0x28,0x03};
uint8_t tuneUp[10] = {
0x24,0x05,0x18,0x36,0xFE,0x7B,0xEF,0x01,0xE0,0x03, };
uint8_t tuneDown[10] = {
0x24,0x05,0x18,0x36,0xDF,0x7B,0xEF,0x01,0xC1,0x03} ; // down button command
uint8_t buttonRelease[10] = {
0x24,0x05,0x18,0x36,0xFF,0x7B,0xEF,0x01,0xE1,0x03} ; // button release command
uint8_t button1[10] = {
0x24,0x05,0x18,0x36,0xFF,0x79,0xEF,0x01,0xDF,0x03} ; // keypad button 1
uint8_t button2[10] = {
0x24,0x05,0x18,0x36,0xFF,0x3B,0xEF,0x01,0xA1,0x03} ; // keypad button 2
uint8_t button3[10] = {
0x24,0x05,0x18,0x36,0xFF,0x7B,0xE7,0x01,0xD9,0x03} ; // keypad button 3
uint8_t button4[10] = {
0x24,0x05,0x18,0x36,0xFF,0x5B,0xEF,0x01,0xC1,0x03} ; // keypad button 4
uint8_t button5[10] = {
0x24,0x05,0x18,0x36,0xFF,0x7B,0xEB,0x01,0xDD,0x03} ; // keypad button 5
uint8_t button6[10] = {
0x24,0x05,0x18,0x36,0xFF,0x7B,0x6F,0x01,0x61,0x03} ; // keypad button 6
uint8_t button7[10] = {
0x24,0x05,0x18,0x36,0xFF,0x7B,0xAF,0x01,0xA1,0x03} ; // keypad button 7
uint8_t button8[10] = {
0x24,0x05,0x18,0x36,0xF7,0x7B,0xEF,0x01,0xD9,0x03} ; // keypad button 8
uint8_t button9[10] = {
0x24,0x05,0x18,0x36,0xFF,0x7A,0xEF,0x01,0xE0,0x03} ; // keypad button 9
uint8_t button0[10] = {
0x24,0x05,0x18,0x36,0x7F,0x7B,0xEF,0x01,0x61,0x03} ; // keypad button 0
uint8_t buttonAsterisk[10] = {
0x24,0x05,0x18,0x36,0xFB,0x7B,0xEF,0x01,0xDD,0x03} ; // keypad button *
uint8_t buttonPound[10] = {
0x24,0x05,0x18,0x36,0xFF,0x6B,0xEF,0x01,0xD1,0x03} ; // keypad button #
uint8_t buttonMENU[10] = {
0x24,0x05,0x18,0x36,0xFF,0x7B,0xEF,0x00,0xE0,0x03} ; // keypad button MENU
uint8_t buttonPesc[10] = {
0x24,0x05,0x18,0x36,0xEF,0x7B,0xEF,0x01,0xD1,0x03} ; // keypad button Pesc
byte buttonEnter[10] = {
0x24,0x05,0x18,0x36,0xFF,0x7B,0xED,0x01,0xDF,0x03} ; // keypad button Enter
byte moreKey[10] = {
0x24,0x05,0x18,0x36,0xFD,0x7B,0xEF,0x01,0xDF,0x03} ; // more key
byte f1Key[10] = {
0x24,0x05,0x18,0x36,0xBF,0x7B,0xEF,0x01,0xA1,0x03} ; // soft key F1
byte f2Key[10] = {
0x24,0x05,0x18,0x36,0xFF,0x73,0xEF,0x01,0xD9,0x03} ; // soft key F2
byte fThreeKey[10] = {
0x24,0x05,0x18,0x36,0xFF,0x7B,0xEE,0x01,0xE0,0x03} ; //soft key F3
byte fFourKey[10] = {
0x24,0x05,0x18,0x36,0xFF,0x7B,0xCF,0x01,0xc1,0x03} ; // soft key F4


void setup()
{
Serial2.begin(9600, SERIAL_8O1);
lcd.begin( EZM_BAUD_RATE );
lcd.cls( BLACK, WHITE );
lcd.fontw(1, "sans24");
lcd.theme( 1, 1, 48, 0, 23, 3, 2, 1, 5, 1, 1); //small button theme ( 1, 1, 48, 0, 23, 3, 2, 1, 5, 1, 1 );
lcd.theme( 2, 1, 48, 0, 23, 3, 1, 105, 5, 1, 1 ); //tune buttons theme
lcd.fontw(1,"1");
lcd.theme( 3, 1, 48, 0, 23, 3, 2, 1, 5, 1, 1 ); //ENT button theme


//lcd.button( 18, 5, 110, 70, 30, 1, 0, 3, 1, 1 ); // just test buttons before I knew about shadowing
// lcd.button( 19, 85, 110, 70, 30, 1, 0, 3, 1, 1 );
//lcd.button( 20, 165, 110, 70, 30, 1, 0, 3, 1, 1);
// lcd.button( 21, 245, 110, 70, 30, 1, 0, 3, 1, 1 );


lcd.slider( 22, 80, 0, 140, 25, 1, 255, 1, 0, 1); //Slider must be at top to appear
// Will be used for volume later on

lcd.string( 1, "1" ); // stringId 1
lcd.button( 1, 0, 150, 40, 30, 1, 0, 3, 1, 1 );
lcd.string( 2, "2" ); // stringId 1
lcd.button( 2, 40, 150, 40, 30, 1, 0, 3, 1, 2 );
lcd.string( 3, "3" ); // stringId 1
lcd.button( 3, 80, 150, 40, 30, 1, 0, 3, 1, 3 );
lcd.string( 4, "4" ); // stringId 1
lcd.button( 4, 0, 180, 40, 30, 1, 0, 3, 1, 4 );
lcd.string( 5, "5" ); // stringId 1
lcd.button( 5, 40, 180, 40, 30, 1, 0, 3, 1, 5 );
lcd.string( 6, "6" ); // stringId 1
lcd.button( 6, 80, 180, 40, 30, 1, 0, 3, 1, 6 );
lcd.string( 7, "7" ); // stringId 1
lcd.button( 7, 0, 210, 40, 30, 1, 0, 3, 1, 7 );
lcd.string( 8, "8" ); // stringId 1
lcd.button( 8, 40, 210, 40, 30, 1, 0, 3, 1, 8 );
lcd.string( 9, "9" ); // stringId 1
lcd.button( 9, 80, 210, 40, 30, 1, 0, 3, 1, 9 );
lcd.string( 10, "*" ); // stringId 1
lcd.button( 10, 120, 150, 40, 30, 1, 0, 3, 1, 10 );
lcd.string( 11, "0" ); // stringId 1
lcd.button( 11, 120, 180, 40, 30, 1, 0, 3, 1, 11 );
lcd.string( 12, "#" ); // stringId 1
lcd.button( 12, 120, 210, 40, 30, 1, 0, 3, 1, 12 );
lcd.string( 13, "MENU" ); // stringId 1
lcd.button( 13, 160, 150, 50, 30 , 1, 0, 3, 3, 13 );
lcd.string( 14, "Esc" ); // stringId 1
lcd.button( 14, 160, 180, 50, 30, 1, 0, 3, 3, 14 );
lcd.string( 15, "ENT" ); // stringId 1
lcd.button( 15, 160, 210, 50, 30, 1, 0, 3, 1, 15 );
lcd.string( 16, "TUNE UP" ); // stringId 1
lcd.button( 16, 210, 150, 110, 45, 1, 0, 3, 1, 16 );
lcd.string( 17, "TUNE DOWN" ); // stringId 1
lcd.button( 17, 210, 195, 110, 45, 1, 0, 3, 1, 17 );
// the problematic touch zones...everything else seems to work normally
lcd.touchZone( 18, 5, 110, 30, 40, 1);
lcd.touchZone( 19, 85, 110, 30, 40, 1);
lcd.touchZone( 20, 165, 110, 30, 40, 1);
lcd.touchZone( 21, 245, 110, 30, 40, 1);

Serial2.write(specialReports,9); // starts up the aux serial port
}

void loop()
{

int touch = touch;
touch = lcd.wstack(0);

if (( lcd.currentWidget == 1 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(button1,10);
}
else if (( lcd.currentWidget == 1 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 2 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(button2,10);
}
else if (( lcd.currentWidget == 2 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 3 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(button3,10);
}
else if (( lcd.currentWidget == 3 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 4 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(button4,10);
}
else if (( lcd.currentWidget == 4 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 5 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(button5,10);
}
else if (( lcd.currentWidget == 5 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 6 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(button6,10);
}
else if (( lcd.currentWidget == 6 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 7 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(button7,10);
}
else if (( lcd.currentWidget == 7 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 8 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(button8,10);
}
else if (( lcd.currentWidget == 8 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}
if (( lcd.currentWidget == 9 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(button9,10);
}
else if (( lcd.currentWidget == 9 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 10 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(buttonAsterisk,10);
}
else if (( lcd.currentWidget == 10 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 11 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(button0,10);
}
else if (( lcd.currentWidget == 11 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 12 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(buttonPound,10);
}
else if (( lcd.currentWidget == 12 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 13 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(buttonMENU,10);
}
else if (( lcd.currentWidget == 13 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonPesc,10);
}

if (( lcd.currentWidget == 14 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(buttonPesc,10);
}
else if (( lcd.currentWidget == 14 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 15 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(buttonEnter,10);
}
else if (( lcd.currentWidget == 15 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 16 )&& ( lcd.currentInfo == PRESSED )) { //tune up button command
delay(2);
Serial2.write(tuneUp,10);

}
else if (( lcd.currentWidget == 16 )&& ( lcd.currentInfo == RELEASED )) { //button release command so radio doesn't free run
delay(2);
Serial2.write(buttonRelease,10);

}

if (( lcd.currentWidget == 17 )&& ( lcd.currentInfo == PRESSED )) { //tune up button command
delay(2);
Serial2.write(tuneDown,10);

}
else if (( lcd.currentWidget == 17 )&& ( lcd.currentInfo == RELEASED )) { //button release command so radio doesn't free run
delay(2);
Serial2.write(buttonRelease,10);

}

if (( lcd.currentWidget == 18 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(f1Key,10);
}
else if (( lcd.currentWidget == 18 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 19 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(f2Key,10);
}
else if (( lcd.currentWidget == 19 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 20 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(fThreeKey,10);
}
else if (( lcd.currentWidget == 20 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (( lcd.currentWidget == 21 )&& ( lcd.currentInfo == PRESSED )){
Serial2.write(fFourKey,10);
}
else if (( lcd.currentWidget == 21 )&& ( lcd.currentInfo == RELEASED )) {
Serial2.write(buttonRelease,10);
}

if (Serial2.available()) {
int i=0;
for (i=0;i<30;i++) { // read the entire packet into rxdata
delay(5);
rxdata[i] = Serial2.read();
//rxdata[i+1] = '\0';
}
}

int L;
packetBegin = rxdata[0];
packetLength = rxdata[1];
appendedLength = rxdata[7];// for ack appended to incoming packet that skews offsets
opCode = rxdata[3];
subopCode = rxdata[4];
L = packetLength;

//if (rxdata[L+4] == 0x03 && rxdata[2] != 0x80) {
//if (rxdata[0] == 0x24){
//delay(25);
// Serial2.write(acknowledge,6);
//}
//else if (rxdata[2] == 0x80 && appendedLength+0x04 == 0x03){
// Serial2.write(acknowledge,6);
//}

if (packetBegin == 0x24) {
delay(22);
Serial2.write(acknowledge,6);
}

if (rxdata[2] == 0x80){
opCode = rxdata[9];
subopCode = rxdata[10];
}

if (opCode == 0x2E && subopCode == 0x02 && rxdata[2] != 0x80){ // menu

lcd.color(DARKSLATEGRAY);//background color
lcd.xy(0,0);
lcd.box(80,25,FILL);
lcd.color(YELLOW);
lcd.font(0);
lcd.xy(0,0);
lcd.print(rxdata[7]);
lcd.print(rxdata[8]);
lcd.print(rxdata[9]);
lcd.print(rxdata[10]);
lcd.print(rxdata[11]);
lcd.xy(0,0);

}

// for ack appended to incoming packet that skews offsets
else if (opCode == 0x2E && subopCode == 0x02 && rxdata[2] == 0x80){
lcd.color(DARKSLATEGRAY);//background color
lcd.xy(0,0);
lcd.box(80,25,FILL);
lcd.color(LIME);
lcd.font(0);
lcd.xy(0,0);
lcd.print(rxdata[13]);
lcd.print(rxdata[14]);
lcd.print(rxdata[15]);
lcd.print(rxdata[16]);
lcd.print(rxdata[17]);
lcd.xy(0,0);
}


if (opCode == 0x2E && subopCode == 0x03 && rxdata[2] != 0x80) { //frequency display

lcd.color(BLACK);
lcd.xy(0,50);
lcd.box(319,55,FILL);
lcd.color(YELLOW);
lcd.font("VER37");
lcd.xy(0,50);
lcd.print(rxdata[7]);
lcd.print(rxdata[8]);
lcd.print(rxdata[9]);
lcd.print(rxdata[10]);
lcd.print(rxdata[11]);
lcd.print(rxdata[12]);
lcd.print(rxdata[13]);
lcd.print(rxdata[14]);
lcd.print(rxdata[15]);
lcd.print(rxdata[16]);
lcd.print(rxdata[17]);
lcd.xy(0,50);

}

// for ack appended to incoming packet that skews offsets
if (opCode == 0x2E && subopCode == 0x03 && rxdata[2] == 0x80) { // alt frequency display for skewed offsets due to pre-pended junk ack packet

lcd.color(BLACK);
lcd.xy(0,50);
lcd.box(319,55,FILL);
lcd.color(YELLOW);
lcd.font("VER37");
lcd.xy(0,50);
lcd.print(rxdata[13]);
lcd.print(rxdata[14]);
lcd.print(rxdata[15]);
lcd.print(rxdata[16]);
lcd.print(rxdata[17]);
lcd.print(rxdata[18]);
lcd.print(rxdata[19]);
lcd.print(rxdata[20]);
lcd.print(rxdata[21]);
lcd.print(rxdata[22]);
lcd.print(rxdata[23]);
lcd.xy(0,50);

}

if (opCode == 0x2E && subopCode == 0x04) { // soft buttons where the touch zones will be
lcd.color(BLACK);
lcd.xy(0,115);
lcd.box(319,20,FILL);
lcd.color(LIME);
lcd.font(0);
lcd.xy(20,115);
lcd.print(rxdata[7]);
lcd.print(rxdata[8]);
lcd.print(rxdata[9]);
lcd.print(rxdata[10]);
lcd.xy(100,115);
lcd.print(rxdata[11]);
lcd.print(rxdata[12]);
lcd.print(rxdata[13]);
lcd.print(rxdata[14]);
lcd.xy(180,115);
lcd.print(rxdata[15]);
lcd.print(rxdata[16]);
lcd.print(rxdata[17]);
lcd.print(rxdata[18]);
lcd.xy(260,115);
lcd.print(rxdata[19]);
lcd.print(rxdata[20]);
lcd.print(rxdata[21]);
//lcd.print(rxdata[22]);
lcd.xy(0,110);

}

rxdata[L+4] = 0xFF; // these reset the opcodes and prevent reprinting when
rxdata[3] = 0xFF; // the radio is idle and there is no incoming data
rxdata[4] = 0xFF;
rxdata[0] = 0xFF;
}







video doesn't show the soft button error but I can make another when I get more time

https://www.youtube.com/watch?v=wk42GEafxlg

stevech
12-11-2013, 06:00 AM
Transmissive LCDs.. with backlight... some I've used have an extra-bright CFL or LED backlight to make them more daylight readable.

PaulStoffregen
12-11-2013, 08:47 AM
Can I send you the code somehow?


If your full code is too large to post into a message with the [ code ] tags, you can attach it to your message, either as the original files or as a .zip file. Just click the "Go Advanced" button at the bottom of the message entry area. The advanced page has an "Additional Options" section where you can attach zip files.

CRC
12-11-2013, 09:30 AM
I've been up too long, totally overlooked the advanced button. Original post edited above.

Robermeyer
12-12-2013, 05:49 PM
I loaded the code and I don't see any problems.
But since I do not have the radio, Is it going to show the frequency and text?
1190

CRC
12-13-2013, 01:32 AM
I can't get four items to show up in that location at all.

No, without the radio it should not indicate anything but that should be of no consequence. Are you using the Teensy library? That's the only thing I can think that is possibly different. When I get some time this weekend I will try swapping in the original library file.

CRC
12-13-2013, 02:42 PM
I definitely like the teensy loader system. It's nearly instant and rock solid in operation!

PaulStoffregen
12-16-2013, 08:33 PM
Adafruit order #391239 should arrive at your doorstep sometime next week.

Thanks! It arrived.

I'll start a new thread when I've had a chance to work with it.

Robermeyer
12-16-2013, 10:50 PM
I can't get four items to show up in that location at all.

No, without the radio it should not indicate anything but that should be of no consequence. Are you using the Teensy library? That's the only thing I can think that is possibly different. When I get some time this weekend I will try swapping in the original library file.

I am using the Teensy library but with an arLCD.

CRC
12-24-2013, 04:58 AM
I am using the Teensy library but with an arLCD.

I don't get it. I don't see what the heck the difference could be.

Constantin
12-24-2013, 06:40 PM
Thanks! It arrived.
Just in time for the holidays... :D

But seriously, get to it whenever you like, I just wanted to put the hardware in your hands if anyone ever asked for support. What I like about this set of hardware solutions is how they appear to take over a lot of the processing so that the teensy can do whatever it needs to. Plus, there seems to be a much wider range of screen sizes and resolutions that can be driven, allowing folk to customize their projects as needed.

The only downside as I see it is that no one appears to have cracked the nut on how to mount these displays properly. All the solutions I am aware of are $$$ custom.

PaulStoffregen
12-24-2013, 09:23 PM
But seriously, get to it whenever you like, I just wanted to put the hardware in your hands if anyone ever asked for support.


Actually, I already hooked it up and it came in very handy for fixing this problem (http://forum.pjrc.com/threads/24668-Teensy-3-*-Text-rendering-issue-with-RA8875-TFT-display).

Adafruit has merged that fix to the library, so Teensy 3 is now fully supported. :)

Thanks!



What I like about this set of hardware solutions is how they appear to take over a lot of the processing so that the teensy can do whatever it needs to.


Yes.

RA8875, arLCD and Gameduino2 are the 3 libraries that currently support GPU accelerated graphics. I believe all 3 work on Teensy3. I'm going to test Gameduino2 in a couple days.

However, Earth's arLCD library and Adafruit's RA8875 appear to wait for the GPU to complete an operation before returning control to your Arduino sketch (Adafruit's library doesn't wait for the ones that are really fast, but it has delays for the slower commands). You still get the speed of a GPU, I suppose, but a fully synchronous protocol means your code can't be working on the next command or something else while the GPU works. I haven't studied the Gameduino2 code in detail yet, so I can't say how it works. I'll know soon...

I should also mention UTFT is very fast with Teensy 3.1, but it does require connecting 12 signals.




Plus, there seems to be a much wider range of screen sizes and resolutions that can be driven, allowing folk to customize their projects as needed.


Adafruit's RA8875 library supports exactly 2 sizes. Perhaps in theory the hardware might be able to support a wide range.



The only downside as I see it is that no one appears to have cracked the nut on how to mount these displays properly.

Indeed. I have the one you sent with a board dangling off the flexcable. I'll probably just mount it to the back side with some double-sticky tape.