Solved reviews
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#ifndef INC_MQTTA_H_
|
||||
#define INC_MQTTA_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @brief Initialize MQTT application
|
||||
*
|
||||
|
||||
@@ -130,7 +130,7 @@ static void mqtt_incoming_publish_cb(void* arg, const char* topic, uint32_t tot_
|
||||
|
||||
/**
|
||||
* @brief Handles incoming publish data
|
||||
* Handles the recieved data from a publish to a subscribed topic
|
||||
* Handles the received data from a publish to a subscribed topic
|
||||
*
|
||||
* @param[in] arg
|
||||
* @param[in] data The incoming data
|
||||
@@ -160,13 +160,15 @@ static void mqtt_incoming_data_cb(void* arg, const uint8_t* data, uint16_t len,
|
||||
LOG_INFO(TAG, "incoming data on input/setImage: %s.", data_buffer);
|
||||
lcd_clear_images();
|
||||
lcd_set_bg_color_layer0(bgcolor);
|
||||
if (data_buffer[len - 3] == 'b') {
|
||||
lcd_draw_img_from_fs((const char*)data_buffer, xpos, ypos);
|
||||
}
|
||||
if (data_buffer[len - 3] == 'g') {
|
||||
gif = lcd_draw_gif_from_fs((const char*)data_buffer, xpos, ypos);
|
||||
if (gif == NULL) {
|
||||
LOG_INFO(TAG, "GIF could not be drawn");
|
||||
if (strlen(data_buffer) >= 3) {
|
||||
if (data_buffer[len - 3] == 'b') {
|
||||
lcd_draw_img_from_fs((const char*)data_buffer, xpos, ypos);
|
||||
}
|
||||
if (data_buffer[len - 3] == 'g') {
|
||||
gif = lcd_draw_gif_from_fs((const char*)data_buffer, xpos, ypos);
|
||||
if (gif == NULL) {
|
||||
LOG_INFO(TAG, "GIF could not be drawn");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -210,7 +212,7 @@ static void mqtt_connection_cb(mqtt_client_t* client, void* arg, mqtt_connection
|
||||
if (status != MQTT_CONNECT_ACCEPTED) {
|
||||
LOG_INFO(TAG, "mqtt_connection_cb: Disconnected, reason: %d", status);
|
||||
|
||||
while (connection_attempt_counter < ATTEMPT_RECONNECT_AMOUNT) {
|
||||
if (connection_attempt_counter < ATTEMPT_RECONNECT_AMOUNT) {
|
||||
connection_attempt_counter++;
|
||||
// Try to reconnect
|
||||
mosquitto_connect(client);
|
||||
@@ -409,6 +411,4 @@ static void create_publish_string(char* file_type, char* payload_buffer, size_t
|
||||
}
|
||||
strncat(payload_buffer, "\0", buffer_size - strlen(payload_buffer) - 1);
|
||||
LOG_DEBUG(TAG, "String: %s", payload_buffer);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user