Move38 / Blinks-SDK

Development for Blinks starts here. This codebase includes everything you need to get up and running in the Arduino IDE with Blinks.

Home Page:http://forum.move38.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

All Blinks fall asleep at the same time

jbobrow opened this issue · comments

Every time a Blink's button is pressed, let contiguous Blinks know a game action has occurred and reset the sleep timer. This way all Blinks will fall asleep at roughly the same time.

I like this but would add (to preserve battery life):
Allow the user to simultaneously force sleep all contiguous blinks (user initiated "shutoff" instead of requiring a 10 minute wasted battery timeout cycle anytime someone uses a Blink. For example, a 10 second long press puts the Blink (and all contiguous Blinks) into sleep mode.

Btw, I've made use of the forced sleep method already (buried in the core) when I implemented a "menu mode" for the game.

Spot on @kenj1. I'd love to try out your menu mode, we've implemented a couple and think we have a good one for distribution. It's great that you've made one already, where should I look for it?!

Also, this is the spec for our menu: here

I was using it similar to what you're doing with your menu (although I don't have a programmer mode yet). In addition to sleep, my menu was used to also send a "reset" to the connected blinks so they'd return to game start.

This feels like 2 different but related features...

  1. Have a blink that is forced to sleep by a long long button press also virally tell neighboring blinks to sleep.
  2. Have each blink regularly share the time since its last button press when it comes in contact with other blinks. When two blinks share this time, the one with the less recent time takes on the more recent one. This should keep any group of blinks that have casual contact with each other from ever going to sleep when ever one has seen a button press withing the timeout period.

There is a complication caused by the fact that clocks of different blinks can be fast and slow Relative to each other, so it is possible to create a timeout feedback loop that prevents all blinks from ever timing out. To resolve this I think we can refine the sharing rule to be that a blink only takes on the more recent button press shared from an adjoining blink when the difference is greater than a threshold. Considering the timeout is on the order of 10 minutes, I think a threshold of ~10 seconds is a good balance of making sure blinks don't fall sleep before others are ready +/-10 seconds (plus clock slew).

@bigjosh The milestones/issues are not particularly suited to the way we are using GitHub. i.e. your repo can only have milestones created by you. I created one here and listed the issues that are not synched with this repo, so the issues aren't tied to the milestone. Either way, I think the list and order still make sense, feel free to copy them into a local milestone and/or make it into 4 milestones for each issue group :)

This is all functioning great now :) Blinks are kept awake by the last clicked Blink (this virally spreads) and they all fall asleep at the same timeout or if forced to sleep.