Hey Folks,
My Wify Shield is finally stable after I made a few modifications to the code (many thanks to the past posts for pointing me in the right direction). I wanted to share what I did to modify the Wifly.h library.
First a little bit about the problem I was experiencing. I have my Wifly shield setup in the server configuration, which will send a simple XML document back with the status of a few proximity sensors and if the right command is sent (via HTTP GET variables), it will trigger the switch to go high for one second. I have this hooked up to my garage door, so that I can open my garage door from a browser on my mobile device. While unit testing, everything seemed to be working but after about 10 successful requests the Wifly shield stopped taking HTTP requests. I could still ping the device; however, the server wasn't responding. The browser request wouldn't really even time out, which I still find strange. The green light on my Wifly Shield was no longer blinking it was solid green. I had to pull the power to get it back up and running. I setup a few debug lines of code in the Wifly library (mainly within the server.cpp code). I found that there was some extra characters being sent to the Wifly shield, which it was not expecting and therefore would not open the connection. This seems to be the exact same scenario as Trjean posted and I found the solution to be for the most part the same. The only thing is you really don't need to do the flush all you need to do is modify the if statement below.
Note: This code is in the Server.cpp file.
Code: Select all // Return active server connection if present
if (!activeClient) {
// TODO: Handle this better
if (WiFly.uart.available() >= strlen(TOKEN_MATCH_OPEN)) {
//if (WiFly.responseMatched(TOKEN_MATCH_OPEN)) { <-- **** REMOVE THIS LINE ****
if (WiFly.findInResponse(TOKEN_MATCH_OPEN, 1000)) { // <--REPLACE WITH THIS
// The following values indicate that the connection was
// created when acting as a server.
I setup a simple load test that sent a request to the Adrunio, which is connected to my network via the Wifly shield, once every minute for 2 days and I am happy to report that it's still up and running!! I am fairly confident that it is fixed with this minor modification to the library.
P.S. Hey roadfun - I am not sure why you thought this wouldn't work? While the new Adrunio Wifi shield looks great, I am more interested in making the one I got work! 80 bucks is a lot of money for me!!