Moved modem functions to pre-processor macros
This commit is contained in:
@@ -173,18 +173,9 @@ public:
|
||||
sendAT(GF("+UART_CUR="), baud, "8,1,0,0");
|
||||
}
|
||||
|
||||
bool testAT(unsigned long timeout = 10000L) {
|
||||
for (unsigned long start = millis(); millis() - start < timeout; ) {
|
||||
sendAT(GF(""));
|
||||
if (waitResponse(200) == 1) return true;
|
||||
delay(100);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
TINY_GSM_MODEM_TEST_AT()
|
||||
|
||||
void maintain() {
|
||||
waitResponse(10, NULL, NULL);
|
||||
}
|
||||
TINY_GSM_MODEM_MAINTAIN_LISTEN()
|
||||
|
||||
bool factoryDefault() {
|
||||
sendAT(GF("+RESTORE"));
|
||||
@@ -378,37 +369,7 @@ public:
|
||||
Utilities
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
void streamWrite(T last) {
|
||||
stream.print(last);
|
||||
}
|
||||
|
||||
template<typename T, typename... Args>
|
||||
void streamWrite(T head, Args... tail) {
|
||||
stream.print(head);
|
||||
streamWrite(tail...);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
void sendAT(Args... cmd) {
|
||||
streamWrite("AT", cmd..., GSM_NL);
|
||||
stream.flush();
|
||||
TINY_GSM_YIELD();
|
||||
//DBG("### AT:", cmd...);
|
||||
}
|
||||
|
||||
bool streamSkipUntil(const char c, const unsigned long timeout = 1000L) {
|
||||
unsigned long startMillis = millis();
|
||||
while (millis() - startMillis < timeout) {
|
||||
while (millis() - startMillis < timeout && !stream.available()) {
|
||||
TINY_GSM_YIELD();
|
||||
}
|
||||
if (stream.read() == c) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
TINY_GSP_MODEM_STREAM_UTILITIES()
|
||||
|
||||
// TODO: Optimize this!
|
||||
uint8_t waitResponse(uint32_t timeout, String& data,
|
||||
|
||||
Reference in New Issue
Block a user