Most recent activity
-
I was looking at the datasheet for the accelerometer in the bangleJS2 and was wondering about the magnitude range that is available.
https://www.espruino.com/datasheets/KX023-1025.pdf
I see there is a +/- 2, 4, and 8g sensitivity setting that is 'user selectable':
"Resolution and acceleration ranges are user selectable via I2C or SPI." (I don't know much about these protocols)
But I am wondering how / if we can interact with that through the API and also what the 'default' setting is.
At the moment, through experimentation, I haven't been able to produce a reading above 5.65 g's (total magnitude). I could see that reading coming from a combination of axes though, which leads me to think the accelerometer is in 4g mode, however it is possible that my timid nature / feeble physique are imposing the limit here, not the sensor (lol)
EDIT: I may be finding what I need over in
https://github.com/espruino/BangleApps/blob/master/apps/accelrec/app.jsUsing deduction, it seems like you CAN change those things with accelWR, the default is 4gs, and you just need to find the right numbers in the datasheet that correspond with the setting you want to change. I actually think I have what I need - just have to review the data sheet in more detail.
EDIT: again. I think I have everything I need. Thank you Espruino forums for being a rubber duck for me :)
So here's the D/L for anyone else that comes by.
The default is definitely 4g's. You configure the accelerometer by writing to these eight bit binary numbers called "registers". The two important registers in the manual I referenced are called "ODCNTL" and "CNTL1". References for these are on pages 40 and 44 of the manual.
Once you change the sensitivity of the sensor, your magnitude numbers from bangle will either be 0.5 at rest of 2.0 at rest (instead of 1.0), so correct for that accordingly.
My goal was to measure peak throw acceleration, but I think humans can pull of 10's of g's when throwing objects so I might be out of luck with even the 8g setting.
-
So actually I may have solved my problem entirely, but I'd be happy to hear from people as to why I solved it, because I think I Maxwell Smart'ed / Mr. Magoo'ed my way through it.
The code I am running now
Bangle.setUI({mode: "custom", btn: () => { Bluetooth.println(""); Bluetooth.println(JSON.stringify({t:"info",msg:"Hello World"+getTime()})) console.log("HELLO"); }}) function GB(argumentados) { g.clear(); g.drawString(JSON.stringify(argumentados),0,0,true) }
with the android integration uninstalled works PERFECTLY. I noticed that in the android integration there was a random looking
Bluetooth.println("")
hanging out above thesend stuff to gadgetbridge
code so I added that to mine, and that made it work. TAH DAH.I get the info popup every time on the phone. I get the simulated notifications from GadgetBridge drawn on the screen. It's magnificently simple. I'm very happy.
Edit: okay it's not EVERY time I press the button that I see the toast message, but it's like 80%. Which is good enough.
-
However, when checking the log it does show multiple presses. So it does seem to be receiving them from the bangle, just not showing them in Android every time.
Thanks for confirming. This is sort of what I suspected. Like maybe android is debouncing them somehow to avoid spamming the end user or something.
For Bluetooth print line you shouldn't need it, but I could be wrong.
Yeah that's what I thought but it doesn't seem to work at all if I uninstall the android integration app from the Bangle. Admittedly I am in a little over my head with this right now, but will probably understand it better after learning a bit more about how everything works.
I agree that simple transmission seems to work without the app on the Bangle side, but gadget bridge doesn't seem to acknowledge them (even once, like when the app is installed). I'm guessing there's something in the integration app that might facilitate that.
-
Hey folks! Have been fiddling with the integration aspect of my BangleJS and have been struggling a little bit to figure out what's what. I have been following this:
https://www.espruino.com/Gadgetbridge
I installed the bangle version of gadgetbridge on my phone, then installed the android integration on my BangleJS (not 100% sure if this was required for transmit only, but I did it anyway).
Then I loaded this code into ram in the web IDE:
Bangle.setUI({mode: "custom", btn: () => { Bluetooth.println(JSON.stringify({t:"info",msg:"Hello World"+getTime()})) console.log("HELLO"); }})
disconnected from the web IDE, then connected to GadgetBridge. I then hit the side button on my watch, and saw the little info toast pop up on my phone. Wohoo! Then I hit the button again... Nothing! Strange.
I hit the button a few more times over the course of about 10 minutes and it seemed to work maybe once or twice more. I proceeded to disconnect from gadgetbridge then reconnect, hit the button again, and it works again - but only once.
Wonder if anyone with a little more familiarity with these things could weigh in.
- Is this unexpected, or am I doing something wrong?
- Did I actually need the full android integration app with all the message and message icon dependencies to send info messages to the phone? (It didn't seem to work before I did that, but the integration app only mentions receiving messages, not sending them.)
My interest right now is just getting the most minimalistic possible setup and get a little bit of hello world data to reliably go both ways, even just to log it to the console.
- Is this unexpected, or am I doing something wrong?
Hey Folks, I am starting on a project that will involve my BangleJs2 and I am wondering if people out there with a little more bluetooth experience than myself might be able to help point me in the right big-picture direction.
I own a Nikon Camera with "built in" wifi that can only be activated by the proprietary snap bridge mobile app software. I can actually connect to bluetooth on my camera with other kinds of devices but the camera is expecting a certain kind of communication to be opened, so it immediately fails in its sort of little proprietary connection dance.
What I was hoping to do was to write a little utility to mimic the wifi startup signals that my phone blurts out when I try to connect to the camera with snap bridge, and to do that I was thinking maybe there would be a way I could eavesdrop on that conversation as it happens so I can understand what's going on a little better. The Bangle2 seemed like an easy platform to use to poke around in that area.
Ideally I would like to end up with a little software button on my bangleJS that I can press to turn wifi on on my D500 so I can use that wifi connection for other things.
I'm wondering if anyone has tried something like this - like the bluetooth mimicry / eavesdrop thing with Bangle before, or if I'm totally off my rocker if people had alternative suggestions for achieving what I am trying to achieve.
Like maybe I need to do it step by step and just have my bangle pretend to be my camera and see what my smartphone says, and then pretend to be my smartphone and see what my camera says, and do that back and forth until I figure out what's going on.
EDIT: It turns out that a later firmware version exposes this functionality right on my camera - rendering my bangle software button hyjinx obsolete / moot. I would delete this post but I actually don't know how, so here's a monument to my impulsive posting habits.