Skip to content
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

Sleep feature requested! #9

Open
Eveneo opened this issue Aug 5, 2012 · 7 comments
Open

Sleep feature requested! #9

Eveneo opened this issue Aug 5, 2012 · 7 comments
Assignees

Comments

@Eveneo
Copy link

Eveneo commented Aug 5, 2012

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
Copy link
Author

Eveneo commented Aug 6, 2012

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!

@ghost ghost assigned harlequin-tech Aug 6, 2012
@harlequin-tech
Copy link
Owner

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
Copy link
Author

Eveneo commented Aug 9, 2012

ok! i'll try it ...

@aamaliaa
Copy link

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

@harlequin-tech
Copy link
Owner

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

@mgrey
Copy link

mgrey commented Jan 28, 2013

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants