Work-around for boards missing the ip.fromString() method

This commit is contained in:
SRGDamia1
2017-09-20 16:32:42 -04:00
parent 3589a8e22b
commit ff574d69ef
8 changed files with 185 additions and 31 deletions

View File

@@ -276,6 +276,7 @@ public:
}
String res = stream.readStringUntil('\n');
waitResponse();
res.trim();
return res;
}
@@ -286,6 +287,7 @@ public:
}
String res = stream.readStringUntil('\n');
waitResponse();
res.trim();
return res;
}
@@ -422,8 +424,19 @@ public:
}
IPAddress localIP() {
IPAddress res;
res.fromString(getLocalIP());
String strIP = getLocalIP();
int Parts[4] = {0,0,0,0};
int Part = 0;
for ( int i=0; i<strIP.length(); i++ ) {
char c = strIP[i];
if ( c == '.' ) {
Part++;
continue;
}
Parts[Part] *= 10;
Parts[Part] += c - '0';
}
IPAddress res( Parts[0], Parts[1], Parts[2], Parts[3] );
return res;
}
@@ -619,7 +632,7 @@ public:
streamWrite("AT", cmd..., GSM_NL);
stream.flush();
TINY_GSM_YIELD();
DBG("### AT:", cmd...);
// DBG("### AT:", cmd...);
}
// TODO: Optimize this!