-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Wait for client.available() to prevent ESP32 crashes #3154
Conversation
@@ -14,7 +14,8 @@ void setup() | |||
delay(10); | |||
|
|||
// We start by connecting to a WiFi network | |||
WiFiMulti.addAP("SSID", "passpasspass"); | |||
// WiFiMulti.addAP("SSID", "passpasspass"); | |||
WiFiMulti.addAP("ARRIS-6089", "LaserJet4"); |
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.
Do you really want this change here?
// const uint16_t port = 80; | ||
// const char * host = "192.168.1.1"; // ip or dns | ||
const uint16_t port = 1337; | ||
const char * host = "192.168.1.10"; // ip or dns |
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.
also unrelated change
delay(1); //delay 1 msec | ||
} | ||
if (client.available() > 0) | ||
{ | ||
//read back one line from the server | ||
String line = client.readStringUntil('\r'); |
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.
so the issue is that readStringUntil timeouts
oops - my bad. Although, it is extremely unlikely that someone else will
be able to connect to my wireless network (we live in an underground house)
;-)
Frank
…On Thu, Sep 5, 2019 at 3:29 AM Me No Dev ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In libraries/WiFi/examples/WiFiClientBasic/WiFiClientBasic.ino
<#3154 (comment)>
:
> @@ -14,7 +14,8 @@ void setup()
delay(10);
// We start by connecting to a WiFi network
- WiFiMulti.addAP("SSID", "passpasspass");
+// WiFiMulti.addAP("SSID", "passpasspass");
+ WiFiMulti.addAP("ARRIS-6089", "LaserJet4");
Do you really want this change here?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3154?email_source=notifications&email_token=AA6T325NIMBPJ22DEFMRRRDQICYPNA5CNFSM4IR3BFVKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCDXHYUA#pullrequestreview-284064848>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA6T32YKYMTI23NS7CXHUMDQICYPNANCNFSM4IR3BFVA>
.
--
G.Frank Paynter, PhD
OSU ESL Research Scientist (ret)
EM Workbench LLC
614 638-6749 (cell)
|
Yea, but someone would complain when it didn't automagically connect to their WiFi. |
Chuck,
LOL ;-)
Frank
…On Thu, Sep 5, 2019 at 1:36 PM chuck todd ***@***.***> wrote:
oops - my bad. Although, it is extremely unlikely that someone else will
be able to connect to my wireless network (we live in an underground house)
;-) Frank
Yea, but someone would complain when it didn't automagically connect to
their WiFi.
Chuck.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3154?email_source=notifications&email_token=AA6T32ZBBO4OVATEJJZJTODQIE7QPA5CNFSM4IR3BFVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6AB7LI#issuecomment-528490413>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA6T322L3WZN6QKWX5HLIS3QIE7QPANCNFSM4IR3BFVA>
.
--
G.Frank Paynter, PhD
OSU ESL Research Scientist (ret)
EM Workbench LLC
614 638-6749 (cell)
|
Removed user-specific SSID/passphrase |
* Wait for client.available() to prevent ESP32 crashes * Removed user-specific SSID & passphrase
I found that the original code consistently crashed my ESP32 Dev Board with a 'Guru Meditation Error'. When I looked into the code, I saw that it tried to read a string from the server before anything was available, causing the crash. By guarding the read statement with a 'while' loop that waited for client.available() to return a non-zero result (or for the max loop counter to expire), I was able to get reliable performance.