99#include < led_ctrl.h>
1010#include < log.h>
1111#include < lte.h>
12- #include < mcp9808.h>
1312#include < mqtt_client.h>
1413#include < sequans_controller.h>
15- #include < veml3328.h>
1614
1715#define MQTT_PUB_TOPIC_FMT " %s/sensors"
1816
@@ -127,6 +125,7 @@ static uint32_t failed_publishes = 0;
127125static uint32_t timer = 0 ;
128126
129127void loop () {
128+
130129 if (!connecteded_to_network) {
131130 Log.info (" Not connected to the network. Attempting to connect!" );
132131 if (connectLTE ()) {
@@ -142,26 +141,26 @@ void loop() {
142141 }
143142 }
144143
145- if (millis () - timer > 10000 ) {
146- if (connected_to_broker) {
147- char message_to_publish[8 ] = {0 };
148- sprintf (message_to_publish, " %lu" , counter);
149-
150- bool published_successfully = MqttClient.publish (mqtt_pub_topic,
151- message_to_publish,
152- AT_LEAST_ONCE,
153- 60000 );
154- if (published_successfully) {
155- Log.infof (" Published message: %s. Failed publishes: %d.\r\n " ,
156- message_to_publish,
157- failed_publishes);
158- } else {
159- failed_publishes++;
160- }
161-
162- counter++;
144+ // if (millis() - timer > 10000) {
145+ if (connected_to_broker) {
146+ char message_to_publish[8 ] = {0 };
147+ sprintf (message_to_publish, " %lu" , counter);
148+
149+ bool published_successfully = MqttClient.publish (mqtt_pub_topic,
150+ message_to_publish,
151+ AT_LEAST_ONCE,
152+ 60000 );
153+ if (published_successfully) {
154+ Log.infof (" Published message: %s. Failed publishes: %d.\r\n " ,
155+ message_to_publish,
156+ failed_publishes);
157+ } else {
158+ failed_publishes++;
163159 }
164160
165- timer = millis () ;
161+ counter++ ;
166162 }
163+
164+ timer = millis ();
165+ // }
167166}
0 commit comments