Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 13:55 30 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Object Methodology

Author Message
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 06:42pm 06 Nov 2013
Copy link to clipboard 
Print this post

Good evening all..!

Currently spending a little free time happily creating some screen objects for the TFT-MM... One of the first UI objects I want to try is a simple numeric keypad to enter ask for values needed for a setup program. So, after playing with some Touch Sizes, seems like 50,50 makes a button about finger size on the screen. After creating the basic "phone pad" layout, it seemed to look ok. While I was tinkering, I started to think about what would be the "proper" way to create different kinks of "ready to go" UI objects and get a library going that everyone could use. Now on a scale of 1-10, I am about a 2 (knows just enough to be dangerous) code writer...

Having said that, I would entertain starting a discussion about the "do's and do-not's" of good UI object creation. Now, being a "nubbie" at most of it, I figure a few good questions about understanding how things work on the TFT-MM should get the pot boiling...

1} Should UI objects be written as functions.?
Example: my_num = key_num(max_keys,min_val,max_val)

2) within a function, can you create and dispose of objects without disturbing other active objects in the main program.?

3) What is the proper method of overlaying a UI object, like the numeric keypad for example, on an already existing screen and returning control back to the main program, screen and any active objects of the main program in tact.?

4) is it a good idea to use the touch interrupt to change the color of the touched key, then wait for release.?

I can think of many more questions... But, before I babble along to much, I would like some feedback on how "we as a group of coders" could develop a working set of rules and structures to properly create a good reusable UI library that everyone could use...

Any feedback would be welcome reading... (level 2 "nub" class here)

Thanks..!!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 05:18am 07 Nov 2013
Copy link to clipboard 
Print this post

Hi Zonk,

You are probably not going to get many answers as you are one of the first people on the planet with a TFT Maximite. So, I thought that I would chime in.

1. It would be great to encapsulate everything in a single function - if you could. It would be so simple to use that there would be little to go wrong when people used it.

2. If the controls were created in an empty part of the screen you should be OK to create and remove them at will inside a function. I am not exactly sure what would happen if they overlapped something already there - probably chaos.

For people who are not familiar with the TFT-MM (99,9% of the people on this forum) a control is something created by MMBasic on the screen like a button or LED or switch that can respond to touch. They can be created and removed by the running program.

3. I don't think that you should overlay controls. The controls were not designed with that in mind.

4. Using the interrupt facility would be an excellent way to go. Most controls animate when you press them and return a value when released but that is not a hard and fast rule.

Again , for anyone not familiar with the TFT-MM, you can attach an interrupt to a control so that when it is touched the interrupt function will be called.

When you get your new UI objects running you should package them up so that they could be loaded with the LIBRARY command. That would make it easy to incorporate them into other programs.

Geoff


Geoff Graham - http://geoffg.net
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 01:01pm 07 Nov 2013
Copy link to clipboard 
Print this post

Good evening Geoff..

I had no idea that there wasn't already a small group working on these LCD versions.! Well.. Let's get this party started. Thanks for the info on basic do's and do not's.. I think most created UI objects will be taking up major portions on the screen, so you could pass the function an easy display position like (L or R). The user of the function then would need to remove any objects in the used area before calling the UI function. Ok... Now, another question.. Let's say the user in the main program creates 3 objects, declaring object numbers or 0,1,and 2. If the UI function also declares the same object numbers and then removes them before exiting, will that affect the object list in the main program.? I guess what I am trying to say... Is the object list stack based.? If so, then creating, using, and removing UI LIBRARY objects should be transparent to the function user... (sweet) If not, then maybe it's possible to reserve a group of object numbers as "never use" while using UI functions.. Not sure about this one..

Anyway, I think this is an awesome implementation of the MM project.!! I hope we can get a group going on this version of the hardware. it's time to UI..
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1328
Posted: 05:12pm 07 Nov 2013
Copy link to clipboard 
Print this post

Hi Geoff and Zonker,

I'm going to have a go setting up a TFT-Maximite to use as a caravan battery monitor system a la Panky's system - but replacing the VGA screen with the touch TFT LCD one. I think the touch-screen would be ideal to bring up different screens showing different info without making it un-readably small and too "busy". I'd prefer to use the slightly bigger 5" (Innolux?) screen too as Jman and Zonker have done. I'm confused on a few things though:

- Geoff's TFT-MM website mentions several 4.3" TFT screens, one of which is used (I think) in the c't magazine kit. Geoff mentions they are a more modern (better?) screen than the Innolux, which I think is a PSP? screen - what is the difference in these? Which 5" screen is used in the c't magazine optional 5" kit?

- Zonker, you mentioned in your final post in the earlier thread (2nd Oct) that the 5" Innolux didn't need to have the X & Y drive pins connected to the Maximite H&V sync pins. How does this work?

- Geoff, are the H&V sync hardware signal timing changes made by Bovist (and Mick) still necessary with the new V4.4b firmware, or does the firmware do it all?

- that Newhaven 40 pin 0.5mm to 0.1" converter is expensive, and more-so to get here to Oz. The combination ones for different pitches available on e-Bay are a better price but are a bit big and clunky. Does someone have a number/supplier for just the male 40pin, 0.5mm socket so that we can make up a neat converter of our own and also be able to incorporate the socket directly onto a board design.

Greg
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 07:12pm 07 Nov 2013
Copy link to clipboard 
Print this post

Good evening Greg..

Just got back from choir practice.. The earlier post (I think) was talking about the signals on the 40 pin display connector. The Hsync (pin 32) and Vsync (pin 33) signals are not needed for the 5" display.. But you should connect them up anyway to be compatible with the 4.3" unit. that way, you can plug-in either unit. I know the way that the 4.3" unit interfaces the touch pad is different and does not use the last four pins as the 5"... The InnoLux PDF file suggest to us a HIROSE FH19SC-40S-0.5SH connector, but there are many different ones that should work. I have created an Eagle part for this connector.. (it's small!) I used the Newhaven board to compact the 40 wires into a 16 pin IDC connector for the prototype build. It just made it easer to get the wiring done.. I too was thinking about creating a PCB of this "MM-Panel" I am trying to figure out if there is any left over I/O pins from the other group of pins that can be brought out to get the MAX I/O I can. I am still creating the parts, but want to complete a schematic in Eagle of the project, but I am still in the "creating library parts" stage... However, I did manage to tinker around with my first UI object, the "get_num" function will collect a number from the user, check for proper value ranging, and return the entered number data back to the caller.

Example: mynumber = get_num(L,0,350)
get user number, Left side, minval=0 maxval=350



One thing I found out... Fingers are big...
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 09:27pm 07 Nov 2013
Copy link to clipboard 
Print this post

  Zonker said  Now, another question.. Let's say the user in the main program creates 3 objects, declaring object numbers or 0,1,and 2. If the UI function also declares the same object numbers and then removes them before exiting, will that affect the object list in the main program.? I guess what I am trying to say... Is the object list stack based.? If so, then creating, using, and removing UI LIBRARY objects should be transparent to the function user... (sweet) If not, then maybe it's possible to reserve a group of object numbers as "never use" while using UI functions.

The reference numbers are global - so you will have to reserve a block of numbers for your functions.

  paceman said  Geoff, are the H&V sync hardware signal timing changes made by Bovist (and Mick) still necessary with the new V4.4b firmware, or does the firmware do it all?

The timing for a LCD is different than VGA and the firmware caters for that. But you still need the delay in the framing input to the PIC32. The best way is to duplicate Bovist's circuite on github (link is on my website).

I can't really help on the hardware aspects like compatible LCDs, etc as I did not develop the LCD interface (Bovist did). But I can tell you something, every manufacturer has different timing and connections to the LCD so you should make sure that you buy something that you know works.

Geoff
Geoff Graham - http://geoffg.net
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 10:14pm 07 Nov 2013
Copy link to clipboard 
Print this post

There are two ways to preserve what is under a control.
You could copy the area which you are going to use and when the control is done you can write that image back. SAVEBMP/LOADBMP can do that, but i do not know if it is fast enough. Even simpler is to just copy the whole screen.

Another way is to have a 'paint' option in every control.
If called then it will repaint itself. Windows uses that strategy a lot.
You would need to know the order in which they were drawn on the screen but that is relatively simple to maintain in an array.
When you remove a control you simply call the 'paint' function of every control previously drawn that occupies a part of that screen.

Some bookkeeping required, but it should not be too difficult.



Microblocks. Build with logic.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 10:47pm 07 Nov 2013
Copy link to clipboard 
Print this post

The system used here is a lot simpler than Windows (as you would expect). There is no "paint" function (or overlapping windows). You can create a control, respond to touch on it and remove it.

Geoff
Geoff Graham - http://geoffg.net
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 12:17am 08 Nov 2013
Copy link to clipboard 
Print this post

I was responding to point 3 in the OP.

The "paint" function would be part of the control you make.
Maybe "redraw" would be a better name.
Effectively it just draws itself again just like the first time you use it.
The only thing extra is that it should show the same values if something was entered.

If you are going to make a bunch of controls it can be a choice to implement it that way.


Microblocks. Build with logic.
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1328
Posted: 01:33am 08 Nov 2013
Copy link to clipboard 
Print this post

Hi Zonker,
That's looking pretty good - you're certainly making progress and yes, fingers can seem fat. I noticed that when Bovist was carefully touching the "controls" he'd programmed onto the display in the video he made - it's part of the reason I'd prefer the 5" display.

Looking at the Element 14 (Farnell) site, the HIROSE FH19SC-40S-0.5SH connector that Innolux quote is for soldering to flexible cable, not to solid PCB's. The FH12 series seems to be the one for PCB's, e.g. the FH12-40S-0.5SH(55) or FH12A-40S-0.5SH(55) or FH12S-40S-0.5SH(55). The 'FH12' series has contacts on the bottom, the 'FH12A' series has them on the top and the FH12S series also has them on the bottom, it just seems to be a smaller connector, everything else is the same. Element 14 have Eagle Cadsoft files for most of these too. They're not cheap though, around $6.60 for single units and at that price I can understand why Newhaven charge $10+ for their adapter - which has a connector on it that looks similar to the FH12S version. The FH12 series are all surface-mount though, not through-hole, but that's not a deal-breaker. All the above are horizontal connectors but there's also a vertical connector FH12-40S-0.5SV(55) available.

I'm not sure whether we'd be better with the 'bottom' or 'top' contact version. Guess it depends on three things - which side the contacts on the display flexible are, whether you intend to fold the flex back under the display to connect to your Maximite, and whether you want your Maximite's component side or track side to be against the back of the display. What is the case for the Innolux display, are the flex contacts on the top or bottom?

Re the H&V sync pins - as you say, it is best to connect them anyway to make the connector OK for both the 5" and 4.3" screens - I'll do that.

Greg
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1328
Posted: 01:58am 08 Nov 2013
Copy link to clipboard 
Print this post

  Geoffg said  The timing for a LCD is different than VGA and the firmware caters for that. But you still need the delay in the framing input to the PIC32. The best way is to duplicate Bovist's circuite on github (link is on my website). Geoff


Thanks Geoff, I'll follow Bovist's circuit - I seem to remember he mentioned he'd changed the values of the delay components a bit too - I'll check that out.

  Geoffg said  
I can't really help on the hardware aspects like compatible LCDs, etc as I did not develop the LCD interface (Bovist did). But I can tell you something, every manufacturer has different timing and connections to the LCD so you should make sure that you buy something that you know works. Geoff


Hmmm... OK, well I think I'll go for the 5" Innolux first and if I run into strife I'll go for one of 4.3" ones mentioned on your site (Hannstar or EastRising).

On another subject; I've just received my $15 EM-408 GPS module so I'm going to have a go at your tracker from the last Silicon Chip edition - should be fun!

Greg

BTW - like your new 'bearded' photo
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 12:14pm 08 Nov 2013
Copy link to clipboard 
Print this post

  paceman said  On another subject; I've just received my $15 EM-408 GPS module so I'm going to have a go at your tracker from the last Silicon Chip edition - should be fun!


I have a few spare PCBs for that project, so if you would like one send me an email with your address and I will post it off to you (free of charge of course). The same applies to anyone else who is planning to build it.

Geoff
Geoff Graham - http://geoffg.net
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1328
Posted: 01:49pm 08 Nov 2013
Copy link to clipboard 
Print this post

Great, I'll take you up on that - pm sent!

Greg
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 06:57pm 08 Nov 2013
Copy link to clipboard 
Print this post

I have had a few emails and this is just to say that all my spare boards have been used up.

Geoff
Geoff Graham - http://geoffg.net
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 09:28pm 08 Nov 2013
Copy link to clipboard 
Print this post

Good evening Gent's..!

Just wanted to push an update on the UI objects...

I wanted to start with a keypad that would collect a number from the user. I haven't wrapped it into a function yet, as I need to add max value checking. if you run it, you will get the keypad object on screen. C clears and E ends the input. Just testing the action code for now...

2013-11-09_072644_KEY_NUM1.zip

Any feedback welcome..!

PS: After looking over the many fine demo programs for the TFT-MM it looks like most of the pieces could be turned into UI objects.. Wow, I am impressed with good code writing within... One question about functions...

If you write a function to, lets say display the "Graf" object as seen in the demo program "aninstr.bas", can you include a timer interrupt service routine within the function code. When the function is called, the object would display itself at the user supplied x-y and update duration time. the timer would then simply read the user supplied data variable and update the "Graf" object. (nice)

Anyway, more stuff to think about...

Humm.. 31 is the highest object reference number allowed...Edited by Zonker 2013-11-10
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 11:57am 09 Nov 2013
Copy link to clipboard 
Print this post

  Zonker said  If you write a function to, lets say display the "Graf" object as seen in the demo program "aninstr.bas", can you include a timer interrupt service routine within the function code. When the function is called, the object would display itself at the user supplied x-y and update duration time. the timer would then simply read the user supplied data variable and update the "Graf" object. (nice)

That should work but for the definitive answer try it yourself.

Geoff
Geoff Graham - http://geoffg.net
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 02:30pm 12 Nov 2013
Copy link to clipboard 
Print this post

Good evening all..!

I managed to scratch together the first test release of a single object library for the TFT Maximite. It ain't much, but I wanted to try out the "process" and get some feedback before going much further...

2013-11-13_002743_Z-UI1.zip

any advice on better programming of this stuff would probably help..

enjoy...
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024