From e7ba972c69d9d203927b5be0330d794595cf878f Mon Sep 17 00:00:00 2001 From: Tolentino Cotesta Date: Thu, 26 Sep 2024 09:14:29 +0200 Subject: [PATCH] ArduinoJson deprecated fix --- src/AsyncTelegram2.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/AsyncTelegram2.cpp b/src/AsyncTelegram2.cpp index 6df7708..6c9506c 100644 --- a/src/AsyncTelegram2.cpp +++ b/src/AsyncTelegram2.cpp @@ -142,7 +142,7 @@ bool AsyncTelegram2::getUpdates() if (m_waitingReply == false) { char payload[BUFFER_SMALL]; - snprintf(payload, BUFFER_SMALL, "{\"limit\":1,\"timeout\":0,\"offset\":%" INT32 "}", m_lastUpdateId); + snprintf(payload, BUFFER_SMALL, "{\"limit\":1,\"timeout\":0,\"offset\":%" INT32 "}", (int)m_lastUpdateId); sendCommand("getUpdates", payload); } } @@ -264,7 +264,8 @@ MessageType AsyncTelegram2::getNewMessage(TBMessage &message) updateDoc.shrinkToFit(); m_rxbuffer = ""; - if (!updateDoc.containsKey("result")) + // if (!updateDoc.containsKey("result")) // Deprecated + if (!updateDoc["result"].is()) { log_error("JSON data not expected"); serializeJsonPretty(updateDoc, Serial);