Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:37 27 Nov 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 : PicoMite/VGA/WEB V5.07.08 release candidates

     Page 10 of 18    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 02:31pm 27 Oct 2023
Copy link to clipboard 
Print this post

MMBasic.c - getvalue
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 02:47pm 27 Oct 2023
Copy link to clipboard 
Print this post

  matherp said  MMBasic.c - getvalue


Thanks, so upon the briefest inspection not something fixable on a whim.

getvalue() could be modified relatively easily (?) so rather than using CtoM() it constructs an MMBasic string literal directly (one with a leading length) but then you need to check all uses of MMBasic strings to check that they correctly handle an embedded null rather than being naively converted to a C strings and thus losing everything after the first null.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 03:59pm 27 Oct 2023
Copy link to clipboard 
Print this post

Hi Peter,
RC12 working well, thanks, the new string feature for framebuffer write will be very useful for VGA/LCD common code :-) white flashes seem to have gone, assuming that was one of your fixes.
I've converted my clockclock24 to use the framebuffer, it has more than doubled the refresh rate I can get with the animations :-) but even better it is completely smooth, no rippling from where I was erasing the old hands and re-drawing the new.
Regards Kevin.
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 05:58pm 27 Oct 2023
Copy link to clipboard 
Print this post

Using V5.07.08RC1 and getting blit error I did not get before. Has it changed?


Edited 2023-10-28 04:00 by stanleyella
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1109
Posted: 08:57pm 29 Oct 2023
Copy link to clipboard 
Print this post

Would it be possible to have a change to PEEK(CFUNADDR cfun) so that "cfun" can be a string?

For example,
n = 23
cfuname$ = "SPR"+str$(n,3,0,"0")
caddr% = PEEK(CFUNADDR cfuname$)

Visit Vegipete's *Mite Library for cool programs.
 
EDNEDN
Senior Member

Joined: 18/02/2023
Location: United States
Posts: 118
Posted: 09:55pm 29 Oct 2023
Copy link to clipboard 
Print this post

@matherp    Just a 'Heads Up' for you...    

I forked the latest version from your site.   I was going to move my work over to the latest version.   But it seems PicoMite.c got saved with MSDOS line endings and every line (of that file) has a ^M on it.

I'm fully capable of either deleting the ^M line endings or telling my editor to not display them.   But it seems you are trying to get everything buttoned up for the next release.  It is my guess you want the line endings consistent across all the files.
Edited 2023-10-30 23:41 by EDNEDN
 
Bernie3D
Newbie

Joined: 02/08/2023
Location: United States
Posts: 19
Posted: 11:00pm 04 Nov 2023
Copy link to clipboard 
Print this post

I read on a recent post that core1 of the chip is now being used to optimize the SPI display, on the Picomite.

I assume this is the first time core1 is being applied on the Picomite, with core0 doing the bulk of the tasks.

Which Picomite RC or Beta version has core1 in use?

Thanks!
Bernie
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4246
Posted: 07:34am 05 Nov 2023
Copy link to clipboard 
Print this post

In debugging petscii robots, i have seen error messages that print the text where the error was cause correctly, but the line number incorrectly.
As soon as I have a small section of code to demo I will post it.

Volhout
Edited 2023-11-05 17:35 by Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 03:03pm 05 Nov 2023
Copy link to clipboard 
Print this post

V5.07.08RC14

https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip

All versions

PEEK(CFUNADDR ...) now optionally takes a variable or string literal as the argument
Various small bug fixes/improved data validation

PICOMITE and WEBMITE

New Command supporting the OV7670 camera module e.g.




Wire 3.3V to 3.3V on the Pico
Wire GND and PWDN to GND on the Pico
Enable OPTION SYSTEM I2C on the Pico and wire SCL and SDA to the relevant pins (may be labelled SIOC and SIOD on the camera module). These connections must have a pullup to 3.3V - 2K7 recommended)
Other pins are wired as per the OPEN command. (NB: VS may be labelled VSYNC, HS may be labelled HREF, PLK may be labelled PCLK, RET may be labelled RESET and XLK may be XCLK on your module)
D0pin defines the start of a range of 8 contiguous pins (e.g.GP0 - GP7).

Basic commands

BITBANG CAMERA OPEN XLKpin, PLKpin, HSpin, VSCpin, RETpin, D0pin


This command initialises the camera, It outputs a 12MHz clock on XLK (PWM) and checks that it is correctly receiving signals on PLK, VS, and HS. The camera is set to a resolution of 160x120 (QQVGA) which is the maximum achievable within the limits of the RP2040 memory. However the image quality is remarkably usable.





BITBANG CAMERA CAPTURE [scale, [x , y]]


This captures a picture from the camera (RGB565) and displays it on an LCD screen. An SPI LCD must be connected and enabled in order for the command to work. (ILI9341 and ST7789_320 recommended).
Scale defaults to 1 and x,y each to 0
By default a 160x120 image is output on the LCD with the top left at 0,0 on the LCD. Setting scale to 2 will fill a 320x240 display with the image. Setting the x and y parameters will offset the top left of the image on the LCD.
Update rate in a continuous loop is 7FPS onto the display at 1:1 scale and 5FPS scaled to 320x240.
Of course, assuming the display has MISO wired it is then possible to save the image to disk using the SAVE IMAGE command as used to create the example image above.

BITBANG CAMERA CLOSE

Close the camera subsystem and frees up all the pins allocated in the OPEN command


Motion detection

The camera firmware is also able to detect motion in the camera's field of view using the command.

BITBANG CAMERA CHANGE image%(),change! [,scale [,x ,y]]


It does this by operating the camera in YUV mode rather than RGB. This has the advantage that the intensity information and colour information are separated and just one byte is needed for a 256-level greyscale image which is ideal fer detecting movement.
image% is an array of size 160x120 bytes (DIM image%(160,120/8-1)
On calling the command it holds a packed 8-bit greyscale image.
The change! variable returns the percentage the image has changed from the previous time the command was called.
Optionally if "scale" is set then the image delta is output to the screen i.e. the difference between the previous image and this one. As in the CAPTURE command the delta image can be scaled and positioned as required. If the scale parameter is omitted then the LCD is not updated by this command.
The new command makes it trivially easy to check for and log activity in the camera's field of view. The example code below detects movement in the field of view and logs the image to disk

'simple motion detection app
CLS
Dim a%(120*160/8-1) 'create the image buffer
Dim change!
Bitbang camera open gp20,gp21,gp26,gp27,gp28,gp0
Pause 5000 'allow time for the gain control and white balance to settle
Bitbang camera change a%(),change! 'establish the baseline image
Do
Bitbang camera change a%(),change!
If (change!>5) Then ' 5% change in the image is the threshold for logging
  Bitbang camera capture 2
  Text 0,0,DateTime$(now),,,,RGB(red),-1
  ' create a unique filename
  fname$="B:/pic"
  Inc fname$,Right$(Date$,4)
  Inc fname$,Mid$(Date$,4,2)
  Inc fname$,Left$(Date$,2)
  Inc fname$,Left$(Time$,2)
  Inc fname$,Mid$(Time$,4,2)
  Inc fname$,Right$(Time$,2)
  ' save the timestamped image
  Save image fname$
EndIf
Loop




Other camera commands

BITBANG CAMERA TEST tnum


The command enables or disables a test signal from the camera. tnum=2 generates colourbars and tnum=0 sets back to the visual input. tnum = 1 and tnum = 3 do something but what?

BITBANG CAMERA REGISTER reg%, data%


Sets the register "reg%" in the camera to the value "data%". When used the command will report to the console the previous value and automatically confirms that the new value has been set as requested. The colour rendition of the camera as initialised is reasonable but could probably be improved further by tuning the various camera registers.


Edited 2023-11-06 01:08 by matherp
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4246
Posted: 08:34am 06 Nov 2023
Copy link to clipboard 
Print this post

Dear Peter,

The PETSCII team is trying to make the game compliant with both LCD and VGA.
In that effort they are using the "FRAMEBUFFER WRITE sc$" where sc$ is either N or F, depending on the platform.

When running PicoMiteVGA 50708RC12, the command FRAMEBUFFER WRITE sc$ gives a syntax error when sc$="N" or "n".
I tried the latest PicoMiteVGA 50708RC14, and the same happens.

I am not sure the command is correctly implemented in picomite VGA. Can you confirm?

Thanks,

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 09:07am 06 Nov 2023
Copy link to clipboard 
Print this post

Try this


PicoMiteVGA.zip
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4246
Posted: 09:14am 06 Nov 2023
Copy link to clipboard 
Print this post

Yes, now it works...

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 09:31am 06 Nov 2023
Copy link to clipboard 
Print this post

RC14 download updated with two tiny bug fixes

WS2812 stops working &7FFFFFF microseconds (35 mins, 47 seconds) after reset
FRAMEBUFFER WRITE s$ gave errors in VGA version
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4246
Posted: 09:52am 06 Nov 2023
Copy link to clipboard 
Print this post

Peter,

You have made changes that we can do an SAVE IMAGE combining 2 layers L and N.
Is that function compatible with the programable transparency color in L ?
When I try SAVE IMAGE "xx" regardless if I select layer N or L for write, I see the magenta transparency color we have selected (color 9).

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 10:04am 06 Nov 2023
Copy link to clipboard 
Print this post

Try this (untested)


PicoMiteVGA.zip
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4246
Posted: 10:49am 06 Nov 2023
Copy link to clipboard 
Print this post

Not working...

'test screen dump
MODE 2
Text 0,0,"Hello World"

FRAMEBUFFER layer 9 'magenta is see-through color
FRAMEBUFFER write l
Box 20,0,40,40,1,RGB(magenta),RGB(magenta)

FRAMEBUFFER write n
Save image "test.bmp"


Text on layer N, layer L only box is see-through. So you only see part of test in box.
Second framebuffer write can also be commented out (stay on L), makes no difference.

After running:

NEW
MODE 2: LOAD IMAGE "test.bmp"


NEW should make sure you are back on layer N, L does not exits anymore.
And you see only the magenta box...

Volhout
Edited 2023-11-06 20:51 by Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9126
Posted: 11:23am 06 Nov 2023
Copy link to clipboard 
Print this post

OK got it


PicoMiteVGA.zip
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4246
Posted: 11:46am 06 Nov 2023
Copy link to clipboard 
Print this post

Yes, that works.....

Thanks you, now it is easier to make documentation and show the program to others on the forum....





Volhout
Edited 2023-11-06 21:50 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4246
Posted: 08:46am 08 Nov 2023
Copy link to clipboard 
Print this post

Peter,

I have few questions

1/ can I use EXIT DO and EXIT FOR at any level without causing stack and heap problems ?

DO
 IF condition THEN EXIT DO
LOOP

DO
 IF condition1 THEN
  IF condition2 THEN
   IF condition3 THEN EXIT DO
  END IF
 END IF
LOOP

FOR i=1 TO n
 IF condition THEN EXIT FOR  
NEXT i

FOR i=1 TO n
 IF condition1 THEN
  IF condition2 THEN
   IF condition3 THEN EXIT FOR
  END IF
 END IF
NEXT i


2/ on VGA picomite: is there any way I can synchronize my game loop to VSYNC ?
I tried simply polling VSYNC in a loop (PIN(gp17)) but that did not work. Maybe because VSYNC is too short of a pulse.
I am sure I cannot avoid all artefacts (sprite flickering), but making it more deterministic might improve (I CLS layer L and repaint all sprites, and when a frame refresh happens during that time you see a sprite flicker - the CLS lasts for a whole frame period = 16ms, and that is visible).

Regards,

Volhout
Edited 2023-11-08 18:47 by Volhout
PicomiteVGA PETSCII ROBOTS
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4043
Posted: 09:53am 08 Nov 2023
Copy link to clipboard 
Print this post

I'm not Peter, but,

  Volhout said  1/ can I use EXIT DO and EXIT FOR at any level without causing stack and heap problems ?


I believe so.

Also note you can just write NEXT instead of NEXT i, thus saving a variable lookup; MMBasic knows which FOR/NEXT loop is currently in scope.

  Volhout said  2/ on VGA picomite: is there any way I can synchronize my game loop to VSYNC ?


See third, optional parameter on FRAMEBUFFER COPY s, d [,b].

Where "The optional parameter B tells the copy to wait for the next frame blanking before starting the copy. If this is specified the copy will compete in frame blanking and no display artefacts will be seeen."

Best wishes,

Tom
Edited 2023-11-08 19:54 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
     Page 10 of 18    
Print this page
© JAQ Software 2024