Skip to content

Commit d9b4f57

Browse files
committed
Turn non critical error messsages into warnings
1 parent f9b9317 commit d9b4f57

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/mqtt_client.cpp

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -463,18 +463,11 @@ bool MqttClientClass::begin(const char *client_id,
463463
sprintf(command, MQTT_CONFIGURE_TLS, client_id);
464464
}
465465

466-
if (!SequansController.writeCommand(command)) {
467-
Log.error("Failed to configure MQTT");
468-
return false;
469-
}
466+
SequansController.writeCommand(command);
470467
} else {
471468
char command[MQTT_CONFIGURE_LENGTH] = "";
472469
sprintf(command, MQTT_CONFIGURE, client_id);
473-
474-
if (!SequansController.writeCommand(command)) {
475-
Log.error("Failed to configure MQTT");
476-
return false;
477-
}
470+
SequansController.writeCommand(command);
478471
}
479472

480473
char conf_resp[MQTT_DEFAULT_RESPONSE_LENGTH * 4];
@@ -483,8 +476,7 @@ bool MqttClientClass::begin(const char *client_id,
483476
SequansController.readResponse(conf_resp, sizeof(conf_resp));
484477

485478
if (result != ResponseResult::OK) {
486-
Log.errorf("Non-OK Response when configuring MQTT. Err = %d\r\n",
487-
result);
479+
Log.error("Failed to configure MQTT");
488480
return false;
489481
}
490482

@@ -606,7 +598,7 @@ bool MqttClientClass::publish(const char *topic,
606598
// Wait for start character for delivering payload
607599
if (SequansController.waitForByte('>', MQTT_TIMEOUT_MS) ==
608600
SEQUANS_CONTROLLER_READ_BYTE_TIMEOUT) {
609-
Log.error("Timed out waiting for signal to deliver MQTT payload.");
601+
Log.warn("Timed out waiting for signal to deliver MQTT payload.");
610602

611603
LedCtrl.off(Led::DATA, true);
612604
SequansController.unregisterCallback(MQTT_ON_PUBLISH_URC);
@@ -723,8 +715,8 @@ bool MqttClientClass::readMessage(const char *topic,
723715
uint32_t start = millis();
724716
while (!SequansController.isRxReady()) {
725717
if (millis() - start > MQTT_TIMEOUT_MS) {
726-
Log.error("Timed out whilst waiting on the modem to deliver the "
727-
"MQTT message");
718+
Log.warn("Timed out whilst waiting on the modem to deliver the "
719+
"MQTT message");
728720
return false;
729721
}
730722
}
@@ -740,8 +732,8 @@ bool MqttClientClass::readMessage(const char *topic,
740732
}
741733

742734
if (start_bytes > 0 && millis() - start > MQTT_TIMEOUT_MS) {
743-
Log.error("Timed out waiting for the modem to deliver the start "
744-
"characters for the MQTT message");
735+
Log.warn("Timed out waiting for the modem to deliver the start "
736+
"characters for the MQTT message");
745737
return false;
746738
}
747739
}
@@ -751,7 +743,7 @@ bool MqttClientClass::readMessage(const char *topic,
751743
SequansController.readResponse((char *)buffer, buffer_size);
752744

753745
if (result != ResponseResult::OK) {
754-
Log.error("Error whilst retrieving the MQTT message payload");
746+
Log.warn("Failed whilst retrieving the MQTT message payload");
755747
}
756748

757749
return (result == ResponseResult::OK);

0 commit comments

Comments
 (0)