// Some initialization Bangle.setGPSPower(true); g.clear(); // variables var firstRun = true; const text_y = 80; const font = "Vector"; var STOR = require("Storage"); var FACES = []; STOR.list(/\.trailsense\.js$/).forEach(face=>FACES.push(eval(require("Storage").read(face)))); var currentFace = 0; FACES[currentFace].drawFace(); Bangle.setUI("updown", (upOrDown) => { if(!firstRun) FACES[currentFace].stop(); firstRun = false; // loop ran once; firstRun has to be false if(isNaN(upOrDown)) upOrDown = 0; currentFace += upOrDown; if(currentFace > FACES.length-1) { currentFace = 0; } if(currentFace < 0) { currentFace = FACES.length-1; } FACES[currentFace].drawFace(); });