-
-
-
Hi all,
I am trying to connect to Android phone (there is GATT server) while debugging in Chrome IDE.
Getting ERR 0x12 (CONN_COUNT).var gatt; NRF.requestDevice({ filters: [{ name:'Pixel 4a' }] }).then(function(device) { console.log("found device"); return device.gatt.connect(); }).then(function(g) { gatt = g; console.log("connected"); return gatt.startBonding(); }).then(function() { console.log("bonded", gatt.getSecurityStatus()); gatt.disconnect(); }).catch(function(e) { console.log("ERROR",e); }); =Promise: { } found device ERROR ERR 0x12 (CONN_COUNT)
If "one central and one peripheral connection", what is a central and peripheral in my case?
My understanding B2 acts as service, so it should be peripheral. Am I correct? Then why it does not allow to connect to Android service as central? -
It looks like something is wrong with my Chrome in Linux. It cannot load modules for Emulator too.
Chrome in Windows works well.It appears that in windows it does not work same way when I put http://www.espruino.com/modules/ into Settings. It works with HTTPS.
I've put https://www.espruino.com/modules/ that in Linux Chrome. And it works!
-
Font not found after upgrade to firmware 2v14.
current firmware version is 2v14 and bootloader is 2v12.require("Font8x16").add(Graphics); g.setFont8x16(); g.drawString("0123456789"); >Uncaught Error: Module Font8x16 not found at line 1 col 19 require("Font8x16").add(Graphics);
Settings/Communications Module URL is set to http://www.espruino.com/modules/
Please advise.
-
Accuracy also depends on an antenna, and even on a ground plate.
The 2.5m accuracy stated in a chip's docs usually presumes a good (active) antenna, good ground plate and good weather and sky conditions.
The antenna in the watch is very little, passive, and there is no ground plate.
So, we should not expect, the accuracy will always be high.
I am working on speedometer app, it uses Doppler velocity from GPS fixes (rather then calculates speed from coordinates). Though it can detect correct speed (compared to car speed), very often time lag can be up to minute. Like, I am driving already 40 km/h, but the watch still shows 10 km/h, then after ~40 sec, it finally shows 40 km/h.
This is kind of frustrating, but I understand why it cannot be precise enough.
I am thinking about to use a separate GPS unit with bigger antenna, and use the watch as a display only, sending data via Bluetooth. -
-
not totally different. Currently I just want to draw a color box on top of an "Color" item.
That shows a current color, and calls a submenu that allows user to select a color from list.If a rectangle x1,y1,x2,y2 of the item will be passed into the callback it should not break.
The alternate menu system has to be compatible with the standard one anyway. It also should support this callback, same way as it should support format() callback. -
-
@Mark_M no, I haven't had time for that. Sorry, but I forget why this was needed in the end? Since you can feed images back from the format function you can display a bunch of stuff through that pretty easily and cleanly.
@Gordon,
The need was to allow to draw custom vector graphic on top of the item. Like frames, colored bars, or circles, or whatever.
I do not disagree that it is possible to use format, but it does not look convenient for dynamic vector graphics. Does it mean I need to create a bitmap, draw into that, then pass it to format() as a string? It looks quite tricky. -
Hi Gordon, did you have a chance to add a callback after the item is rendered?
Something like
afterdraw : function(idx, item, rect)not sure if menu needs to be passed. In previous system there was a selected item stored in header item[0]. If something will be stored in item[0], the whole menu or just this item[0] should be passed as well.
afterdraw : function(idx, item, rect, menu) -
That looks like a good idea, but I'm a bit concerned it's adding quite a lot of extra code for something that isn't used that much (and what if someone wants to specify something that's not one of those 8 colors?).
Yes, that is right.
May be then it will be helpful just to add a "drawItem" callback? with (idx, item, x1,y1,x2,y2) params. There one can do whatever is needed after the item is rendered a standard way. -
-
Looks neat! Numbers edit is perfect.
In emulator I cannot feel a feedback like buzz (BTW can buzz be added to emulator? as a sound or as a some visual). Will load this to watch.
May be it needs a highlight to know which item I will tap.Editing for special types, like for time, date and color would be nice to have.
Also callbacks that allow to custize, like a callback like itemDraw(x1,y1,x2,y2) to customize drawing. May be it is already there, I just do not know.I've added this to current settings menu. Having issues with Git to merge and create pull request. But it looks like, if we go with the new menu, the modification of the old one does not make a sense.
-
-
-
An easy and universal way to make regular updates is to create a widget that will sort of a backgroung job. It will get data from a time server and set the watch RTC. Then any watchface will get the correct time.
Probably you do not have to even to create it. As DDDanny wrote
that the Android/Gadgetbridge TimeSync after connect works like a charm.
Some people here is working on a connectionless (ads based) way of time synchronizing with jitter < 10ms. Is it what you need? -
Thanks Gordon!
If I want to make and test the changes in this library, should I put it (copy of it) into my /modules/ dir on my web server? Or it should be there in /lib/js/banglejs/ ?tried to put it into /modules/ and load with
require("http://localhost/mark/BangleApps/modules/E_showMenu_Q3.js");
Output
No errors in http://localhost/mark/BangleApps/modules/E_showMenu_Q3.js. Minified 4256 bytes to 0 bytes. > ____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v10.187 (c) 2021 G.Williams > >Uncaught Error: Unable to load module "http://localhost/mark/BangleApps/modules/E_showMenu_Q3.js" at line 1 col 91 ...howMenu_Q3.js",function(){}); ^ >Uncaught Error: Module http://localhost/mark/BangleApps/modules/E_showMenu_Q3.js not found at line 1 col 68 ...s/modules/E_showMenu_Q3.js"); ^
-
I am trying to draw color box at right side where normally text values are located.
I use "format" hook. It is possible to draw inside it, but it does not pass the item rect or just X,Y. So I resort to derive Y by the item number and options.fontHeight.function drawColorValue(menu, row, col){ var options=menu[""]; var fh = options.fontHeight; var ay = 0; //(g.getWidth()==240)?0:8; //workaround var x=g.getWidth()-50, y=((options.title)?fh+2:0) + row*fh + 2 + ay; //print(myMenu); //print(x,y,fh); var c=g.getColor(); g.setColor(col); g.fillRect(x+2,y,x+50-2,y+fh); g.setColor(c); return col; } var myMenu = { "" : { "title" : "Title" }, "< Back" : () => back(), "Red": { value:"#f00", format : function (v) { return drawColorValue(myMenu, 1, v); } }, "Green": { value:"#0f0", format : function (v) { return drawColorValue(myMenu, 2, v); } }, "Yellow": { value:"#ff0", format : function (v) { return drawColorValue(myMenu, 3, v); } } }; E.showMenu(myMenu);
While Y is calculated fine for B1, it has some offset for B2. The offset is 8 pixels down from horizontal title line.
You can see I can work it around - look near comment "//workaround".
I've looked into code of graphical_menu.js module, but I do not see where that offset is added. Does B2 use different menu module?
Ideally it would be nice to have a "drawItem" hook with Graphic and Rect params. -
old topic...
I'm trying to put debugger; into code. but emulator does not stop there.var myMenu = { "" : { "title" : "Title" }, "< Back" : () => back(), "Test": { value:"X", format : function (v) { debugger; var options=myMenu[""]; var fh = options.fontHeight; print(myMenu); return v; } }, }; E.showMenu(myMenu);
-
-
-
-
it can be done two ways.
NRF.on('disconnect', my_reconnect_fun);
using interval like 10s
for interval approach my_reconnect_fun() should include checking connection, like if(!gatt.connected)...