Jump to content

Tobias Schenk

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by Tobias Schenk

  1. Somehow that is not working in my case, I tried to rewrite the program using only uGFX threads and also to save the object in the Heap, but nothing could solve my problem.

    I tried to cut my program to the essential parts, to be able to show my problem, app_init.cpp is creating and handling the thread which is responsible for changing the value and ugfxTest.cpp should just display the passed value but somehow that wont work. I can't really explain what could be the reason for this, if someone has an idea or could have a look into it I would appreciate it a lot.

    the program is started adding -g due to the setup in main.cpp: ".build/FolderName -g"

    Makefile

    gfxconf.h

    app_init.h

    data_container.h

    no.cpp

    no.h

    ugfxTest.h

  2. I will try to give a better explanation of the rest of the program, in the main there is running a seperate thread for updating the object and this thread has its own stack where the object is located. Therefore I asume that uGFX is creating an additional thread which causes the GuiLoop to not run in the main thread anymore and therefore losing access to the object. 

    Is it possible that this is the cause of the problem? Or can you try to explain how uGFX handles its threads?

  3. Hello uGFX Community,

    I am currently trying to pass a reference of an object (DEngine) to my uGFX GUI, this object is changed in a seperate thread which is running in the main program. But somehow those changes do not apply to the reference of the object in the GUI even it is the correct instance of the DEngine object. I found out that the problem is the "gfxInit();" without it the cout gives back the correct values.

     

    Does anybody has some experience with that or knows if it is possible to realize it like that, without either running the whole program using uGFX threads or seperating the GUI from the rest of the program?

     

    That is how the important part of my GUI loop looks like:

    void GuiLoop(bool master, DEngine *dengine)
    {

        //Get the Fonts we want to use
        dejavu12 = gdispOpenFont("DejaVuSans12");
        dejavu16 = gdispOpenFont("DejaVuSans16");
        dejavu18 = gdispOpenFont("DejaVuSans18");
        dejavu20 = gdispOpenFont("DejaVuSans20");
        dejavu24 = gdispOpenFont("DejaVuSans24");
        dejavu28 = gdispOpenFont("DejaVuSans28");
        dejavu32 = gdispOpenFont("DejaVuSans32");
        dejavubold54 = gdispOpenFont("DejaVuSansBold54");
        dejavubold80 = gdispOpenFont("DejaVuSansBold80");

        //Initialize the Display
        //gfxInit();

        //Setting the Init Variables
        //setVariablesInit();

        //Creating our Widgets
        createConsole(White, Black, dejavu12);
        createParkingButton();
        createStartStopButton();
        createCustomSettingsButton();*/
        createSettingsPage();

        //Draw the Init Display
        drawDisplayInit();

        //Event Listener for Buttons
        geventListenerInit(&gl);
        gwinAttachListener(&gl);

        //Timer for Redrawing the Screen
        gtimerInit(&GT1);

        //Redraw Changed Parts every time_rw ms
        gtimerStart(&GT1, drawDisplayVariable, 0, TRUE, time_rw);
        
        while (1) {
          gfxSleepMilliseconds(100);
            load = dengine->GetLoad();
            vpedal = dengine->GetVpedalActual();
            rpm_de = dengine->GetRPM();
            std::cout<<dengine->GetRPM()<<std::endl;

    ...}

    Thank you very much in advance.

    Tobi

  4. Thank you for the fast answer, that is good to know. So that means I just need to change my Makefile in order that the .cpp files get compiled by the C++ compiler, right now I am using the example Makefile for the Linux-SDL board which uses the gmake script and so far I thought it is detecting from the ending of the files wether to use the gcc or g++. 

    I am not really familar with setting up a Makefile, so if someone has an advice for me, that would be great. :)

  5. Hello,

    I'm sorry that I dig out that old topic, but since my question is related to it I didnt want to open a new topic. It is not possible to integrate C++ sources into my project which use C++ header files like <iostream> and std:: functions, right? Because I get a lot of errors when I try that, or is this just a problem of the GNU gcc compiler?

    Thanks in advance.

  6. Hello,

    first of all I wanted to say I really enjoy working with the ugfx library, its really fun. I m really new to embedded programming or actually programming at all and working on some project for college (studying mechatronics) and this is my first post here since so far I could find a solution for every problem I faced in here quite fast :)

    Right now I m stuck getting the touch to work in my GUI application.

    I m running my application on my Lenovo Yoga 900 on Ubuntu using the SDL multiple Driver, those should also support touch right?

    In my application I have 2 Buttons using GWIN which I would like to press with my touchscreen but so far I can only press them with my mouse, same goes for any Widget demo (I am only able to move my mouse by touching somewhere), not  sure if there are some more things to be setup to get the tough to work using the SDL drivers.

    Thats how my code looks like:

        geventListenerInit(&gl);
        gwinAttachListener(&gl);
        geventListenerInit(&gl2);
        gwinAttachListener(&gl2);

        GEvent *pe;

        while(1){
                //Get an Event
                pe = (GEvent *)geventEventWait(&gl, TIME_INFINITE);
                updateTime();
                displayTime();

                switch(pe->type) {
                    case GEVENT_GWIN_BUTTON:
                        if (((GEventGWinButton*)pe)->gwin == ghSettingsButton){
                            // Our button has been pressed
                            updateTime();
                            gwinPrintf(GWConsole, "[%s%] Settings entered!\n", consoletime);
                        }
                        else if ((((GEventGWinButton*)pe)->gwin == ghStartStopButton) && (!engine_running)){
                            updateTime();
                            gwinPrintf(GWConsole, "[%s%] Engine started!\n", consoletime);
                            engine_running = TRUE;
                            createStartStopButton();
                            gwinClear(ghSettingsButton);
                        pe = (GEvent *)geventEventWait(&gl2, TIME_INFINITE);
                            while((((GEventGWinButton*)pe)->gwin != ghStartStopButton)){
                                setVariablesRandom();
                                drawDisplayInit();
                                createParking();
                                createSettingsButton();
                                updateTime();
                                displayTime();
                                if(hour == 0 && min == 0 && sec == 0)
                                    displayDate();
                                if(driving_state < 7)
                                driving_state++;
                                else
                                driving_state--;
                                createDscale();
                                if (speed < 60)
                                speed += 5;
                                else
                                speed = 0;
                                gfxSleepMilliseconds(3000);

                                //setVariablesInit();
                                //updateTime();
                                //drawDisplayInit();
                                //gfxSleepMilliseconds(1000);

                            }
                            updateTime();
                            gwinPrintf(GWConsole, "[%s%] Engine stopped!\n", consoletime);
                            setVariablesInit();
                            drawDisplayInit();

                        }
                        else if ((((GEventGWinButton*)pe)->gwin == ghStartStopButton) && (engine_running)){

                            }
                            break;
                        default:
                            break;

                            }
                        }

     

    Thank you in advance

    Tobi

×
×
  • Create New...