2023-03-22 08:09 PM
I'm developing a device with embeded display running using TouchGFX which has set of valves and actuators and sensors. I have to control those valves and actuators based on user inputs and sensor readings. User inputs are given by the user from multiple scrreens. Also the display has no touch, screen navigation and option selection should implement using physical buttons.
My question is in which thread those application logic and state machines of of all physical components should be handled. From wheres shoud I do the decision making. In DefaultTask or TouchGFX task ? i.e. in main.c or Model.cpp ?
Thank you
Solved! Go to Solution.
2023-03-23 12:18 AM
Well, it depends if you want to stay clean in the MVP structure (Model-View-Presenter) so that your design is easier to port?
Since you don't have touch control, you can't take user input in the view and should manage it in the backend, typically in main.c. Then you send them to the model, which in turn sends the data to the presenter. The presenter, as mediator between model and view, is then responsible for preparing the data from the model for the view.
The TouchGFX support websites, which I highly recommend reading, show how backend communication can be done.
Hope that helps?
Regards
/Peter
2023-03-23 12:18 AM
Well, it depends if you want to stay clean in the MVP structure (Model-View-Presenter) so that your design is easier to port?
Since you don't have touch control, you can't take user input in the view and should manage it in the backend, typically in main.c. Then you send them to the model, which in turn sends the data to the presenter. The presenter, as mediator between model and view, is then responsible for preparing the data from the model for the view.
The TouchGFX support websites, which I highly recommend reading, show how backend communication can be done.
Hope that helps?
Regards
/Peter
2023-03-23 02:47 AM
Thank you very much for the answer.
Just asking for further clarification:- It's mean I just have to send whether the button is pressed or not. model is responsible for making decisions and change the state according to the current state and pressed button. And also sending some events to control valves to the main.c
Am I correct?
Thank you
2023-03-23 02:57 AM
Correct.
2023-03-23 05:49 AM
Okay. Thank you very much
2023-03-23 05:51 AM
You're welcome!
If the problem is solved, please mark this thread as answered by selecting Select as best, as also explained here. This will help other users find that answer faster.
Regards
/Peter