UI in Riverdi doesn't render if keep alive is >0
Hello. I have the Riverdi 7' display with PoE addon. While I am working with a project for this display, where I am trying to implement the MQTT protocol, I am facing an issue that cannot understand. It has to do with the keep alive parameter, if I set it to zero then it acting normal. For instance it is able to read messages and also to print them to the UI. Nonetheless, if the keep alive parameter is greater to zero then the UI cannot render to the screen. The only thing I see is a black screen. I am using the LwIP library.
The way that I am connecting the screen with the broker is that :
void StartDefaultTask(void *argument)
{
/* init code for USB_HOST */
MX_USB_HOST_Init();
/* init code for LWIP */
MX_LWIP_Init();
/* USER CODE BEGIN StartDefaultTask */
flag0.clear_flags = 0; // Clear all flags.
struct mqtt_connect_client_info_t ci; // Create an information parameter about the client.
client = mqtt_client_new(); // Initialize the new client instance.
/* Infinite loop */
for(;;)
{
if (mqtt_client_is_connected(client) == 0){// If the client is not connected with the server.
mqtt_init(client, ci); // Attempt connection.
}
osDelay(1);
}
/* USER CODE END StartDefaultTask */
}
and the mqtt_init() function:
void mqtt_init(mqtt_client_t *client, struct mqtt_connect_client_info_t ci)
{
err_t err;
ip_addr_t mqttIP;
memset(&ci, 0, sizeof(ci)); // Initialize the parameter for client information and set the all 0 to entire size of ci.
/* Declare information about the client */
ci.keep_alive = 0; // With this value to zero means that the client will never checks after the connection with the broker if they are still connected after a period of time.
ci.client_id = "STM32H7-R"; // It is important to be unique. It doesn't matter if it is a random string but it must be unique as I said.
ci.will_qos = 0;
ci.will_retain = 0;
ci.will_msg = NULL;
ci.will_topic = NULL;
ci.client_user = NULL; // Set user name if you have connection options.
ci.client_pass = NULL; // Set password if you have connection options.
err = dns_gethostbyname(BROKER_IP, &mqttIP, mqtt_resolved_cb, NULL); // Declare the server IP:192.168.10.26
if (err != ERR_OK)
{
printf("Error, in declaring the IP address to the proper variable <mqttIP>, in order to establish connection with the broker\n\r");
}
mqtt_set_inpub_callback(client, mqtt_incoming_publish_cb, mqtt_incoming_data_cb, &ci); // Define callback functions.
mqtt_client_connect(client, &mqttIP, BROKER_PORT, mqtt_connection_cb, 0, &ci); // Connect with the server IP:192.168.10.26
}
