What is the current best graphics display?
lmclaren
Posts: 104
A bit more information.
I currently have a coffee roaster running in a single prop that is using the VGA64 Tilemap Engine, it works very well but I am out of space with all of the other parts of the code.
I have decided to split the project into a two prop design, one will do all the control and automation, the other will do the display.
The current display offers colour per character and a single font.
What I would really like, is at least 2 fonts, colour per character and an area I can do a per pixel graph on.
I don't mind if the display prop uses all of the cogs and memory, as long as I have a little left for a serial connection to the control prop.
Is there such a thing? I know when the next prop arrives it should become a lot easier. I did consider using a raspberry pi to do the display but I prefer the fast start-up and reliability of using props.
Lee
Current Display
I currently have a coffee roaster running in a single prop that is using the VGA64 Tilemap Engine, it works very well but I am out of space with all of the other parts of the code.
I have decided to split the project into a two prop design, one will do all the control and automation, the other will do the display.
The current display offers colour per character and a single font.
What I would really like, is at least 2 fonts, colour per character and an area I can do a per pixel graph on.
I don't mind if the display prop uses all of the cogs and memory, as long as I have a little left for a serial connection to the control prop.
Is there such a thing? I know when the next prop arrives it should become a lot easier. I did consider using a raspberry pi to do the display but I prefer the fast start-up and reliability of using props.
Lee
Current Display
Comments
electrodude
EDIT: fixed a bad bug
new part:
I will put it through its paces tonight and report back.
Lee
I tested the version you attached, it showed some promise but there was some text overwriting and it only filled about 50% of the screen area in the centre but a good start, thankyou.
I tried your suggestion to use one of the other tile drivers, VGA 1280x1024 Tile Driver w/Cursor with the graphics addition. I am having a few problems and need to spend some time to understand it.
I will report back how I go.
thankyou for putting me on the right track.
Lee
If that's not good enough, I have some SSD1963 based boards that can do WVGA fullscreen graphics.
Still, if most of you display is text and you just need a tiny graphics area, the tile driver is the way to go.
Vga_1280x1024_tile_driver_with_cursor.spin works the same way as my example - just get rid of the vga params in the var and dat blocks (leave colors!), and start the new vga object with vga.start(16, @screen, @colors,0,0,0). You might not want the first two of the last three zeros in that line to be zero, read the vga object's start method's comments, it will tell you. You probably want the last parameter to be zero, because it gives better control over the screen (16x16 instead of 16x32). Make sure you change x_tiles and y_tiles to equal vga#xtiles and vga#ytiles.
About the overlapping text, replace with Each character is 2 tiles tall, but I only moved the cursor down 1 tile for the next line; move it down 2 tiles instead.
Notice that you can change xmin, xmax, ymin, and ymax to change the size of the graphics area in 16x16 tiles.
Also, try changing the graphics colors (last actual line of code in the file) to something else like to give the graphics area a different background color so you can tell it apart. The first 4 digits are the color you get from gr.color(3), the next 4 from gr.color(2), the next 4 from gr.color(1), and the last 4 from gr.color(0). Gr.clear fills the screen with color 0, which is grey with this modification and not black. That leaves the text background as black.
Did you find the graphics font thing yet? It's gr.text(x, y, strptr). I left some setup code in my file (the gr.textmode(3,3,6,%0101)), so you should just be able to put a gr.text somewhere and it should work. Notice that (0,0) is at the center of the graphics area. To change that, change gr.setup(gr_x_tiles,gr_y_tiles,gr_x_tiles*8,gr_y_tiles*8,bitmap_base) to gr.setup(gr_x_tiles,gr_y_tiles,0,0,bitmap_base). That will put the origin at one of the corners - I suspect it might be the top left, and y coordinates will have to be negative. If you want the origin at another corner, just mess with those two zeros - they determine where the origin is.
electrodude
EDIT: You probably don't want vga_1280x1024_tile_driver_with_cursor.spin because it's such high resolution that you'll only be able to have a tiny graphics area.
To make VGA.spin take up the whole screen, change vgaparams in the DAT block to read: and make x_tiles = 32 and y_tiles = 30. It's also not a bad idea to add "vga_rate := clkfreq >> 2" to the line before vga.start in PUB start, in case you're not using an 80MHz clock. These new settings were slightly modified from VGA_Text.spin.
I attached the updated file. It might not display anything, though, because I'm not sure your monitor (or anyone's) will understand a signal using those vgaparams. I'll be able to test it later today.
I edited this post many times, so beware.
I have had a chance this afternoon to spend some time with the display, the original had a few small problems (but far better that I would have managed in under a week!) The character text was only showing half a character and there where some stray characters instead of blank screen, I made some tweaks as per the first lot of code attached which was closer.
A bit more thinking and a few more tweaks and I had the result now shown in the second photo.
I am not sure if I have accomplished this in the best way but I think I can get this to do what I want.
I think I will use the graphics area at the bottom for a graph to show the temperature and will try to add a smaller font for the majority of the display with the standard being the big font for the main temperatures.
Thankyou Electrodude, I would not have got this far without you assistance.
The 2 version is the first
VGA_graphics_text_mix (2).spinVGA_graphics_text_mix (3).spin
I saw you had a gr.colorwidth(10,2). Color 10 is invalid - you can only have 4 colors (0,1,2,3) in graphics mode per 16x16 area. You would set the color set used by a tile in the init tile screen section by replacing the 16<<10 (I accidentally put 17!) with (colorset)<<10. If you need to change a color set while running, you would simply re-init just that tile. The color sets are at the bottom of the file.
I changed the graphics origin to the bottom-left, which is probably what you want. Notice the extra zeros in gr.setup - they pick the origin. I also changed the graphics text mode to be bottom-left justified (instead of centered horizontally and vertically), and made the text smaller (the ones in gr.textmode change the size and the 00 changes the justification).
You took the graphics text stuff out of the loop, but it has to be in the loop or it will only get drawn once if you continue to use double-buffering and redraw everything every frame. You could consider only single-buffering the display, which would take half as much memory, but then you would have to worry about drawing deltas, which is a headache you want to avoid at all costs.
You had a bunch of off-by-one errors, I fixed them. I also modified the text functions so you could use 16x16 tiles instead of 32x32 tiles.
I added 2 bar graphs as an example of how to make things that update.
electrodude
It is a thing of beauty!
I have ran it up and it is working well, I will spend a lot more time on it tomorrow.
I may investigate using a different font, if I understand correctly, I could use a non internal font and then get twice as many characters? Is that correct? Could I mix and match?
Sorry for so many questions.
many thanks
Lee
It is possible to have multiple graphics areas, although I've never tried it. They should all use the same backbuffer to save ram. You would have one back buffer (bitmap_base) for everything and then one front buffer (display_base) per graphics area. This would be easiest if all of the graphics areas were the same size, otherwise you would have to run gr.setup between areas. This would save lots of ram because you only have a backbuffer for part of the display and not all of it.
electrodude
Thanks for the help, it would have taken me ages to get this far and a lot of frustration.
best regards
Lee