I managed to test with a ped.face.js clock face. Using the following code.
() => {
function getFace(){
function draw() {
let steps = -1;
let show_steps = false;
// only attempt to get steps if activepedom is loaded
if (WIDGETS.activepedom !== undefined) {
steps = WIDGETS.activepedom.getSteps();
show_steps = true;
}
var d = new Date();
var da = d.toString().split(" ");
var time = da[4].substr(0,5);
g.reset();
g.clearRect(0,24,239,239);
g.setFont("Vector", 80);
g.setColor(1,1,1); // white
g.setFontAlign(0, -1);
g.drawString(time, g.getWidth()/2, 60);
if (show_steps) {
g.setColor(0,255,0); // green
g.setFont("Vector", 60);
g.drawString(steps, g.getWidth()/2, 160);
}
}
function onSecond(){
draw();
}
return {init:draw, tick:onSecond};
}
return getFace;
})();
There are probably improvements that can be made to the above code. EG it flickers.
I also tried
function onSecond(){
var t = new Date();
if ((t.getSeconds() % 5) === 0) draw();
}
I can see from the other multiclock examples that there are better ways of writing the display to avoid flicker.
I attempted to check ped.js into github multiclock/ped.js but when I updated the json file, my personal App loader would not show the latest version id ?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yeah. Pull request made.
I managed to test with a ped.face.js clock face. Using the following code.
There are probably improvements that can be made to the above code. EG it flickers.
I also tried
I can see from the other multiclock examples that there are better ways of writing the display to avoid flicker.
I attempted to check ped.js into github multiclock/ped.js but when I updated the json file, my personal App loader would not show the latest version id ?