Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of 192.168.7.2:stache/

Conflicts:
	tweetstache.js
  • Loading branch information...
commit 74eda5eb0c5cebcf16a8075d644a6366d885d1c9 2 parents 8c0d339 + 2cda905
Jason Kridner authored
Showing with 24 additions and 5 deletions.
  1. +6 −3 stache.cpp
  2. +18 −2 tweetstache.js
9 stache.cpp
View
@@ -64,7 +64,7 @@ void changeStache(int argc, const char** argv);
/** Global variables */
String face_cascade_name = "lbpcascade_frontalface.xml";
CascadeClassifier face_cascade;
-string window_name = "stache - BeagleBone OpenCV demo";
+const char * window_name = "stache - BeagleBone OpenCV demo";
IplImage* mask = 0;
/** Command-line arguments */
@@ -164,6 +164,9 @@ void detectAndDisplay(Mat frame) {
//-- Show what you got
flip(frame, frame, 1);
imshow(window_name, frame);
+
+ //-- 0a. Attempt to resize window
+ cvResizeWindow(window_name, camWidth, camHeight);
}
void changeStache(int argc, const char** argv) {
@@ -179,10 +182,10 @@ void changeStache(int argc, const char** argv) {
}
void saveFrame(Mat frame) {
- char filename[20];
+ char filename[40];
flip(frame, frame, 1); // de-mirror-image-ize
IplImage iplFrame = frame;
- sprintf(filename, "/tmp/captured%03d.jpg", savedFrames);
+ sprintf(filename, "/home/root/stache/tmp/captured%03d.jpg", savedFrames);
cvSaveImage(filename, &iplFrame);
fprintf(stdout, "{\"tweet\":\"New BeagleStache captured!\",\"filename\":\"%s\"}\n", filename);
fflush(stdout);
20 tweetstache.js
View
@@ -15,6 +15,7 @@ try {
config.trigger = "/sys/class/leds/lcd3\:\:usr0/trigger";
config.brightness = "/sys/class/leds/lcd3\:\:usr0/brightness";
config.twitterKey = false;
+ config.message = "New #BeagleBone BeagleStache image captured! @BeagleBoardOrg";
}
function LED() {
@@ -132,7 +133,13 @@ function sendTweet(tweet, photoName) {
function printStatusCode() {
winston.info(response.statusCode +'\n');
if(response.statusCode == 200) led.off();
- else led.blink();
+ else {
+ led.blink();
+ var resendTweet = function() {
+ sendTweet(tweet, photoName);
+ }
+ setTimeout(resendTweet, 60000);
+ }
};
response.setEncoding('utf8');
response.on('data', printChunk);
@@ -152,7 +159,7 @@ function stacheMessage(data) {
if(data.tweet && data.filename) {
winston.info('stacheMessage = ' + JSON.stringify(data));
led.on();
- sendTweet(data.tweet, data.filename);
+ sendTweet(config.message, data.filename);
}
} catch(ex) {
}
@@ -173,5 +180,14 @@ function requestStache() {
stache.stdin.write('s');
};
+// turn on the display every 30 seconds
+setInterval(unblankDisplay, 30000);
+function unblankDisplay() {
+ try {
+ fs.writeFileSync("/sys/class/graphics/fb0/blank", "0");
+ } catch(ex) {
+ }
+};
+
//setInterval(requestStache, 5000);
Please sign in to comment.
Something went wrong with that request. Please try again.