2020-01-28 09:52 AM
If I call the function with the button from the STM32F746G-DISCO screen, e.g. a counter, do I have to use FreeRTOS to display the value of the counter on the screen?
Solved! Go to Solution.
2020-01-31 02:23 AM
In that case just follow the instructions in the pinned post in this forum, there's information on that. Generally:
1) Fetch the value from your other RTOS task inside Model::tick()
2) implement a function in the modelListener interface to handle this value (temperatureUpdated(uint8_t _temp))
3) Notify active presenter of this new value: modelListener->temperatureUpdated(val)
4) Implement that function in your presenter.
5) Call something on the view to update the temperature, maybe text area.
/Martin
2020-01-29 05:41 AM
You do not have to use an RTOS. I'm not 100% sure what you mean by "if i call the function with the button".
Generally: The Model class (Model.cpp) is the heart of a TouchGFX application. This is where you will interface with e.g. OS message queues to get values from other tasks, or you could simply sample a GPIO port directly inside Model::tick() if you wanted. A Model knows about a ModelListener (as modelListener). Use this interface to propagate values to your active screen.
modelListener->temperatureUpdated(temp);
Please see the pinned post/sticky on integrating hardware with your UI.
If you're generating this value yourself you can also simply use the same interface
/Martin
2020-01-29 07:34 AM
Hi Martin
Thank you.
There is a button on the STM32F746-DISCO desktop. It calls the pulse counting function. I want to display the number of pulses.
2020-01-29 10:13 AM
I have in main.cpp
struct {
uint32_t duty; // obroty silników
uint8_t count_poster; // okno
uint8_t posters; // ile okien
uint16_t time; // czas postoju
} my_var;
in Model.hpp
uint8_t getmy_var.count_poster() const {return currentmy.var_count_poster;}
void tick();
protected:
uint8_t currentmy_var.count_poster;
why syntax error?
2020-01-31 01:12 AM
I'm not sure what you mean by "desktop", hmm.
Where are you counting these pulses?
/Martin
2020-01-31 01:20 AM
"desktop" - screen STM32F746G-DISCO.
The pulses are counted in the program's main.c file in the second RTOS task. I want to display the number of pulses.
2020-01-31 02:23 AM
In that case just follow the instructions in the pinned post in this forum, there's information on that. Generally:
1) Fetch the value from your other RTOS task inside Model::tick()
2) implement a function in the modelListener interface to handle this value (temperatureUpdated(uint8_t _temp))
3) Notify active presenter of this new value: modelListener->temperatureUpdated(val)
4) Implement that function in your presenter.
5) Call something on the view to update the temperature, maybe text area.
/Martin
2020-02-06 03:59 AM
Hello
Thank you for the advice. It works.
How to make it work step by step in the reverse direction from the screen to the variable in the system?
I analyzed "Tutorial 3".
The clock works except reducing the hours on the screen 1?
2020-02-07 02:24 AM
The view has a pointer to the presenter, the presenter has a pointer to the model
View:
presenter->updateValue(value);
Presenter:
model->saveValue(value);
2020-02-12 03:53 AM
I have such a mistake:
C:/STM32CubeIDE/workspace_1.1.0/poster/Debug/../TouchGFX/gui/src/second_screen/SecondPresenter.cpp:21: undefined reference to `Model::GetNumberPosters()'
How and where to fix it?
In Model.hpp I have:
uint8_t GetNumberPosters();
In Model.cpp I have:
uint8_t GetNumberPosters() {
return bufnumberposters;
}