Volhout
 Guru
 Joined: 05/03/2018 Location: NetherlandsPosts: 6241 |
| Posted: 06:30pm 08 Mar 2025 |
|
|
|
Hi Elijah,
The thermal camera still work correct with the latest 6.00.02b16_2 on RP2040 in a VGA platform. I remember when implementing it that I needed to read the description in the user manual carefully, since there was something in the way rows and columns where used. Maybe that is what you are referring to.
These are snippets of the code, array sizes, and how they are used with math M_mult
'scaling buffers and math matrices dim f_t(191),f_v(191) 'scratchpad temp/voltage size%=5 'pixel size dim Toa(15,11) 'this is Vir() in 2D form for math dim c(15,44) 'array for intermediate results math dim d(11,44),b_e(30,15),b_o(30,15) 'conversion arrays for scaling dim x_s%(1394),y_s%(1394) 'arrays for screen coordinates fill_matrix 'fill conversion matrices dim scrn_2D(30,44) '2D buffer for math dim scrn_1De(1394),scrn_1Do(1394) 'even/odd 1D arrays for 61x45 screen
'lots of code here in between.....
'show 192 temperatures on screen in a grid of 61x45 interleaved sub scale_4d local y31,px,cs0,cs1,x,y as integer 'copy linear array into 16x12 array, and perform math to scale up (=21ms) MEMORY COPY INTEGER PEEK( VARADDR Vir()),PEEK( VARADDR Toa()),192 math m_mult d(),Toa(),c() 'c() is in correct vertical resolution 'with low delta-T limit the color scaling for visual appearance max_colors = min(int(Tmax-Tmin)+2,num_colors-1) max_colors = 15 math window c(),0,max_colors,c() 'x color 'math window c(),0,max_colors+0.4,c() 'x colors + 0.4c for better distribution 'calculate even pixels math m_mult c(),b_e(),scrn_2D() 'flatten into 1D array MEMORY COPY float PEEK( VARADDR scrn_2D()),PEEK( VARADDR scrn_1De()),1395 'convert to RGB colour map scrn_1De(),scrn_1De(),col%() 'calculate odd pixels math m_mult c(),b_o(),scrn_2D() 'flatten into 1D array MEMORY COPY INTEGER PEEK( VARADDR scrn_2D()),PEEK( VARADDR scrn_1Do()),1395 'convert to RGB colour map scrn_1Do(),scrn_1Do(),col%() 'plot all the boxes on screen, since VGA does not use a framebuffer 'the plotting is done as fast and compact as possible. That is why there 'are dual 1D screen buffers. '31 even boxes, original x() coordinates box x_s%(),y_s%(),size%,size%,1,scrn_1De(),scrn_1De() math add x_s%(),size%,x_s%() 'prepare for odd boxes '30 odd boxes box x_s%(),y_s%(),size%,size%,1,scrn_1Do(),scrn_1Do() math add x_s%(),-size%,x_s%() 'restore for next even boxes end sub
In this upscaling routine the even pixels and odd pixels are calculated independently, simply because there was not enough RAM memory to hold the whole array of 64bit variables. The b_e() and b_o() arrays contain the multiplication factors for upscaling.
Volhout Edited 2025-03-09 04:35 by Volhout |