Updating items on screen while scanning event handler.
-
- Posts: 7
- Joined: 02 Dec 2022 16:27
Updating items on screen while scanning event handler.
Is there a way to periodically update items such as progress bars after the main_screen_show function has finished running? Normally, all activity stops while the event handler waits for an event to be activated. Is there a way to trigger an event without user input, if there is no activity for a couple of seconds?
-
- Posts: 96
- Joined: 09 Apr 2021 20:37
Re: Updating items on screen while scanning event handler.
Hello d_scheider,
I'm not sure if I understand your issue correctly.
You can update any component any time with the vtft_draw_component function.
I have made a very simple example for the progress bar. Maybe it helps you to understand the concept.
viewtopic.php?f=147&t=79511
I'm not sure if I understand your issue correctly.
You can update any component any time with the vtft_draw_component function.
I have made a very simple example for the progress bar. Maybe it helps you to understand the concept.
viewtopic.php?f=147&t=79511
Kind regards
Frank
Fusion for STM32 v8, STM32F407ZG@168MHz, 4" TFT capacitive
mikromedia 3, PIC32MZ2048EFH100@200MHz, 3" TFT capacitive
NECTO Studio 3.0.0, mikroC AI for ARM/PIC32, mikroSDK v.2.7.2
Frank
Fusion for STM32 v8, STM32F407ZG@168MHz, 4" TFT capacitive
mikromedia 3, PIC32MZ2048EFH100@200MHz, 3" TFT capacitive
NECTO Studio 3.0.0, mikroC AI for ARM/PIC32, mikroSDK v.2.7.2
-
- Posts: 7
- Joined: 02 Dec 2022 16:27
Re: Updating items on screen while scanning event handler.
I guess I should have included more details. All I'm really trying to do is run a loop while allowing user input to change values. This is easy to do with physical buttons:
while (1){
play sound;
if (PORTB = 0x01) {Volume++;} //Button maps to volume up
else if (PORTB = 0x02) {Volume--;} //Button maps to volume down
else if (PORTB = 0x03) {break;} //Button maps exit
}
However, this does not work with on screen buttons in NECTO Designer, because all buttons are mapped to functions, not variables or hex values. Trying to run a continuous loop will disable event handling section, because the program is tied up in the loop. Is there a way to include checking the event handler in the loop, or break from the loop, check event handling, then return to the loop?
while (1){
play sound;
if (PORTB = 0x01) {Volume++;} //Button maps to volume up
else if (PORTB = 0x02) {Volume--;} //Button maps to volume down
else if (PORTB = 0x03) {break;} //Button maps exit
}
However, this does not work with on screen buttons in NECTO Designer, because all buttons are mapped to functions, not variables or hex values. Trying to run a continuous loop will disable event handling section, because the program is tied up in the loop. Is there a way to include checking the event handler in the loop, or break from the loop, check event handling, then return to the loop?
-
- Posts: 96
- Joined: 09 Apr 2021 20:37
Re: Updating items on screen while scanning event handler.
Hello,
I think I've got your point and the solution might be to call vtft_process(&vtft)
Here is an extract from my application. It runs a motor, updates the screen with the speed information,
and checks the start/stop button at the same time. I removed some non-relevant parts, so this code is
not compile-clean.
The variable StartStopButton_start will be set in the respective xxxxxx_screen.c program part, depending on the button event.
I hope this helps.
I think I've got your point and the solution might be to call vtft_process(&vtft)
Here is an extract from my application. It runs a motor, updates the screen with the speed information,
and checks the start/stop button at the same time. I removed some non-relevant parts, so this code is
not compile-clean.
Code: Select all
extern bool StartStopButton_start ;
/**
* @brief Application task function.
*/
void application_task()
{
float motor_speed_hz = 0;
status_reg_t status ;
if ( StartStopButton_start )
{
brushless23_pwm_set_duty_cycle ( &brushless23, 0.60 );
if ( BRUSHLESS23_OK == brushless23_get_motor_speed ( &brushless23, &motor_speed_hz ) )
{
print_status("Speed: xxHz");
}
} else {
brushless23_pwm_set_duty_cycle ( &brushless23, 0.00 );
}
if ( BRUSHLESS23_OK == brushless23_get_status_reg ( &brushless23, &status ) )
{
bl23_screen_set_indicator(OVERCURRENT, (status.field.ISD == 1)) ;
bl23_screen_set_indicator(START_ERROR, (status.field.ST_FAIL == 1)) ;
}
}
/**
* @brief Application main function.
*/
void main()
{
application_init();
while (1)
{
vtft_process(&vtft);
// Your code here
application_task();
}
}
I hope this helps.
Kind regards
Frank
Fusion for STM32 v8, STM32F407ZG@168MHz, 4" TFT capacitive
mikromedia 3, PIC32MZ2048EFH100@200MHz, 3" TFT capacitive
NECTO Studio 3.0.0, mikroC AI for ARM/PIC32, mikroSDK v.2.7.2
Frank
Fusion for STM32 v8, STM32F407ZG@168MHz, 4" TFT capacitive
mikromedia 3, PIC32MZ2048EFH100@200MHz, 3" TFT capacitive
NECTO Studio 3.0.0, mikroC AI for ARM/PIC32, mikroSDK v.2.7.2
-
- Posts: 7
- Joined: 02 Dec 2022 16:27
Re: Updating items on screen while scanning event handler.
Thanks, that works perfectly.