Fixed sleeptime.
Added logs.
This commit is contained in:
parent
8cf45fac19
commit
2252393ea0
11
karotz.js
11
karotz.js
@ -31,7 +31,7 @@ var log = require('./log');
|
|||||||
|
|
||||||
var version = "200";
|
var version = "200";
|
||||||
var sleeping = true;
|
var sleeping = true;
|
||||||
var sleepTime = new Date().getTime();
|
var sleepTime = Math.floor(new Date().getTime() / 1000);
|
||||||
var earsDisabled = false;
|
var earsDisabled = false;
|
||||||
var earsLeft = 0;
|
var earsLeft = 0;
|
||||||
var earsRight = 0;
|
var earsRight = 0;
|
||||||
@ -83,13 +83,15 @@ exports.getLedsSpeed = function() {
|
|||||||
|
|
||||||
|
|
||||||
function sleep() {
|
function sleep() {
|
||||||
|
log.info("Karotz sleep");
|
||||||
sleeping = true;
|
sleeping = true;
|
||||||
sleepTime = new Date().getTime();
|
sleepTime = Math.floor(new Date().getTime() / 1000);
|
||||||
return sleeping;
|
return sleeping;
|
||||||
};
|
};
|
||||||
exports.sleep = sleep;
|
exports.sleep = sleep;
|
||||||
|
|
||||||
function wakeup() {
|
function wakeup() {
|
||||||
|
log.info("Karotz wake up");
|
||||||
sleeping = false;
|
sleeping = false;
|
||||||
sleepTime = 0;
|
sleepTime = 0;
|
||||||
return sleeping;
|
return sleeping;
|
||||||
@ -97,12 +99,14 @@ function wakeup() {
|
|||||||
exports.wakeup = wakeup;
|
exports.wakeup = wakeup;
|
||||||
|
|
||||||
function reboot() {
|
function reboot() {
|
||||||
|
log.info("Karotz reboot");
|
||||||
wakeup();
|
wakeup();
|
||||||
return sleeping;
|
return sleeping;
|
||||||
};
|
};
|
||||||
exports.reboot = reboot;
|
exports.reboot = reboot;
|
||||||
|
|
||||||
function leds(color1, color2, pulse, speed) {
|
function leds(color1, color2, pulse, speed) {
|
||||||
|
log.info("Karotz leds");
|
||||||
if (color1) ledsColor1 = color1;
|
if (color1) ledsColor1 = color1;
|
||||||
if (color2) ledsColor2 = color2;
|
if (color2) ledsColor2 = color2;
|
||||||
if (pulse) ledsPulse = pulse;
|
if (pulse) ledsPulse = pulse;
|
||||||
@ -111,17 +115,20 @@ function leds(color1, color2, pulse, speed) {
|
|||||||
exports.leds = leds;
|
exports.leds = leds;
|
||||||
|
|
||||||
function ears(left, right) {
|
function ears(left, right) {
|
||||||
|
log.info("Karotz ears");
|
||||||
if (left) earsLeft = left;
|
if (left) earsLeft = left;
|
||||||
if (right) earsRight = right;
|
if (right) earsRight = right;
|
||||||
}
|
}
|
||||||
exports.ears = ears;
|
exports.ears = ears;
|
||||||
|
|
||||||
function enableEars() {
|
function enableEars() {
|
||||||
|
log.info("Karotz enable ears");
|
||||||
earsDisabled = false;
|
earsDisabled = false;
|
||||||
}
|
}
|
||||||
exports.enableEars = enableEars;
|
exports.enableEars = enableEars;
|
||||||
|
|
||||||
function disableEars() {
|
function disableEars() {
|
||||||
|
log.info("Karotz disable ears");
|
||||||
earsDisabled = true;
|
earsDisabled = true;
|
||||||
}
|
}
|
||||||
exports.disableEars = disableEars;
|
exports.disableEars = disableEars;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user