spectraphilic / wasp_sketches

Waspmote sketches develoded by our group
1 stars 0 forks source link

absolute time schedule #70

Closed jdavid closed 4 years ago

jdavid commented 5 years ago

Right now we can schedule actions to run every hours/minutes since epoch. The idea is to allow as well to run at absolute times, this will make it a bit closer to what cron does.

For example, the cases below we can already do today:

/1 /1 - every minute
/1 /5 - every 5 minutes
/1 0 - every hour at :00
/3 0 - every 3 hours at :00
/24 0 - every 24 hours at :00
/72 0 - every 72 hours at :00

But these ones we can't:

/1 3 - every hour at :03
0 30 - every day at 00:30

With this system we could schedule tasks so we don't run the network and read sensors in the same loop, giving a more predictable behaviour, for instance:

/1 /5 - sample the sensors every 5 minutes
/1 4 - run the network every hour at :04
jdavid commented 5 years ago

Done, it works this way:

    Now the run command works this way (examples):

      run             - list names of available actions
      run <name> 0    - disables the action
      run <name> 5    - run action every 5 minutes
      run <name> 3:07 - run action every 3 hours at :07

Will keep the issue open for a while, until it has been tested a bit more.