Skip to content

Commit df109a2

Browse files
committed
Backported lwl changes
Decreased mqtt sump delay updated mqtt_publish_wrapper use
1 parent 3f04663 commit df109a2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

code/CM7/Core/lwl/lwl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,16 @@ void dump_log_mqtt()
155155
taskEXIT_CRITICAL( );
156156

157157
// send the snapshot through mqtt
158-
mqtt_publish_wrapper( mqtt_data.client , MQTT_PUB_LWL_INDEX_ID , metadata , sizeof(metadata) , 1 , 0 , NULL , NULL );
158+
mqtt_publish_wrapper( MQTT_PUB_LWL_INDEX_ID , metadata , sizeof(metadata) , 1 , 0 , NULL , NULL );
159159

160160
int32_t current_sent_size = 0;
161161
for( int32_t remaining_data = LWL_BUFFER_SIZE ; remaining_data > 0 ; remaining_data -= current_sent_size )
162162
{
163163
const int32_t payload_max_size = MQTT_OUTPUT_RINGBUF_SIZE - sizeof(MQTT_PUB_LWL_DATA_ID) - 8; // dont know why -8. According to mqtt, largest outgoing publish message = topic+payloads
164164
current_sent_size = ( remaining_data > payload_max_size ) ? payload_max_size : remaining_data ;
165165

166-
osDelay(5); // mqtt looses data when sending a burst after idling. This small delay seems to fix it.
167-
mqtt_publish_wrapper( mqtt_data.client , MQTT_PUB_LWL_DATA_ID , &(lwl_data.buffer[LWL_BUFFER_SIZE - remaining_data]) , current_sent_size , 1 , 0 , NULL , NULL );
166+
osDelay( 1 ); // mqtt looses data when sending a burst after idling. This small delay seems to fix it.
167+
mqtt_publish_wrapper( MQTT_PUB_LWL_DATA_ID , &(lwl_data.buffer[LWL_BUFFER_SIZE - remaining_data]) , current_sent_size , 1 , 0 , NULL , NULL );
168168
}
169169
}
170170
#endif

0 commit comments

Comments
 (0)