Hello,
I have created some variables structures to handle data like input status, output status and device status.
These have different data type inside and are like:
typedef struct _input{
//Ingressi sulla Lizard
bool b_input1;
bool b_input2;
...
bool b_inputN;
uint16_t an_value1;
uint16_t an_value2;
..
uint16_t an_valueM;
//Contatori ingresso fronti salita/discesa
} input_t;
typedef struct _output{
bool b_out1;
bool b_out2;
...
bool b_outN;
uint16_t an_out1;
uint16_t an_out2;
..
uint16_t an_outM;
}
typedef struct _device{
int32_t status;
int32_t mode;
...
} device_t
I have declared one global varaible for each structure in EW in the /Inline code:
input_t In;
output_t Out;
io_exp_t OutIOExp;
device_t Device;
I use these variables to "syncronize" input, output and device status from GUI to device board. To do this, in the Application::Device class, I have created some method like UpdateInput, UpdateOutput and UpdateStatus.
As in your DeviceIntegration example, I use threads and manage Input, Output and Status syncronization:
In your expamples, you use the function EwInvokeCopy to schedule the update of the GUI from the thread. I did the same, but the difference is that I don't pass a single variable value, but the entire structure. To explain better, in the input update thread I pass the input structure, for the state the state structure, and for the outputs the output structure.
To explain better, this is part of the code of the input thread:
static void ReadInputThread(const void* arg)
{
while (Threads_Initialized)
{
In.input1 = HAL_GPIO_ReadPin(INPUT1_GPIO_Port, INPUT1_Pin);
In.input2 = HAL_GPIO_ReadPin(INPUT2_GPIO_Port, INPUT1_Pin);
...
In.inputN = HAL_GPIO_ReadPin(INPUTN_GPIO_Port, INPUTN_Pin);
EwInvokeCopy(GUI_UpdateInput, &In, sizeof(input_t));
EwBspOsDelay(THREAD_WAIT_TIME);
}
//Terminazione thread
ReadInput_Thread_Active = 0;
EwBspOsThreadDestroy(EwBspOsThreadGetHandle());
}
I notice that only the function that updates the input GUI is executed. Using the EwIvoke function instead of the EwInvokeCopy function executes all three update functions.
Could it be that I'm already exhausting the internal queue with the first function? If so, is it possible to find out how large the internal queue is? Can I change the size of it?
If I understand correctly, the EwInwokeCopy function, in my specific case, creates a copy of the structure I pass (in this case, the input_t structure) in the internal queue, while the EwInwoke function does not? Since the variables are global and my goal is to always keep the GUI updated based on these variables, can I safely use the EwInvoke function and avoid creating a "useless" copy?
Nicola