cancel
Showing results for 
Search instead for 
Did you mean: 

Where to implement complex application logic and state machines with physical interactions

CAbey.1
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5
Peter BENSCH
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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

Correct.

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Okay. Thank you very much

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.