Moved modem functions to pre-processor macros

This commit is contained in:
Sara Damiano
2019-05-17 13:53:38 -04:00
parent 85d309621d
commit 9a3d408923
13 changed files with 332 additions and 1319 deletions

View File

@@ -933,37 +933,7 @@ public:
}
}
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!
// NOTE: This function is used while INSIDE command mode, so we're only