Minor changes based on JSLint hints

master
msdeibel 2020-04-16 11:24:17 +02:00
parent 304e23f53e
commit 24eb0f33fe
1 changed files with 17 additions and 17 deletions

View File

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