Minor changes based on JSLint hints
parent
304e23f53e
commit
24eb0f33fe
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
var batChartFile; // file for battery percentage recording
|
var batChartFile; // file for battery percentage recording
|
||||||
const recordingInterval10Min = 60 * 10 * 1000;
|
const recordingInterval10Min = 60 * 10 * 1000;
|
||||||
const recordingInterval1Min = 60*1000; //For testing
|
const recordingInterval1Min = 60 * 1000; //For testing
|
||||||
const recordingInterval10S = 10*1000; //For testing
|
const recordingInterval10S = 10 * 1000; //For testing
|
||||||
var recordingInterval = null;
|
var recordingInterval = null;
|
||||||
|
|
||||||
var compassEventReceived = false;
|
var compassEventReceived = false;
|
||||||
|
|
@ -26,15 +26,15 @@
|
||||||
let y = this.y;
|
let y = this.y;
|
||||||
|
|
||||||
g.setColor(0, 1, 0);
|
g.setColor(0, 1, 0);
|
||||||
g.fillPoly([x+5, y, x+5, y+4, x+1, y+4, x+1, y+20, x+18, y+20, x+18, y+4, x+13, y+4, x+13, y], true);
|
g.fillPoly([x + 5, y, x + 5, y + 4, x + 1, y + 4, x + 1, y + 20, x + 18, y + 20, x + 18, y + 4, x + 13, y + 4, x + 13, y], true);
|
||||||
|
|
||||||
g.setColor(0,0,0);
|
g.setColor(0, 0, 0);
|
||||||
g.drawPoly([x+5, y+6, x+8, y+12, x+13, y+12, x+16, y+18], false);
|
g.drawPoly([x + 5, y + 6, x + 8, y + 12, x + 13, y + 12, x + 16, y + 18], false);
|
||||||
|
|
||||||
g.reset();
|
g.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMag(){
|
function onMag() {
|
||||||
compassEventReceived = true;
|
compassEventReceived = true;
|
||||||
// Stop handling events when no longer necessarry
|
// Stop handling events when no longer necessarry
|
||||||
Bangle.removeListener("mag", onMag);
|
Bangle.removeListener("mag", onMag);
|
||||||
|
|
@ -51,6 +51,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEnabledConsumersValue() {
|
function getEnabledConsumersValue() {
|
||||||
|
// Wait for an event from each of the devices to see if they are switched on
|
||||||
var enabledConsumers = switchableConsumers.none;
|
var enabledConsumers = switchableConsumers.none;
|
||||||
|
|
||||||
Bangle.on('mag', onMag);
|
Bangle.on('mag', onMag);
|
||||||
|
|
@ -64,7 +65,6 @@
|
||||||
|
|
||||||
if (Bangle.isLCDOn())
|
if (Bangle.isLCDOn())
|
||||||
enabledConsumers = enabledConsumers | switchableConsumers.lcd;
|
enabledConsumers = enabledConsumers | switchableConsumers.lcd;
|
||||||
// Already added in the hope they will be available soon to get more details
|
|
||||||
if (compassEventReceived)
|
if (compassEventReceived)
|
||||||
enabledConsumers = enabledConsumers | switchableConsumers.compass;
|
enabledConsumers = enabledConsumers | switchableConsumers.compass;
|
||||||
if (gpsEventReceived)
|
if (gpsEventReceived)
|
||||||
|
|
@ -90,8 +90,7 @@
|
||||||
const logFileName = "bclog" + currentWriteDay;
|
const logFileName = "bclog" + currentWriteDay;
|
||||||
|
|
||||||
// Change log target on day change
|
// Change log target on day change
|
||||||
if (!isNaN(previousWriteDay)
|
if (!isNaN(previousWriteDay) && previousWriteDay != currentWriteDay) {
|
||||||
&& previousWriteDay != currentWriteDay) {
|
|
||||||
//Remove a log file containing data from a week ago
|
//Remove a log file containing data from a week ago
|
||||||
Storage.open(logFileName, "r").erase();
|
Storage.open(logFileName, "r").erase();
|
||||||
Storage.open(previousWriteLogName, "w").write(parseInt(currentWriteDay));
|
Storage.open(previousWriteLogName, "w").write(parseInt(currentWriteDay));
|
||||||
|
|
@ -111,7 +110,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function reload() {
|
function reload() {
|
||||||
WIDGETS["batchart"].width = 24;
|
WIDGETS.batchart.width = 24;
|
||||||
|
|
||||||
recordingInterval = setInterval(logBatteryData, recordingInterval10Min);
|
recordingInterval = setInterval(logBatteryData, recordingInterval10Min);
|
||||||
|
|
||||||
|
|
@ -119,11 +118,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the widget
|
// add the widget
|
||||||
WIDGETS["batchart"]={area:"tl",width:24,draw:draw,reload:function() {
|
WIDGETS.batchart = {
|
||||||
|
area: "tl", width: 24, draw: draw, reload: function () {
|
||||||
reload();
|
reload();
|
||||||
Bangle.drawWidgets(); // relayout all widgets
|
Bangle.drawWidgets();
|
||||||
}};
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// load settings, set correct widget width
|
|
||||||
reload();
|
reload();
|
||||||
})()
|
})();
|
||||||
Loading…
Reference in New Issue