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: Experimental version for comment
Author | Message | ||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9122 |
This version is just for the PicoMite. If generally of interest and robust it will become the main PicoMite version PicoMite.zip Installing this will delete everything on the Pico What's different? I've freed up 16K of memory by using the VGA version of function handling. This does slow very complex programs with many functions and subroutines by up to around 7% but performance is still the same as the VGA version This is targeted at complex graphics (e.g. games) Preconditions for new command FRAMEBUFFER and LAYERBUFFER are created i.e. FRAMEBUFFER CREATE FRAMEBUFFER LAYER New command FRAMEBUFFER MERGE [colour] [,mode] Usage FRAMEBUFFER MERGE - writes the contents of the framebuffer to the physical display overwriting any pixels in the framebuffer that are set in the layerbuffer (not zero) FRAMEBUFER MERGE col - writes the contents of the framebuffer to the physical display overwriting any pixels in the framebuffer that are in the layerbuffer not set to the transparent colour "col" FRAMEBUFFER MERGE col,B - as above except that the transfer to the physical display takes place on the second processor and control returns to Basic immediately FRAMEBUFFER MERGE col,R - sets the second processor to continuously update the physical display with the merger of the two buffers. Automatically sets FRAMEBUFFER WRITE F. NB: FRAMEBUFFER WRITE cannot be set to N while continuous merged update is active. FRAMEBUFFER MERGE col,A - aborts the continuous updates In addition deleting either the layerbuf or framebuffer will abort the automatic update as well Basically, this gives you a full 2-layer graphics capability with the background layer in the F buffer and the top layer in the L buffer Note: Of course using FRAMEBUFFER MERGE in continuous mode is incompatible with touch or SDcard on the same pins Edited 2023-10-17 22:18 by matherp |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
This looks excellent. I wish I knew enough to be able to test it. Can you (or can anyone else) provide a simple example of how it would work? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9122 |
Here is a quick demo https://youtu.be/GH-_HAiiWx0 and the code FRAMEBUFFER create 'create a framebuffer FRAMEBUFFER layer ' and a layer buffer FRAMEBUFFER write f 'set graphics output to the framebuffer Load image "b:/mandelbrot" ' and load a picture FRAMEBUFFER merge 0,R 'now start a continuous update for the screen on CPU2 FRAMEBUFFER write l We will leave the framebuffer alone and just write to the layer i=100 j=100 Do Do 'creat a random origin for a circle staying on the screen x=i+Rnd()*6-3 y=j+Rnd()*6-3 Loop While x<50 Or x>MM.HRes-50 Or y<50 Or y>MM.VRes-50 FRAMEBUFFER sync 'sync to the framebuffer write to avoid artefacts Box i-51,j-51,102,102,,0,0 ' clear the previous image Circle x,y,50,5,,RGB(red),RGB(blue) 'write a new image i=x j=y Loop and an updated version of the firmware PicoMite.zip Update rate is 27FPS on an 8-bit parallel ILI9341 and just over 13FPS on an SPI ILI9341 Edited 2023-10-18 00:53 by matherp |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4243 |
Peter, If you make a change like this, why not call framebuffer f for what it is: FRAMEBUFFER N . Volhout Edited 2023-10-18 01:21 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9122 |
No: this is all additional functionality and everything can still be used exactly as before so N is the physical display, F is the framnebuffer and L is the layer buffer One more update PicoMite.zip FRAMEBUFFER MERGE col, [,B/R/A] [,cycletimeMS] The cycletime is how fast you want the updates to happen so if you want them every 100mS set cycletimeMS to 100. Defaults to 0 which runs as fast as the display can manage (75mSec ILI9341 SPI, 36mSec ILI9341 parallel) NB: this command can only be used in a program and the automated updates are stopped on any program exit (Ctrl-C, error, END) New command FRAMEBUFFER SYNC waits for the latest update to complete to allow drawing without tearing Edited 2023-10-18 02:42 by matherp |
||||
karlelch Senior Member Joined: 30/10/2014 Location: GermanyPosts: 172 |
Hi Peter Having similar functionality in those versions - where reasonable - would be great. Could you please quantify “complex programs” and “many functions and subs”? Thanks! |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9122 |
Solar Eclipse calc has 30 subs/3210 lines with considerable nesting and runs 7% slower The VGA version has a layer capability. The Webmite cannot as too many time-critical interrupts |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 509 |
Hi Peter, I have just been experimenting with the above versions, looking good thanks, however I have found a bug, if you place a pause, of any length in the loop of your above program the program locks up. :-( I'll avoid pauses for the moment. :-) Regards, Kevin. |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 509 |
Sorry, but also if I do the following with your example above. I have had to change you're mandelbrot to a another bmp I did have. My options are: PicoMite MMBasic Version 5.07.08RC10 OPTION SYSTEM SPI GP6,GP3,GP4 OPTION COLOURCODE ON OPTION LCDPANEL ILI9341, RLANDSCAPE,GP2,GP1,GP0 OPTION TOUCH GP5,GP7 OPTION SDCARD GP22 OPTION AUDIO GP20,GP21, ON PWM CHANNEL 2 do a reset, not power off. PicoMite MMBasic Version 5.07.08RC10 Copyright 2011-2023 Geoff Graham Copyright 2016-2023 Peter Mather > run [4] Load image "b:/small" ' and load a picture Error : SD Card not found > B: > run 22457.904 75.517 74.189 74.176 74.246 74.251 > run [4] Load image "b:/small" ' and load a picture Error : A hard error occurred in the low level disk I/O layer At his point the screen goes white and I get a complete lock up. Edited 2023-10-18 03:28 by Bleep |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
Thanks for the example. I didn't have the mandelbrot.bmp file, so used Martin's Petskii Robots initial screen. I added code to change the colors randomly every second: Dim integer fClr,bClr,b%(15)=(RGB(red), RGB(green), RGB(blue),0,0,0,0,0,0,0,0,0,0,0,0,0) b%(5)=RGB(gold): b%(6)=RGB(magenta): b%(7)=RGB(brown): b%(8)=RGB(pink) b%(9)=RGB(salmon): b%(10)=RGB(orange):b%(11)=RGB(grey):b%(12)=RGB(white) b%(13)=RGB(lightgrey): b%(14)=RGB(beige): b%(15)=0 ' black FRAMEBUFFER create FRAMEBUFFER layer FRAMEBUFFER write f ' Load image "b:/mandelbrot" Load image "b:/petscii-intro" FRAMEBUFFER merge 0,R FRAMEBUFFER write l i=100 j=100 FG=RGB(red) BG=RGB(blue) Do Do If Rnd()>.5 Then x=i+Rnd()*12-3 Else x=i-(Rnd()*12-3) If Rnd()>.5 Then y=j+Rnd()*12-3 Else y=j-(Rnd()*12-3) Loop While x<50 Or x>MM.HRes-50 Or y<50 Or y>MM.VRes-50 FRAMEBUFFER sync Box i-51,j-51,102,102,,0,0 :Circle x,y,50,5,,FG,BG i=x j=y ' If Timer/1000 <> lastTime Then lastTime=time/1000: FG=RGB(b%(Rnd()*15)): BG=RGB(b%(Rnd()*15)) If Timer/1000 <> lastTime Then lastTime=time/1000: fCLR=Rnd()*15: bClr=Rnd()*15: ' Print fClr;"/";bCLR;" "; FG=b%(fCLR): BG=b%(bCLR) EndIf Loop Youtube video: example for new framebuffer commands petscii-intro.zip EDIT: Running a second time after successfully running and terminating with Ctrl+C, I get the same error message as Bleep--with no lockup, but with drive B: "not found". > RUN > RUN [9] Load image "b:/petscii-intro" Error : A hard error occurred in the low level disk I/O layer > > files A:/ <DIR> . <DIR> .. 00:00 01-01-2000 4 bootcount 00:01 01-01-2000 1036 fr.bas 00:04 01-01-2000 360 frames_exp.bas 2 directories, 3 files, 622592 bytes free > b: > files Error : SD Card not found > After power-cycling, I have drive B: back again. Edited 2023-10-18 05:29 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9122 |
Thanks for the feedback - I'm pretty sure both issues are a stack overflow problem on the second processor (they have separate stacks). Will post an update later today when I've got to the bottom of it. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9122 |
I think this is more robust now. Please try and see how you get on PicoMite.zip Installing this will delete everything on the Pico |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
Multiple runs with no problems now. This is cool--thanks. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Print this page |