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 : Picomite colourbars test card
Author | Message | ||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6093 |
This is a modification of a test card program I wrote for the cMM@ a few years ago, It should run on a picoVGA as well as picoHDMI bit I have only tested on the HDMI. Widescreen mode is OK. ' test card for Picomite VGA and HDMI ' TassyJim September 2024 OPTION EXPLICIT OPTION DEFAULT NONE DIM INTEGER wd, ht, wbox, sh, x, w, n, nn, m, mp, cd, maxMode, keepMode, widesc, mk DIM FLOAT a, defaultMode DIM k$, imgtitle$, fname$, imgRes$, pages$ DIM INTEGER c(8) c(0) = RGB(BLACK) c(1) = RGB(YELLOW) c(2) = RGB(CYAN) c(3) = RGB(GREEN) c(4) = RGB(MAGENTA) c(5) = RGB(RED) c(6) = RGB(BLUE) c(7) = RGB(WHITE) c(8) = RGB(64,64,64) IF INSTR(MM.DEVICE$,"HDMI") THEN maxMode = 5 ELSE maxmode = 3 ENDIF IF MM.VRES/MM.HRES = 0.75 THEN widesc = 0 ELSE widesc = 1 ENDIF a = 1 defaultMode = 3 CLS DO IF m = 0 THEN MODE 1 CLS TEXT 320,100, "Video mode test",cm,5,1 TEXT 320,180, "Ratio = aspect ratio used in the circle command",cm,1,1 TEXT 320,220, "Q to quit, P to save page as a BMP",cm,3,1 TEXT 320,260, "Up Down arrow to change resolution",cm,2,1 TEXT 320,300, "+ - to change circle aspect ratio",cm,2,1 ELSE IF keepmode THEN ' only change resolution if needed keepmode = 0 ELSE CLS ' erase video memory before mode change ON ERROR SKIP MODE m CLS ENDIF wd = MM.HRES : ht = MM.VRES nn = INT(wd/80) imgtitle$ =" MODE "+STR$(M)+" Ratio "+STR$(a,1,3)+" " imgRes$ = " "+STR$(MM.HRES)+" x "+STR$(MM.VRES)+" " pages$ = " "'Maximum page number = "+STR$(mp)+" " wbox = wd / 8 ' primary colours FOR x = 0 TO 7 BOX x*wbox,ht/4,wbox,ht/2,0,c(x), c(x) NEXT x ' full gradient for each primary colour and greyscale FOR x = 0 TO wd-1 sh = 255*x/wd LINE x,0,x,ht/12,1,RGB(sh,0,0) LINE x,ht/12,x,ht/6,1,RGB(0,sh,0) LINE x,ht/6,x,ht/4,1,RGB(0,0,sh) LINE x,ht*9/12,x,ht*10/12,1,RGB(0,sh,sh) LINE x,ht*10/12,x,ht*11/12,1,RGB(sh,0,sh) LINE x,ht*11/12,x,ht,1,RGB(sh,sh,0) LINE x,ht/2,x,ht*3/4,1,RGB(sh,sh,sh) ' greyscale NEXT x ' circle to check aspect ratio CIRCLE wd/2,ht/2, ht*15/32,3,a,c(7) sh = 0 x = wd/2 - 55*nn/2 ' black white bars to check monitor bandwidth FOR w = 10 TO 1 STEP -1 FOR n = 1 TO nn sh = 255 - sh LINE x,ht*3/8,x,ht*5/8,w,RGB(sh,sh,sh) x = x + w NEXT n NEXT w ' white and red border to check that image fits on monitor BOX 0,0,wd,ht,3,c(7) BOX 1,1,wd-2,ht-2,1,c(5) ' title IF wd > 600 THEN TEXT wd/2,ht/2-15, imgtitle$,cm,4,1 TEXT wd/2,ht/2, pages$,cm,4,1 TEXT wd/2,ht/2+15, imgRes$,cm,4,1 ELSE TEXT wd/2,ht/2-11, imgtitle$,cm,1,1 TEXT wd/2,ht/2, pages$,cm,1,1 TEXT wd/2,ht/2+11, imgRes$,cm,1,1 ENDIF ENDIF PAUSE 100 ' wait for keypress DO k$ = INKEY$ LOOP UNTIL k$<>"" ' SELECT CASE k$ CASE "Q","q" EXIT DO CASE "P","p" fname$ = MID$(imgtitle$,2)+".bmp" TIMER = 0 SAVE IMAGE fname$ ' PAGE WRITE 0 TEXT wd/2,ht/2,"Saved as "+fname$+" in "+STR$(TIMER/1000,3,2)+" Sec" ,cm,1,1 DO k$ = INKEY$ LOOP UNTIL k$<>"" CASE CHR$(128) ' up arrow m = m - 1 IF m < 1 THEN m = maxMode IF m = 4 AND widesc THEN m = 3 CASE CHR$(129) ' down arrow m = m + 1 IF m > maxMode THEN m = 1 IF m = 4 AND widesc THEN m = 5 CASE "+" ' ratio plus IF a < 1.4 THEN a = a + 0.01 keepmode = 1 CASE "-" ' ratio minus IF a > 0.75 THEN a = a - 0.01 keepmode = 1 CASE ELSE ' same as down arrow m = m + 1 IF m > maxMode THEN m = 1 END SELECT LOOP MODE defaultMode ' restore original mode before ending program CLS END Jim Edited 2024-09-24 16:02 by TassyJim VK7JH MMedit MMBasic Help |
||||
Plasmamac Guru Joined: 31/01/2019 Location: GermanyPosts: 554 |
thx Jim Plasma |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4221 |
HI Jim, On VGA (with hardware color palette) it will look completely different. The greyscale is not a scale. RP2350 and RP2040 are the same on VGA. Volhout Edited 2024-09-24 16:20 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6093 |
Updated to handle the new modes and added a staircase to better understand some instability I can see in some modes. ' test card for Picomite VGA and HDMI ' TassyJim September 2024 OPTION EXPLICIT OPTION DEFAULT NONE DIM INTEGER wd, ht, wbox, sh, x, w, n, nn, m, mp, cd, maxMode, keepMode, widesc, mk DIM FLOAT a, defaultMode DIM k$, imgtitle$, fname$, imgRes$, pages$ DIM INTEGER c(8) c(0) = RGB(BLACK) c(1) = RGB(YELLOW) c(2) = RGB(CYAN) c(3) = RGB(GREEN) c(4) = RGB(MAGENTA) c(5) = RGB(RED) c(6) = RGB(BLUE) c(7) = RGB(WHITE) c(8) = RGB(64,64,64) IF INSTR(MM.DEVICE$,"HDMI") THEN maxMode = 5 ELSE maxmode = 3 ENDIF IF MM.VRES MOD 240 = 0 AND MM.VRES <> 720 THEN widesc = 0 ELSE widesc = 1 ENDIF a = 1 defaultMode = 3 CLS DO IF m = 0 THEN MODE 1 CLS TEXT 320,100, "Video mode test",cm,5,1 TEXT 320,180, "Ratio = aspect ratio used in the circle command",cm,1,1 TEXT 320,220, "Q to quit, P to save page as a BMP",cm,3,1 TEXT 320,260, "Up Down arrow to change resolution",cm,2,1 TEXT 320,300, "+ - to change circle aspect ratio",cm,2,1 ELSE IF keepmode THEN ' only change resolution if needed keepmode = 0 ELSE CLS ' erase video memory before mode change ON ERROR SKIP MODE m CLS ENDIF wd = MM.HRES : ht = MM.VRES nn = INT(wd/80) imgtitle$ =" MODE "+STR$(M)+" Ratio "+STR$(a,1,3)+" " imgRes$ = " "+STR$(MM.HRES)+" x "+STR$(MM.VRES)+" " pages$ = " "'Maximum page number = "+STR$(mp)+" " wbox = wd / 8 ' primary colours FOR x = 0 TO 7 BOX x*wbox,ht/4,wbox,ht/2,0,c(x), c(x) NEXT x ' full gradient for each primary colour and greyscale FOR x = 0 TO wd-1 sh = 255*x/wd LINE x,0,x,ht/12,1,RGB(sh,0,0) LINE x,ht/12,x,ht/6,1,RGB(0,sh,0) LINE x,ht/6,x,ht/4,1,RGB(0,0,sh) LINE x,ht*9/12,x,ht*10/12,1,RGB(0,sh,sh) LINE x,ht*10/12,x,ht*11/12,1,RGB(sh,0,sh) LINE x,ht*11/12,x,ht,1,RGB(sh,sh,0) LINE x,ht/2,x,ht*3/4,1,RGB(sh,sh,sh) ' greyscale NEXT x ' circle to check aspect ratio CIRCLE wd/2,ht/2, ht*15/32,3,a,c(7) sh = 0 x = wd/2 - 55*nn/2 ' black white bars to check monitor bandwidth FOR w = 10 TO 1 STEP -1 FOR n = 1 TO nn sh = 255 - sh LINE x,ht*3/8,x,ht*5/8,w,RGB(sh,sh,sh) x = x + w NEXT n NEXT w ' horisontal lines to check for raster stability x = wd/2 - 50*nn/2 sh = ht*5/8-5 BOX x,sh,50*nn,5*nn+4,1,RGB(BLACK),RGB(BLACK) sh = sh + 2 FOR n = x TO wd/2 + 50*nn/2 - 10 STEP 10 LINE n,sh,n+9,sh,1,RGB(WHITE) sh = sh + 1 NEXT n ' white and red border to check that image fits on monitor BOX 0,0,wd,ht,3,c(7) BOX 1,1,wd-2,ht-2,1,c(5) ' title IF wd > 600 THEN TEXT wd/2,ht/2-15, imgtitle$,cm,4,1 TEXT wd/2,ht/2, pages$,cm,4,1 TEXT wd/2,ht/2+15, imgRes$,cm,4,1 ELSE TEXT wd/2,ht/2-11, imgtitle$,cm,1,1 TEXT wd/2,ht/2, pages$,cm,1,1 TEXT wd/2,ht/2+11, imgRes$,cm,1,1 ENDIF ENDIF PAUSE 100 ' wait for keypress DO k$ = INKEY$ LOOP UNTIL k$<>"" ' SELECT CASE k$ CASE "Q","q" EXIT DO CASE "P","p" fname$ = MID$(imgtitle$,2)+".bmp" TIMER = 0 SAVE IMAGE fname$ ' PAGE WRITE 0 TEXT wd/2,ht/2,"Saved as "+fname$+" in "+STR$(TIMER/1000,3,2)+" Sec" ,cm,1,1 DO k$ = INKEY$ LOOP UNTIL k$<>"" CASE CHR$(128) ' up arrow m = m - 1 IF m < 1 THEN m = maxMode IF m = 4 AND widesc THEN m = 3 CASE CHR$(129) ' down arrow m = m + 1 IF m > maxMode THEN m = 1 IF m = 4 AND widesc THEN m = 5 CASE "+" ' ratio plus IF a < 1.4 THEN a = a + 0.01 keepmode = 1 CASE "-" ' ratio minus IF a > 0.75 THEN a = a - 0.01 keepmode = 1 CASE ELSE ' same as down arrow m = m + 1 IF m > maxMode THEN m = 1 IF m = 4 AND widesc THEN m = 5 END SELECT LOOP MODE defaultMode ' restore original mode before ending program CLS END VK7JH MMedit MMBasic Help |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6093 |
Replied here to keep the firmware thread clear. If your circles are not round, use + and - to stretch/shrink the circle until it looks right. Then, in your programs the circle command has a parameter for aspect ratio: The size of the BMP files is due to the number of pixels for each resolution. BMP is the only format available. Jim VK7JH MMedit MMBasic Help |
||||
Print this page |