PDA

View Full Version : Time synchronisation


l091
08-19-2009, 01:32 AM
I am trying a simple experiment where the all the modules are loaded with the same script that tries to do the following:

there is a global sessiontimer variable and a global generaltimer variable. When a module wakes up it sends an mcastrpc to all modules to reset their generaltimer. the sessiontimer is reset always after wakeup. Every 100 ms an event is fired that checks if the generaltimer is equal to a certain wakeup time: 2000 ms. But when I run this script on 1 module only, the module runs only until 1500 ms ( I can check the debug ) and then freezes. It doesnt go to sleep because if it should the leds should go out, but they remain turned on. the timer event just doesn't fire and the module has to be reset before I can communicate with it again.

How could this be? It doesnt have anything to do with the sleep instruction that maybe logevents can not be received by portal? Or maybe the multicast keeps hanging in the air for some reason and causes trouble?

kbanks
08-19-2009, 08:23 AM
the leds should go out, but they remain turned on.

Are you using writePin (on/off control) or pulsePin()? I ask because pulsePin() generates the pulses in software (countdown timers) and does not run while the unit is sleeping.

kbanks
08-19-2009, 08:27 AM
How could this be? It doesnt have anything to do with the sleep instruction that maybe logevents can not be received by portal? Or maybe the multicast keeps hanging in the air for some reason and causes trouble?

See the nearby thread about sleep() acting immediately.

It is true that nodes cannot talk to Portal, or over-the-air, while they are sleeping.

You might try temporarily replacing the sleep() call with a print statement, and seeing if the rest of the script logic is doing what you intended.