PDA

View Full Version : "global" sleep command


korda
05-28-2008, 10:37 AM
1) With the current RFE firmware, is it possible to implement sleep function to all nodes at once by using Portal or Gateway/Client?
2) How does it affect waking up command if all RFEs go to sleep, or all except the local unit?

mgenti
05-28-2008, 10:51 AM
Yes, in the simplest case you could define a function like:

def mySleep():
sleep(1, 10) #See docs for parameter explanations
#do something here when I wakeup

Then make a multicast RPC call to the mySleep function.

You'll probably want to implement something more complex than this and we have created an application node on sleeping with mesh routing. This is described in the following thread:
http://forums.synapse-wireless.com/showthread.php?t=33

WilliamM
05-29-2008, 09:56 AM
What about to put the nodes to sleep for a long duration (say... 8-10 hrs)? The parameter values for this sleep command limit you to 1000 sec (approx.) which is only about 16 minutes.

kbanks
05-29-2008, 12:37 PM
If you need to sleep longer than a single sleep() command can handle, use multiple sleep commands. This can be inline or in a loop.


# sleep for 3000 seconds
sleep(1, 1000)
sleep(1, 1000)
sleep(1, 1000)



# use a loop to sleep multiple times
sleepTime = 3600 # 1 hour
sleepChunk = 60 # arbitrary, but must be <= 1073
sleepCounter = 0
while sleepCounter < sleepTime:
sleep(1, sleepChunk)
sleepCounter += sleepChunk