Merge branch 'Gelemikke-master'

This commit is contained in:
Sara Damiano
2024-05-17 15:02:57 -04:00
5 changed files with 24 additions and 9 deletions

View File

@@ -187,7 +187,7 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
return res;
}
void setBaudImpl(uint32_t baud) {
bool setBaudImpl(uint32_t baud) {
sendAT(GF("+UART_CUR="), baud, "8,1,0,0");
if (waitResponse() != 1) {
sendAT(GF("+UART="), baud,
@@ -195,9 +195,10 @@ class TinyGsmESP8266 : public TinyGsmModem<TinyGsmESP8266>,
// if (waitResponse() != 1) {
// sendAT(GF("+IPR="), baud); // First release firmwares might need
// this
waitResponse();
return waitResponse() == 1;
// }
}
return false;
}
bool factoryDefaultImpl() {

View File

@@ -305,7 +305,9 @@ class TinyGsmSim7000 : public TinyGsmSim70xx<TinyGsmSim7000>,
stream.write(reinterpret_cast<const uint8_t*>(buff), len);
stream.flush();
if (waitResponse(GF(AT_NL "DATA ACCEPT:")) != 1) { return 0; }
if (waitResponse(GF(AT_NL "DATA ACCEPT:"), GF("SEND FAIL")) != 1) {
return 0;
}
streamSkipUntil(','); // Skip mux
return streamGetIntBefore('\n');
}

View File

@@ -287,6 +287,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

View File

@@ -401,7 +401,7 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
return sendATGetString(GF("VR"));
}
void setBaudImpl(uint32_t baud) {
bool setBaudImpl(uint32_t baud) {
XBEE_COMMAND_START_DECORATOR(5, )
bool changesMade = false;
switch (baud) {
@@ -424,6 +424,7 @@ class TinyGsmXBee : public TinyGsmModem<TinyGsmXBee>,
}
if (changesMade) { writeChanges(); }
XBEE_COMMAND_END_DECORATOR
return true;
}
bool testATImpl(uint32_t timeout_ms = 10000L) {

View File

@@ -59,8 +59,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) {
@@ -172,10 +172,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;) {