-
-
It happened today with 18.90, just updated to 18.92. The freeze seems to happen when i ignore a message on the watch. After a while, the message is replaced by the clock face, but it no longer updates. The step widget still updates and the button works.
Edit: ContourClock with Lato Pedometer, Altimeter Widget and Themed Battery Widget. -
-
-
This works for me, assuming "maxZ" is defined somewhere:
try { function accelHandler(accel) { if (accel.z > maxZ) { maxZ = accel.z.toFixed(2); } drawHand(Math.round(maxZ)); //layout.render(); } Bangle.setPollInterval(80); Bangle.on('accel', accelHandler); } catch(e) { print(e.message); print("value exceeds limits"); drawHand(MIN); }
-
-
If you seriously want to save battery, you might look into BLE wheel and heart rate sensors. If you mount the watch to your bars, you could also power if with an external battery or a hub generator.
40min sounds very short, my watch easily lasts more than two hours with the tinyVario app, so there might be a problem with your code as well. (tinyVario used GPS and barometric sensor, no heart rate) -
If you have access to a 3D printer, you could try this.
-
-
2v14 stable, yes. It happened on 2v13 as well.
I just turn the barometer on when the app starts. It kind of works after the error, but there seems to be a pressure offset. As far as i know, the barometer chip has some calibration values that are being read at startup, maybe they are not read correctly? -
Sometimes i get the following error when powering up the baro sensor:
Uncaught Error: I2C Error: Arbitration (start) at line 1 col 43 Bangle.setBarometerPower(true, "tinyVario");
It seems to be totally random, should i just use "try" and "catch" to repeatedly power up the sensor until i get no error? The sensor still works after this error, but pressure readings are way off.
-
When created, the 'Layout' object 'grabs' user input from the screen. What you'd need to do is just create a Layout object as and when you want it rather than trying to keep them in RAM all the time (it's also better for memory usage):
Thanks, will try that!
I don't really understand what you're asking here...
Here is an example, i basically want to go from the main menu to the adjustment page without the intermediate menu. Is there a way to do that?
var Layout = require("Layout"); var a=50; var adjustA = { '< BACK>': initMainMenu, 'A': { value: a, min:0, max:100, step:1, format: function(value) { return (value); }, onchange: function(value) { a=value; } } }; function initMainMenu() { var mainMenu = new Layout ( {type:"btn", font:"15%", fillx:1, filly:1, label:"adjust A", cb:l=>E.showMenu(adjustA)} ); g.clear(); mainMenu.render(); } initMainMenu();
-
I would like to use the layout library to make nested menus. When i do this:
var mainMenu = new Layout( { {type:"btn", label:"A", cb:l=>{mainMenu.clear();AMenu.render();}} } var AMenu = new Layout( { {type:"btn", label:"something", cb:l=>{}} }
it shows menu "A" when i push the button, but the buttons from mainMenu are still active. Is there a simple way to completely remove a layout from screen?
Also, i would like to change a value via the graphical menu, but without actually displaying the menu. Is there a way to do this? I could just use the menu interface, but it is difficult to use wearing gloves. -
-
Somehow, "cb:" on buttons does not work for me. When i run the code example from the tutorial, i get
Uncaught Error: Function "a" not found! at line 1 col 1 a(this._l,b) ^ in function called from system
I tried 2v14 as well as the bleeding edge build. Funny thing is, about 5% of the time it works as expected, but usually not. I also get this error message when uploading via the Web IDE:
Error parsing JavaScript, but uploading anyway. SyntaxError: Identifier 'a' has already been declared (1:1920)
This is the code:
var Layout = require("Layout"); var layout = new Layout( { type:"v", c: [ {type:"txt", font:"6x8:2", label:"A Test", id:"label"}, {type:"btn", font:"6x8:2", label:"One", cb: l=>setLabel("One") }, {type:"btn", font:"6x8:2", label:"Two", cb: l=>setLabel("Two") } ] }); function setLabel(x) { layout.label.label = x; layout.render(); } g.clear(); layout.render();
-
-
I have a layout that displays five labels and a bar graph. I would like to update several times per second, but Layout.update takes about 0.22s to complete. Is this normal? Changing fonts from vector to bitmap did not change anything.
As a workaround i just use g.clear() and redraw the layout completely in 0.12s. This way, i can call Layout.update just once, but then text alignments are messed up. Turns out layout uses update to calculate the position and size of a text label, then draws the text centered into it.
I think layout should use g.setFontAlign with the correct alignment to align the labels, one call to layout.update would then be enough for many apps (where you usually don´t want your layout to change because a number is now two instead of one digit). -
-
I just played around with the blob clock, because it uses seconds and thus according to my theory is more likely to break. I connected to the watch using WebIDE and sent Ctrl-C via the console. After a few attempts, i always get this:
____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v13.138 (c) 2021 G.Williams let time=new Date();let hours=time.getHours();let mins=time.getMinutes()... ^ debug>
The watch can be reset via button (1s) , and i get this:
ERROR: Ctrl-C while processing interval - removing it. Execution Interrupted during event processing. Interpreter error: [ "CALLBACK" ] New interpreter error: CALLBACK >
-
When i use ContourClock it happens at seemingly random intervals. Sometimes it runs good for days, sometimes it hangs several times a day. The code in my post above usually hangs after a few minutes. It does not seem to matter whether the code uses intervals or timeouts.
The error can be reproduced by repeatedly connecting/disconnecting via the gadgetbridge app. -
Update: The error seems to occur more often, the more timeouts/intervals an app uses. My clock that updates once a minute sometimes works for days, but this ususally fails after a few minutes:
Bangle.setBarometerPower(true, "tinyVario"); Bangle.setGPSPower(true, "tinyVario"); require("Font8x16").add(Graphics); var intTime=10,pressureInterval=100; var altH = []; var fAlt=0; var roc=0,rocAvg=0; var gs; var lastPressure = Date.now(); var flying=false; var takeoffTime, flyingTime; Bangle.on('pressure', function(e) { if ((fAlt)==0) fAlt=e.altitude; fAlt=fAlt+(e.altitude-fAlt)*0.1; }); Bangle.on('GPS', function(fix) { gs=fix.speed; }); /*setWatch(function() { }, BTN1);*/ setInterval(function () { altH.push(fAlt); while (altH.length>intTime*1000/pressureInterval) altH.shift(); }, pressureInterval); setInterval(function() { var y=0; //gs=100; //fAlt=7777; if ((!flying) && ((rocAvg>1) || (rocAvg<-1) || (gs>10))) { //take-off detected takeoffTime=Date().getTime(); flying=true; flyingTime=0; } if (flying) { flyingTime=Date().getTime()-takeoffTime; ftString=(flyingTime / 3600000).toFixed(0)+":"+(flyingTime / 60000 % 60).toFixed(0).padStart(2,'0'); } if (altH.length==intTime*1000/pressureInterval) { rocAvg=(altH[altH.length-1]-altH[0])/intTime; roc=(altH[altH.length-1]-altH[altH.length-(1000/pressureInterval)]); } var timeStr = require("locale").time(Date(),1); g.reset(); g.clear(); //draw altitude g.setFont("8x16",3).setFontAlign(1,-1).drawString((fAlt).toFixed(0)+"m", g.getWidth(), y); //------------- y+=16*3; g.drawLine(24,y-2,g.getWidth(),y-2); //draw rate of climb if (roc>0.1) g.setColor(0,1,0); if (roc<-1) g.setColor(1,0,0); g.setFont("8x16",3).setFontAlign(1,-1).drawString(rocAvg.toFixed(1), g.getWidth()-20, y); g.setColor(1,1,1); g.setFont("8x16",2).setFontAlign(-1,-1).drawString("m", g.getWidth()-20, y); g.setFont("8x16",2).setFontAlign(-1,-1).drawString("s", g.getWidth()-20, y+20); g.drawLine(g.getWidth()-20,y+26,g.getWidth()-8,y+26); //------------- y+=16*3; g.drawLine(24,y-2,g.getWidth(),y-2); //draw groundspeed if (!isNaN(gs)) { g.setFont("8x16",3).setFontAlign(1,-1).drawString(gs.toFixed(0), g.getWidth()-20, y); g.setFont("8x16",1).setFontAlign(-1,-1).drawString("km", g.getWidth()-20, y+4); g.setFont("8x16",1).setFontAlign(-1,-1).drawString("h", g.getWidth()-20, y+24); g.drawLine(g.getWidth()-20,y+21,g.getWidth()-8,y+21); } //------------- y+=16*3; g.drawLine(0,y-2,g.getWidth(),y-2); g.drawLine(24,0,24,y-2); g.drawLine(g.getWidth()/2,y-2,g.getWidth()/2,g.getHeight()-1); g.setColor(1,1,1); //draw flight time if (flying) { g.setFont("8x16",2).setFontAlign(0,-1).drawString(ftString, g.getWidth()*0.75, 14*10+4); } //draw time g.setFont("8x16",2).setFontAlign(0,-1).drawString(timeStr, g.getWidth()/4, 14*10+4); //draw bar graph if (roc>0.1) g.setColor(0,1,0); if (roc<-1) g.setColor(1,0,0); g.fillRect(0,(y-2)/2,23,Math.clip((y-2)/2-roc*20,0,y-2)); }, 250);
-
-
I seem to be able to reproduce the "clock does not update but watch works fine otherwise" error by repeatedly connecting/disconnecting the watch via gadgetbridge on my phone.
The clock stops updating, but the watch still responds to button and bluetooth. I see a "CALLBACK" message in red on the bottom of the screen. -
How about this for notification messages:
Add new notifications to the bottom of a scrollable screen that gets displayed whenever a new message comes in. Preferably, this would take up all of the screen to enable a readable font.
Old messages are eventually deleted when they reach the top.
Tapping on a message could open a menu for saving/deleting.
There is also this.