From 0e905afa6e963d2cac80c6d22a22d69ee7587740 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 2 Oct 2018 15:09:19 -0400 Subject: [PATCH] Added extra "ping" for data to read() of SIM800 --- .gitignore | 3 +++ src/TinyGsmClientSIM800.h | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index 9d2f753..8e2e182 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ extras/docs/* .gcc-flags.json platformio.ini lib/readme.txt +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json diff --git a/src/TinyGsmClientSIM800.h b/src/TinyGsmClientSIM800.h index 924275a..69e3c3b 100644 --- a/src/TinyGsmClientSIM800.h +++ b/src/TinyGsmClientSIM800.h @@ -144,6 +144,13 @@ public: continue; } // TODO: Read directly into user buffer? + // Workaround: sometimes SIM800 forgets to notify about data arrival. + // TODO: Currently we ping the module periodically, + // but maybe there's a better indicator that we need to poll + if (millis() - prev_check > 500) { + got_data = true; + prev_check = millis(); + } at->maintain(); if (sock_available > 0) { sock_available -= at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux);