2024-02-23 02:06 PM
Hi everybody,
I'm trying to implement into a custom board, the dynamic Qrcode generation algorithm.
I'm using touchgfx 4.23.0, an SPI display with partial buffer strategy.
I would like to draw the string "https://support.touchgfx.com" . Display seem to draw it correctly but when I'm try to read it using my phone, this one is not readle. it seems not valid..
I'm using the following initialization sequence:
void Screen_QrCodeView::setupScreen()
{
Screen_QrCodeViewBase::setupScreen();
QR *code;
sprintf( string, "https://support.touchgfx.com");
code = new QR( string );
qrCode.setXY(10,10);
qrCode.setQRCode(code);
qrCode.setScale(8);
add(qrCode);
}
I don't understand the reason. If I change the size of QrCode using qrCode.setScale the result is the same.
Is it possibile to change the resoltuion of the QrCode? Is the QrCode resolution too poor respect the modern APP algorithm?
Does someone ahs the same issue? Please, Can someone try to draw the string https://support.touchgfx.com and share the picture for a comparison, ?
What can I check in the project?
Thanks to all
Solved! Go to Solution.
2024-02-24 07:26 AM - edited 2024-02-24 07:58 AM
Sorry, you missed my point: can you successfully display other things as QR codes ?
Also:
2024-02-24 08:08 AM
After updating Code with others sources files, finally Now it works correctly: I can rappresent anykind of text.
Remain to understand why is so dirty. Should the parial frame buffer system be the cause?
2024-02-24 08:46 AM - edited 2024-02-24 08:47 AM
@MPast.1 wrote:Should the parial frame buffer system be the cause?
Hello
I think it is possible, are you rendering it directly to the framebuffer like in this example:
What if you set scale to 1, can you still see 'dirty' pixels ?
Br JTP
2024-02-24 10:36 AM
The problem is always present when setScale is set more than 2.
It seems that algorithm forgot to draw and compiles wrong pixels.. very strange..
Another observation = I use 3 "large" buffer for draw screens..
If I don't wrong in 115200 bytes Touchgfx could draw 120 full rows . (my calcualtions= 115200 / (320 columns * 3 bytes (RGB)) = 120 rows). I know that partial buffer mode doesn't draw screens like single buffer, but I think that my buffer size can be enought fro draw a small square (100 x 100 pixel) on the screen.
At this point I need to check what happens inside the QrCode algorithms
2024-02-24 11:30 AM
Hello
I'm not very familiar with partial buffer strategy, but int this document
uses much smaller (4 lines) buffers. Maybe try to lower block size to 4 or 8 lines for example.
Inteference seems to repeat mostly with in 20 lines interval.
Br JTP
2024-02-25 01:21 PM
I'm trying with these settings and setScale(6):
but the same problems appears:
The strange things is witch errors are present only on the left size of the code.
Tomorrow I will check the code.
2024-02-25 08:53 PM
Hello
Interesting, with smaller buffer there is more inteference.
If look closely, it seems that it is allways drawing same part of old data and then starts new (3 buffers). So its certainly partial buffer problem. Looks like SPI transfer starts allready and then in some point the correct data starts when framebuffer update routine gets there.
Here is some good conversation about writing directly to framebuffer in partial mode.
I just wonder would framebuffer locking work better, if you set set only one partial block instead of three.
One way to solve problem permanently would be use dynamic bitmaps, I would consider that also.
Br JTP
2024-02-26 03:19 AM
Hello @MPast.1
Please find attached a custom container of a QrCode generator that I have made.
Note that the QrCode uses the Nayuki library in C++ (quite big) github.com/nayuki/QR-Code-generator with MIT license.
We are working on making a QrCode using the C version of the library in the near future.
From your last post, it seem like your board works fine with no tearing. Somehow the tearing only happens with the QrCode which is unfortunate but indicates that it could be an issue with the QrCode generation rather than tearing.
Does the tearing happens with scaling of 1?
To make the QrCode works even with the tearing you could try to increase the correction level (from what I know there is 4 levels of correction [this is different from the version number, the version number defines the number of dots]).
Finally, 2 QrCode displaying the same data could look different just because their version is not the same.
Here is mine running on TouchGFX simulator with quartile (3rd highest) level of correction (also works on board):
Regards,
2024-02-29 11:35 AM
hi @GaetanGodart ,
sorry for my late response but I want to confirm you taht your solution works perfectly.
I try different sizes and everything is drawn correctly without any wrong pixel.
Thank you very much