-
Notifications
You must be signed in to change notification settings - Fork 639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thingspeak: cleanup #2140
Merged
Merged
Thingspeak: cleanup #2140
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
mcspr
commented
Feb 9, 2020
- fix _tspk_client shadowing in callback code
- fix sync client configuration, use correct settings chain
- refactor async client, add enum state variable instead of two bools
- refactor sync client, drop raw wificlient
Merged
mcspr
commented
Feb 10, 2020
Comment on lines
+306
to
+320
char headers[strlen_P(THINGSPEAK_REQUEST_TEMPLATE) + url.path.length() + url.host.length() + 1]; | ||
snprintf_P(headers, sizeof(headers), | ||
THINGSPEAK_REQUEST_TEMPLATE, | ||
url.path.c_str(), | ||
url.host.c_str(), | ||
_tspk_data.length() | ||
); | ||
|
||
_tspk_client.print(headers); | ||
_tspk_client.print(_tspk_data); | ||
client->print(headers); | ||
client->print(_tspk_data); | ||
|
||
nice_delay(100); | ||
nice_delay(100); | ||
|
||
String response = _tspk_client.readString(); | ||
int pos = response.indexOf("\r\n\r\n"); | ||
unsigned int code = (pos > 0) ? response.substring(pos + 4).toInt() : 0; | ||
DEBUG_MSG_P(PSTR("[THINGSPEAK] Response value: %u\n"), code); | ||
_tspk_client.stop(); | ||
const auto response = client->readString(); | ||
int pos = response.indexOf("\r\n\r\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole part should be HTTPClient, since we have it readily available from #include <ESP8266HTTPClient.h>
At least we will know about the status code.
mcspr
added a commit
that referenced
this pull request
Feb 18, 2020
- continue #2140 , use the correct implementation for http requests not confuse code readers with our parsing - fix data sender data duplication, run build test - add note that this is actually really RAM heavy, some connection failures are not easily distinguishable from any code errors and are simply OOM. also - fix arduinoota prototype error when building without it (... ino2cpp, again) - add comment about 160mhz into the platformio.ini
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.