Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unnecessary timeout when receiving "SEND FAIL" response from SIM7000 modem #750

Merged
merged 5 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/TinyGsmClientSIM7000.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class TinyGsmSim7000 : public TinyGsmSim70xx<TinyGsmSim7000>,
stream.write(reinterpret_cast<const uint8_t*>(buff), len);
stream.flush();

if (waitResponse(GF(GSM_NL "DATA ACCEPT:")) != 1) { return 0; }
if (waitResponse(GF(GSM_NL "DATA ACCEPT:"),GF("SEND FAIL")) != 1) { return 0; }
streamSkipUntil(','); // Skip mux
return streamGetIntBefore('\n');
}
Expand Down
11 changes: 11 additions & 0 deletions src/TinyGsmClientSIM7600.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,17 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600>,
return waitResponse() == 1;
}

bool getNetworkSystemMode(bool& n, int16_t& stat) {
// n: whether to automatically report the system mode info
// stat: the current service. 0 if it not connected
sendAT(GF("+CNSMOD?"));
if (waitResponse(GF(GSM_NL "+CNSMOD:")) != 1) { return false; }
n = streamGetIntBefore(',') != 0;
stat = streamGetIntBefore('\n');
waitResponse();
return true;
}

String getLocalIPImpl() {
sendAT(GF("+IPADDR")); // Inquire Socket PDP address
// sendAT(GF("+CGPADDR=1")); // Show PDP address
Expand Down
10 changes: 5 additions & 5 deletions src/TinyGsmModem.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class TinyGsmModem {
thisModem().stream.flush();
TINY_GSM_YIELD(); /* DBG("### AT:", cmd...); */
}
void setBaud(uint32_t baud) {
thisModem().setBaudImpl(baud);
bool setBaud(uint32_t baud) {
return thisModem().setBaudImpl(baud);
}
// Test response to AT commands
bool testAT(uint32_t timeout_ms = 10000L) {
Expand Down Expand Up @@ -106,10 +106,10 @@ class TinyGsmModem {
* Basic functions
*/
protected:
void setBaudImpl(uint32_t baud) {
bool setBaudImpl(uint32_t baud) {
thisModem().sendAT(GF("+IPR="), baud);
thisModem().waitResponse();
}
return thisModem().waitResponse() == 1;
}

bool testATImpl(uint32_t timeout_ms = 10000L) {
for (uint32_t start = millis(); millis() - start < timeout_ms;) {
Expand Down