![](https://community.ugfx.io/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Tobias Schenk
-
Posts
12 -
Joined
-
Last visited
Content Type
Forums
Store
Downloads
Blogs
Posts posted by Tobias Schenk
-
-
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?
-
I am sorry for the long response time lately but I was just in the middle of exams, yes I checked that, the object is still altered just not in the GuiLoop, for me it appears like that after including gfxInit it is just making a copy of that object.
-
Thank you for the response, I am not using any compiler optimization "-O0".
The static cout calls dont change anything.
While the gfxInit is commented out I get an output like:
foo
812
bar
foo
864
bar ...
etc. and with the gfxInit the output looks like:
foo
812
bar
foo
812
bar ...
Can't really explain what could cause this
-
Thanks inmarket for the hint, I will change that in my code, but that did not cause any problems so far and does not seem to be the reason for my problem as I tryed to comment out all uGFX code and checked the output of cout and adding/removing gfxInit() causes the cout to be correct and having the updated dengine->getRPM() value or not.
-
Hello Joel,
thank you for your answer, its running on a Lenovo Yoga with an Intel i7 processor, I am using Linux (Ubuntu 17.10) 64Bit, the compiler is GCC and I m sorry but I dont really know what exactly you mean with "Who is managing the memory".
-
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(>1);//Redraw Changed Parts every time_rw ms
gtimerStart(>1, 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
-
-
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.
-
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.
-
Hey,
thanks for the answers, I found that line in the SDL driver too but wasn't completely aware of its function and didn't want to make changes on it, but that actually did the trick and now the touch is working fine on my Netbook, so thank you guys
-
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
Problem with passing a reference of an Object to the GUI
in Support
Posted
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