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

move radio sleep out to seperate function #231

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jacobrosenthal
Copy link
Contributor

Splitting mesh sleep out from radio sleep with the end goal being able to implement a mesh synchronization protocol

power.sleep2 should be called something else but for some reason Ive noticed bitlash cant understand certain terms. I tried power.sleepRadio and power.sleepRF and neither worked.. power.sleep2 worked and I left it there

Looking for feedback

@matthijskooijman
Copy link
Collaborator

power.sleep2 should be called something else but for some reason Ive noticed bitlash cant understand certain terms. I tried power.sleepRadio and power.sleepRF and neither worked.. power.sleep2 worked and I left it there

Perhaps names should be lowercase? I can imagine that bitlash implements case insensitivity by lowercasing all commands before processing, but perhap not inside addBitlashFunction?

No time right now to look at the actual commit, I hope to find a bit of time for that (and your other PR's, keep up the good work!) soon...

@jacobrosenthal
Copy link
Contributor Author

Perhaps names should be lowercase? I can imagine that bitlash implements case insensitivity by lowercasing all commands before processing, but perhap not inside addBitlashFunction?

Looking at all other bitlash names, that seems likely.

@jacobrosenthal
Copy link
Contributor Author

An example which sleeps the radio repeatedly at 5 second intervals starting at (global) time 45 seconds

> uptime.report
{"type":"uptime","total":5,"sleep":0,"meshsleep":0,"random":15089,"reset":"External","at":5653}
> uptime
Total: 0 days, 0 hours, 0 minutes, 8.231392 seconds
Awake: 0 days, 0 hours, 0 minutes, 8.234288 seconds
Asleep: 0 days, 0 hours, 0 minutes, 0.000000 seconds
Global: 0 days, 0 hours, 0 minutes, 8.239792 seconds
> uptime.setoffset(10,0,1)
> uptime
Total: 0 days, 0 hours, 0 minutes, 12.182768 seconds
Awake: 0 days, 0 hours, 0 minutes, 12.185776 seconds
Asleep: 0 days, 0 hours, 0 minutes, 0.000000 seconds
Global: 0 days, 0 hours, 0 minutes, 22.191280 seconds
> print uptime.meshoffset.seconds
10
> power.setradioperiod(5000, 5000)
> power.schedulesleepradio(45, 0)
> uptime
Total: 0 days, 0 hours, 0 minutes, 27.921184 seconds
Awake: 0 days, 0 hours, 0 minutes, 27.924192 seconds
Asleep: 0 days, 0 hours, 0 minutes, 0.000000 seconds
Global: 0 days, 0 hours, 0 minutes, 37.929696 seconds
> 
> print power.getradiostate
1
> uptime
Total: 0 days, 0 hours, 0 minutes, 36.588288 seconds
Awake: 0 days, 0 hours, 0 minutes, 36.591280 seconds
Asleep: 0 days, 0 hours, 0 minutes, 0.000000 seconds
Global: 0 days, 0 hours, 0 minutes, 46.596800 seconds
> print power.getradiostate
4
> print power.getradiostate
1
> print uptime.meshsleeping.seconds
20
> uptime.report
{"type":"uptime","total":98,"sleep":0,"meshsleep":30,"random":-21287,"reset":"External","at":98333}
> 

@jacobrosenthal
Copy link
Contributor Author

... I think uptime.report is crashing if called a couple times....

@jacobrosenthal
Copy link
Contributor Author

found uptime crash, buffer was too small
frankly upstream seems a bit too small for the upstream verstion too which would be
{"type":"uptime","total":4294967295,"sleep":4294967295,"random":-2147483647,"reset":"External","at":4294967295}
something like 112
but its almost impossible to be awake for years, asleep the whole time, with an external reset in the same amount of time...
basically I add 23 characters
,"meshsleep":4294967295
so ill just add 25 to buffer

@jacobrosenthal
Copy link
Contributor Author

Todo

  • Vet the api and naming scheme
  • Need a way to queue or delay radio sends attempted during sleep (calling NWK_DataReq crashes)
  • Need to transition events timing to last symbol counter compare. sys timer is non functional during sleep - existing problem with power.sleep as well
  • Create one (or more) offset synchronization protocols like NTP, RBS, or something that needs lower level rx/tx timestamps like tsmp fstp

@jacobrosenthal jacobrosenthal mentioned this pull request May 11, 2015
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

Successfully merging this pull request may close these issues.

2 participants