2020-04-28 03:14 AM
Hello, I and using Touchgfx in my project. I want to implement below.
1) During run time , I want to to turn off complete screen.
2) During run time , I want to change complete screen.
3) I want to generate QR code dynamically and also want to clear it sometimes during run time. I got github link and added those files in my project. Still I am not sure how to call it. You have mentioned to call qrCode.setXY(0,0) , qrCode.setQRCode(&code), qrCode.setScale(4) , add(qrCode) methods but I am unable to find it.
Can any one please help ?
Solved! Go to Solution.
2020-04-28 03:46 AM
1) Seems like a hardware thing.
2) Change screens at run-time with interactions in the designer.
3) QRCodeWidget inherits from Widget which has setXY() and your view has add(). setQRCode() and setScale() are declared in QRCodeWidget.hpp. It's all there on github.
class QRCodeWidget : public touchgfx::Widget
{
...
/**
* @fn void QRCodeWidget::setQRCode(QRCode *code);
*
* @brief Set the qr code to display
*/
void setQRCode(QRCode *code);
/**
* @fn void QRCodeWidget::setScale(uint8_t s);
*
* @brief Set the scaling factor of the widget
*/
void setScale(uint8_t s);
...
}
To summarize. If you're looking at the README.md for QR code, then:
qrCode.setXY(0,0); //From widget
qrCode.setQRCode(&code); //From QRCodeWidget
qrCode.setScale(4); //From QRCodeWidget
add(qrCode); //Add to root container of your screen (view)
2020-04-28 03:46 AM
1) Seems like a hardware thing.
2) Change screens at run-time with interactions in the designer.
3) QRCodeWidget inherits from Widget which has setXY() and your view has add(). setQRCode() and setScale() are declared in QRCodeWidget.hpp. It's all there on github.
class QRCodeWidget : public touchgfx::Widget
{
...
/**
* @fn void QRCodeWidget::setQRCode(QRCode *code);
*
* @brief Set the qr code to display
*/
void setQRCode(QRCode *code);
/**
* @fn void QRCodeWidget::setScale(uint8_t s);
*
* @brief Set the scaling factor of the widget
*/
void setScale(uint8_t s);
...
}
To summarize. If you're looking at the README.md for QR code, then:
qrCode.setXY(0,0); //From widget
qrCode.setQRCode(&code); //From QRCodeWidget
qrCode.setScale(4); //From QRCodeWidget
add(qrCode); //Add to root container of your screen (view)
2020-04-28 07:36 AM
Thanks for reply. I am looking to know where should i put below? In main ?
qrCode.setXY(0,0); //From widget
qrCode.setQRCode(&code); //From QRCodeWidget
qrCode.setScale(4); //From QRCodeWidget
add(qrCode); //Add to root container of your screen (view)
Also Regarding turn off complete screen during run time, will be able to suggest which hardware changes I need to do ?
2020-04-28 09:07 AM
This code goes into setupScreen() of your view. Remember to declare qrCode in the view headerfile .
/Martin
2020-04-28 09:42 AM
I added code inside my main screen view. I just want to put some dummy QR code for quick test so commented out setQRcode part but post below code, program is going to hard fault.
Should we generate QR code with some open library and pass those pixel in qrCode.setQRCode ?
Please suggest.
PS - I updated code as below, but still it didn't help. code is going to hardfault.
2020-04-28 10:30 AM
code.at(x,y); will just return the value of the QR code at that spot so you won't gain anything by calling it, If you look at draw() for QRCodeWidget, you'll see it loops over the qr-code width/height and asks for the value at each index of the code to draw it into the framebuffer.
Does the app run fine if not adding a QR code?
And yes you need to supply a QR code somehow. If you check the QRCode class it just randomizes the data for each "pixel".
/Martin
2020-04-28 10:39 AM
Yes, my code is working fine without adding QR code. How should I make it work ? Please suggest ?
Also code is not going to QRCodeWidget::draw, Before this code is getting stuck at hard fault. I added code at void MainScreenViewBase::setupScreen() .
2020-04-28 03:47 PM
Using an RTOS? Try increasing stack of the task and the general heap.
2020-04-28 09:48 PM
Yes I m using RTOS. i tried increasing it but no luck.
Also I am not able to track where exactly its going for hard fault. Stack callback is like below.
My added QR code is as below.
void MainScreenViewBase::setupScreen()
{
QRCodeWidget qrCode;
QRCode code;
qrCode.setXY(30,50); //From widget
qrCode.setQRCode(&code); //From QRCodeWidget
qrCode.setScale(4); //From QRCodeWidget
add(qrCode); //Add to root container of your screen (view)
}
2020-04-28 10:13 PM
That's just the heap. Did you increase the stack size for your task?