Skip to main content
CAbey.1
Associate III
March 23, 2023
Solved

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

  • March 23, 2023
  • 5 replies
  • 1355 views

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

This topic has been closed for replies.
Best answer by Peter BENSCH

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

5 replies

Peter BENSCH
Peter BENSCHBest answer
ST Technical Moderator
March 23, 2023

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.
CAbey.1
CAbey.1Author
Associate III
March 23, 2023

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

Peter BENSCH
ST Technical Moderator
March 23, 2023

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.