cancel
Showing results for 
Search instead for 
Did you mean: 

Qrcode is not interpretable

MPast.1
Senior II

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);
}

 

 

display screendisplay screenQrcode detailQrcode detail

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

 

18 REPLIES 18

Sorry, you missed my point: can you successfully display other things as QR codes ?

  • Other URLs as QR codes ?
  • Text other than URLs as QR codes ?

Also:

  • Have you checked your definition of string in your original code ?
  • Have you tried specifying the string as a literal directly in the constructor ?
MPast.1
Senior II

1708789060040.jpg1708790629533.jpg

 

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?

 


@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:

https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/custom-widgets#example-source-code

What if you set scale to 1, can you still see 'dirty' pixels ?

Br JTP

 

1708799552836.jpg

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..

Touchgfx config.png

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

 

 

Hello

I'm not very familiar with partial buffer strategy, but int this document

https://support.touchgfx.com/docs/development/scenarios/lowering-memory-usage-with-partial-framebuffer

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

I'm trying with these settings and setScale(6):

Screenshot 2024-02-25 220923.png

  but the same problems appears:

1708895333615.jpg

The strange things is witch errors are present only on the left size of the code.

Tomorrow I will check the code.

Hello

Interesting, with smaller buffer there is more inteference.

JTP1_0-1708922205834.png

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.

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/touchgfx-custom-widget-with-partial-framebuffer-how-to/td-p/110553

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.

 

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/asking-for-help-with-drawing-custom-image-from-data-that-is/td-p/635569

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/what-is-the-difference-getanimationstorage-vs-lockframebuffer/td-p/641103

Br JTP

 

GaetanGodart
ST Employee

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):

GaetanGodart_0-1708946260418.png


Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

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.

1709235018399.jpg

Thank you very much