Take data from one screen to another
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-03 4:59 PM
Hello everyone, I hope you can help me!!!
I'm at the beginning of programming in C++, and I'm having difficulty taking a variable from my main.c file to my screen created in touch gfx.
This error appears, where it apparently does not find the variable declaration.
Run Simulator
Generate
Done
Generate Assets
make -f simulator/gcc/Makefile assets -j8
Reading ./application.config
Reading ./target.config
Done
Post Generate
touchgfx update_project --project-file=simulator/msvs/Application.vcxproj
Done
Post Generate Target
touchgfx update_project
.cproject file: ../STM32CubeIDE/.cproject
Writing STM32CubeIDE project file: ../STM32CubeIDE/.project
Writing STM32CubeIDE project file: ../STM32CubeIDE/.cproject
Done
Compile
make -f simulator/gcc/Makefile -j8
Reading ./application.config
Reading ./target.config
Linking build/bin/simulator.exe
build/MINGW32_NT-6.2/gui/src/monitor_screen/MonitorView.o: In function `ZN11MonitorView15handleTickEventEv':
C:\TouchGFXProjects\MyApplication_2\TouchGFX/gui/src/monitor_screen/MonitorView.cpp:22: undefined reference to `dado'
collect2.exe: error: ld returned 1 exit status
generated/simulator/gcc/Makefile:160: recipe for target 'build/bin/simulator.exe' failed
make[2]: *** [build/bin/simulator.exe] Error 1
generated/simulator/gcc/Makefile:155: recipe for target 'generate_assets' failed
make[1]: *** [generate_assets] Error 2
simulator/gcc/Makefile:32: recipe for target 'all' failed
make: *** [all] Error 2
Failed
I followed what the course instructor said, but apparently it doesn't work.
Solved! Go to Solution.
- Labels:
-
TouchGFX
-
TouchGFX Designer
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-04 5:28 PM
Looks like you're trying to take a short cut and not using MVP approach.
See this video tutorial on how to pass a variable, in this case an ADC value, from main to the Presenter
https://youtu.be/EbWOv_0Lp-U?si=s2OKKDyJN6vpb-3a
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-04 1:07 AM
I am not sure the value "dado" is in other .c file (ex : in main.c)
If yes, you can try modify line 18 to "extern int dado;"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-04 2:05 AM - edited ‎2024-09-04 2:05 AM
Hello @BADA
Next time, please paste your code using </> button instead sharing screenshots. Please refer to our recommendation here on how to post a thread in this community.
Thank you for your understanding.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-04 2:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-04 5:28 PM
Looks like you're trying to take a short cut and not using MVP approach.
See this video tutorial on how to pass a variable, in this case an ADC value, from main to the Presenter
https://youtu.be/EbWOv_0Lp-U?si=s2OKKDyJN6vpb-3a
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-04 6:50 PM
I can build your project in STM32CubeIDE 1.16.0 with touchGFX 4.24.0. Did you try to reinstall them ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-05 1:30 AM - edited ‎2024-09-05 1:31 AM
Hello @BADA and welcome to the community! :smiling_face_with_smiling_eyes:
As other said, you can properly format your code (and log text) by using the </> button :
Regarding your question, since you created your variable from a TouchGFX file, you should include this file in your main.c.
Other than that, it is recommended to use the MVP design pattern to send or receive data from to GUI (TouchGFX) to the rest of the application (main.c and others). You can read more here : model-view-presenter-design-pattern
Here is a video tutorial to send data from a screen to the main.c : Touch GFX #8. Send Data from UI to MCU || UART
I hope this helps.
Once you solve your problem, I invite you to select the most helpful comment as "best answer".
Regards,
PS: If you want to properly display your code and log text using the </> button, you can do it by editing your message like so :
Software engineer at ST (TouchGFX)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-09-05 1:59 PM
Really, I was doing the wrong process, thank you for the help and reference!!
