cancel
Showing results for 
Search instead for 
Did you mean: 

Touchgfx change complete screen during run time and customized widget creation

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 ?

50 REPLIES 50

sure, how exactly ?any suggestion, As i m not much aware of inside of tochgfx and i can't see much from stack callback at hard fault.

Also please let me know which class will be triggered with this "add(qrCode)"

add(qrCode); will add the widget to the root container of your view - call it from MyView::setupScreen().

I added my code as below. My screen name is MainScrenView. What do u means by root container of view. If u can tell by some name i can check and put break point to find exact error as this is bit confusing for me and i m not much into cpp.

If when I am checking , it seems like add will call to screen.hpp method, Is this coreect?

Thanks

void MainScreenView::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)
 
}

Don't worry about what a root container is. You must add() things to a Screen/View for it to appear on display. Declare the QRCodeWidget (qrCode) and QRCode in your headerfile and put those 4 lines of code we've talked about in your setupScreen()

Ok I tracked that add(qrCode) will call Container::add and code is able to come out from this without any assertion. Post not sure whats going wrong,

void Container::add(Drawable& d)
{
    assert(&d != this && "Cannot add Drawable to self");
    assert(d.parent == 0 && "Cannot add Drawable multiple times");
 
    // Initialize d to have this as parent and no sibling.
    d.parent = this;
    d.nextSibling = 0;
 
    // Check if d is the first child to be added (container is empty)
    if (!firstChild)
    {
        firstChild = &d;
    }
    else
    {
        Drawable* head = firstChild;
        // Skip to end of currently added children
        while (head->nextSibling)
        {
            assert(head != &d && "Cannot add Drawable multiple times");
            head = head->nextSibling;
        }
        assert(head != &d && "Cannot add Drawable multiple times");
        // Make last child now point to d.
        head->nextSibling = &d;
    }
}

Do u have any policy to share screen so we can fix this kinda quick ?

OK, So I did one experiment. I put QRCodeWidget qrCode outside MainScrenView (means like global class) so code stared working without hardware fault and i can able to see one black pixel box on display. But there is one issue. I explained it down.

QRCodeWidget qrCode;
 
void MainScreenView::setupScreen() {
 
	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)
 
}

So there are 2 screens in my project, First screen is logo screen which will go on display during power up and post 1 sec , my main screen will come which has QR code. and this was working fine when I didn't included QR code part.

Post adding QR code(updated one), logo screen started moving after 1 sec but now move is too slow . it takes like 10 secs to shift screen to main screen from right to left.

Not sure. Any suggestion ?

Updates:

Issue was with the code written at QRCodeWidget::draw. Seeems like highlighted code was making things slow. I replaced this with dummy value and this started working fine.

0693W000000WgzAQAS.jpg

As this is working fine, I have below question. Please help.

1) Whats is the correct way of passing value of QR pixel ? Should I pass similar to above highlighted code from some QR pixel array generated by some library.

2) During Run time if i want to update QR code, How should i make touchgfx to do it ?

3) If I want to clean QR code during run time, how should i do ? Post QR erase , it should go back as background color/image.

4) Suppose I want to draw one circle ( this shape may differ based of some logic, Circle is just for example), so i m planing to use same QR widget class as during that time QR code will not be used. I want that background should not change, just wann put shape. How can I achieve this while remaining background as same. Any support from touchgfx on this ?

 Thanks

0693W000000WgzUQAS.png

@Martin KJELDSEN​  Hi, Did you get the chance to check ? Please suggest.