harlequin-tech / WiFlyHQ

WiFly RN-XV Arduino Library
Other
110 stars 68 forks source link

getConnection() problem/fix #27

Open Apewire opened 11 years ago

Apewire commented 11 years ago

I've got a problem with the getConnection function, it updates once or twice and then returns a 0 value. Because of these values the .isAssociated, .isConnected functions don't update correctly.

By changing

if (checkPrompt(buf)) {
/* Got prompt first */
len = gets(buf, sizeof(buf));
} else {
getPrompt();
}

To

if (checkPrompt(buf)) {
/* Got prompt first */
    len = gets(buf, sizeof(buf));
} else {
         if(!gotPrompt)
         {
       getPrompt();
         }
}

It updates correctly.

Ps. I don't know if this is the right place to post this.. Kind of a GitHub noob :) Great library btw!

harlequin-tech commented 11 years ago

That change would basically stop the code looking for a prompt if it didn't see one immediately after the "show c" command. The gotPrompt boolean is used to flag whether the code has ever seen the prompt yet and controls storing the prompt the first time its seen (so it can deal with different version numbers in the prompt). It would always be true at that point in the code.

So something else must be going on with the output from your WiFly's firmware. What version of firmware are you running?