diff --git a/apps/kitchen/kitchen.app.js b/apps/kitchen/kitchen.app.js index f2ba5a220..cf60da0b3 100644 --- a/apps/kitchen/kitchen.app.js +++ b/apps/kitchen/kitchen.app.js @@ -33,8 +33,10 @@ function nextFace(){ // when you feel the buzzer you know you have done a long press function longPressCheck() { Bangle.buzz(); + debugObj.log("long PressCheck()"); if (pressTimer) { clearInterval(pressTimer); + debugObj.log("clear pressTimer 2"); pressTimer = undefined; } } @@ -45,6 +47,11 @@ function buttonPressed(btn) { nextFace(); } else { firstPress = getTime(); + if (pressTimer) { + debugObj.log("clear pressTimer 1"); + clearInterval(pressTimer); + } + debugObj.log("set pressTimer 1"); pressTimer = setInterval(longPressCheck, 1500); } } @@ -53,6 +60,7 @@ function buttonPressed(btn) { function buttonReleased(btn) { var dur = getTime() - firstPress; if (pressTimer) { + debugObj.log("clear pressTimer 3"); clearInterval(pressTimer); pressTimer = undefined; } @@ -248,6 +256,7 @@ GPS.prototype.processFix = function(fix) { this.gpsState = this.GPS_RUNNING; if (!this.last_fix.fix && !(require("Storage").readJSON("setting.json", 1) || {}).quiet) { Bangle.buzz(); // buzz on first position + debugObj.log("GPS fix buzz"); } this.last_fix = fix; } @@ -708,6 +717,23 @@ function onHRM(hrm) { hrmObj.onHRM(hrm); } +/***************************************************************************** + +Debug Object + +******************************************************************************/ + +function DEBUG() { + this.logfile = require("Storage").open("debug.log","a"); +} + +DEBUG.prototype.log = function(msg) { + let timestamp = new Date().toString().split(" ")[4]; + let line = timestamp + ", " + msg + "\n"; + this.logfile.write(line); +} + +debugObj = new DEBUG(); /*****************************************************************************