Skip to content

Commit

Permalink
moved autosnapshot into autoupdate. Made autoupdate also reload pixel…
Browse files Browse the repository at this point in the history
…Trackers.txt every 4 min.
  • Loading branch information
electronicwhisper committed Feb 15, 2012
1 parent 43272eb commit a7ccb44
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
14 changes: 14 additions & 0 deletions sb_elevator_combined/autoupdate.pde
@@ -0,0 +1,14 @@
int autoupdateTime = 4; // how often to do the autoupdate, in minutes
int lastAutoupdateTime = -1;
void autoupdate() {
int m = minute();
if (m % autoupdateTime == 0) {
if (m != lastAutoupdateTime) {
// do an auto update
saveSnapshot();
loadPixelTrackers();

lastAutoupdateTime = m;
}
}
}
12 changes: 0 additions & 12 deletions sb_elevator_combined/saveSnapshot.pde
Expand Up @@ -3,15 +3,3 @@ void saveSnapshot() {
snap.copy(video, 0, 0, video.width, video.height, 0, 0, video.width, video.height);
snap.save("data/snapshots/"+minute()+".png");
}

int autoSnapshotTime = 4; // how often to take a snapshot, in minutes
int lastSnapshotTime = -1;
void autoSnapshot() {
int m = minute();
if (m % autoSnapshotTime == 0) {
if (m != lastSnapshotTime) {
saveSnapshot();
lastSnapshotTime = m;
}
}
}
3 changes: 1 addition & 2 deletions sb_elevator_combined/sb_elevator_combined.pde
Expand Up @@ -52,8 +52,7 @@ void draw() {
updateElevators();
trackMovement(video);

// for debugging, periodically save the frame
autoSnapshot();
autoupdate();
}

// draw the currently selected pixelTracker
Expand Down

0 comments on commit a7ccb44

Please sign in to comment.