From 6298644417a8349b5be1920c90a5b98c2541e6af Mon Sep 17 00:00:00 2001 From: alkonosst Date: Sat, 22 Nov 2025 17:30:49 -0300 Subject: [PATCH 1/2] fix: Fix will method variable redeclarations --- src/SIM7600MQTTClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SIM7600MQTTClient.cpp b/src/SIM7600MQTTClient.cpp index d99f423..39cfe4e 100644 --- a/src/SIM7600MQTTClient.cpp +++ b/src/SIM7600MQTTClient.cpp @@ -172,12 +172,12 @@ Status MQTTClient::setLastWillMessage(const char* topic, const char* message, co SIM7600_LOGD(tag, "MQTTClient %u: Setting Will message", _client_id); - Status status = + status = _modem->sendATCmd("AT+CMQTTWILLMSG=%u,%u,%u", _client_id, msg_len, static_cast(qos)); if (status != Status::Success) return status; // Send data after '>' prompt - size_t bytes_sent = 0; + bytes_sent = 0; status = _modem->_waitPromptAndSendData(reinterpret_cast(message), msg_len, bytes_sent); if (status != Status::Success) return status; From 55e617a3485c411a364912d4f4f5ee141b6f088d Mon Sep 17 00:00:00 2001 From: alkonosst Date: Sat, 22 Nov 2025 17:31:10 -0300 Subject: [PATCH 2/2] fix: Correct year parsing in getNetworkTime function --- src/SIM7600Modem.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/SIM7600Modem.cpp b/src/SIM7600Modem.cpp index 9b32979..7d49331 100644 --- a/src/SIM7600Modem.cpp +++ b/src/SIM7600Modem.cpp @@ -869,11 +869,14 @@ Status Modem::getNetworkTime(NTPTimeData& time_data) { return Status::InvalidResponse; } + // Temporary 2 digit year + uint8_t year; + // Parse time status = parseLine(time_buffer, 7, "%2hhu/%2hhu/%2hhu,%2hhu:%2hhu:%2hhu%2hhd", - &time_data.year, // yy (last 2 digits) + &year, // yy (last 2 digits) &time_data.month, // MM &time_data.day, // dd &time_data.hour, // hh @@ -881,8 +884,10 @@ Status Modem::getNetworkTime(NTPTimeData& time_data) { &time_data.second, // ss &time_data.time_zone); // ±zz (quarters) - time_data.year += 2000; // Convert to full year - time_data.time_zone /= 4; // Convert to hours + if (status != Status::Success) return status; + + time_data.year = 2000 + year; // Convert to full year + time_data.time_zone /= 4; // Convert to hours return waitForResponse(AT_OK); }