mirror of
https://github.com/vshymanskyy/TinyGSM.git
synced 2026-05-15 04:06:10 +00:00
Make set baud a bool return
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;) {
|
||||
|
||||
Reference in New Issue
Block a user