harlequin-tech / WiFlyHQ

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

Sleep feature requested! #9

Open Eveneo opened 12 years ago

Eveneo commented 12 years ago

is it possible to add the sleep feature into the library? i tried to send the sleep command by myself ... (and had some problems)

the following commands are send by my arduino code:

wlan.println("sleep"); // this works! the module is into the sleep mode

the module is set on autowakeup (set sys wake ) // this works! the module wake up!

but sending new data is not possible, i get the following message:

Failed to turn off echo Failed to turn off sys print Failed to set comm remote Failed to exit

Failed to exit command mode Failed to start Wlan-Interface Joining MYNETWORK

open 192.168.19.19 80 Failed to get prompt WiFly has crashed and will reboot...

My Firmware Version is 2.32 and i use an Arduino Uno R3 Hope you can help me!

Eveneo commented 12 years ago

send Data after module wake up doesn't work even if i pack it in your function style:

in WiFlyHQ.cpp - File:

boolean WiFly::doSleep()
{
    return setopt(PSTR("sleep"));
}

in WiFlyHQ.h - File:

boolean doSleep();  

Sending Data like this:

wifly.open(site, 80);
wifly.print( "GET /temperatur/add.php?"); 
wifly.print("time=");  
wifly.print( millis() ); 
wifly.print("&&");  
wifly.print("temperatur="); 
wifly.print( temperatur1 );  
wifly.println( " HTTP/1.0");  
wifly.println(); 
wifly.close();

Thank everybody for HELP!

harlequin-tech commented 12 years ago

Looks like that will need some design and debug work. I'll add it to the feature requests.

If you do get it going in the meantime, please consider forking the library and pushing the change back.

Eveneo commented 12 years ago

ok! i'll try it ...

aamaliaa commented 11 years ago

hey, did either of you guys ever figure this out?

harlequin-tech commented 11 years ago

negative, however it should be an easy feature to add.

mgrey commented 11 years ago

I haven't tested this so thoroughly, but seems to work fine:

WiFlyCQ.cpp:

boolean WiFly::doSleep(uint16_t seconds) 
{
    if(setopt(PSTR("set sys wake"), seconds)) {
        startCommand();
        send_P(PSTR("sleep\r"));
        inCommandMode = false;
        return true;
    }
    return false;
}

WiFlyCQ.h:

boolean doSleep(uint16_t seconds); 

Application:

 //Sleep for 60 seconds
 wifly.doSleep(60);

I haven't tried to send commands to the WiFly while sleeping, I have used a timer with a slight delay (2s) to allow the WiFly to wakeup, this works fine. I use a Arduino Fio v3 board.

I'm a total git newbie, but will try to commit.

harlequin-tech commented 11 years ago

Looks great. If you fork the repo, make your change and push it, and then do a pull request I can add the change.

Let me know if run into problems, I can send more detailed steps.