-
There is the feature currently built into GadgetBridge that allows a phone app to send a message to the com.bangle.uart.tx intent, and ultimately cause a single line of text to be sent to the watch's REPL.
That's a potentially massively useful feature for me, but what would be really nice would be to have an additional feature in GadgetBridge that lets me enter a line of text and directly send that text to the watch. That would save me from having to write an Android app that basically does the same thing.
I wouldn't even need to see the response from the REPL, for what I have planned I'd get feedback pretty quickly based on changes that would appear of the display.
Any chance this feature could be added to GadgetBridge?
-
-
I think I mentioned at https://forum.espruino.com/conversations/390481/#17137641 but if you use setUI({mode:"clock"}) it automatically sets up the middle button to go to the launcher - maybe you didn't have that?
That would be it. And now I remember why it's missing. I'd originally added that wen I first started creating the watch face in the emulator, and it generated the following error:
Uncaught ReferenceError: "setUI" is not defined at line 279 col 1 in app.js setUI({mode:"clock"});
so I had to remove it again.
Can I offer a suggestion to add a
setUI()
function to the emulator that does nothing. It would allow that line to be present, thus permitting developers to use the exact same code in the emulator as they are in production. -
-
I've managed to get my Bangle.JS into a bit of an unresponsive state. In the course of trying to save as much power as possible to extend battery life, I started by turning off BLE. That looked good, because the watch no longer appeared when I scanned with my cellphone.
"Great!" I thought to myself. "That works. Now I can go into settings, and turn it back on to finish developing my watch face." Except that now that it's running the first version of my watch face, the button does not enter the settings screen.
I specifically did not disable "Wake on BTN1" after a discussion in another thread about maintaining the default behaviour of the button. However, at the current time, the button does cause the light to come on, but it does not enter the settings screen.
So given this state, and the lack of BLE, what options do I have to get this thing back to normal operation. A long press on the button does eventually reboot the watch, but it returns to the above state. Is there some magic incantation I can cast to get it back to the factory default condition? While I'm at it, what could I have done that caused it to get into this state? I'd have thought that "Wake on BTN1" would have been enough, do I need to add something to the watch face itself?
The watch face can be found at https://github.com/dgnuff/BangleApps/tree/master/apps/travelwatch and it can be deployed from https://dgnuff.github.io/BangleApps - look for "TravelWatch". At the current time, there are two additional timezones hard coded to test that logic, they work right if you live in the "America/Los_Angeles" timezone, but other than that they will be wrong. I'll be working with https://www.espruino.com/Bangle.js+Custom to fix that, but for now, I need to fix these other problems first.
-- LATER --
Got it back from the grave, I found that by rapidly clicking the button after a reboot, I could get it into a "Reset" screen. From there a factory reboot did the trick. That said, this is still a concern, because it probably won't come as any kind of surprise when I say that I really don't want to do this again.
So what might have got it into that state? While I'm at it, how much of a drain is it to leave BLE enabled 24/7, just as long as I'm not actually communicating with the watch? I found the HRM in the watch, is setting "HRM Interval" to "Off" sufficient to keep the HRM disabled. And since I didn't see any references to GPS in the settings, does that just stay inactive unless something explicitly enables it?
-- EVEN LATER --
This is definitely a bug with the watch face. After doing the factory reset, I deployed the watch again, same behavior. This time it's far less of an issue, because I've left the "default" watchface as "AntonClock" that is baked into the firmware, and that one behaves correctly. So to get things back after starting my watch face, I can just reboot, it drops into AntonClock, and I can get to settings from there.
But I really would like to know what's wrong with my watch face so I can fix it.
-
Yeah. I got that when I tried it on the phone. The laptop never even got to the point of showing me the available versions to upload. So I'd guess that you're correct that BLE is broken. Which is kinda a surprise, since it's a builtin Bluetooth chip, not a USB dongle, which supposedly has BLE. At least it can see the watch and pair with it. it just can't actually talk once it's connected.
-
This is the app repo at https://banglejs.com/apps/ . I'm not yet to the point of connecting to the IDE. I need to get the firmware up to date on the watch before I'll even consider putting a custom watch face on it.
There's no issue with the computer Bluetooth. It's a laptop with wifi built in. Device manager shows all the necessary devices, all claim to be working correctly, and driver update tells me the best drivers are already installed.
And if you note in the last paragraph of my message
1) my phone can see both the computer and the Bangle.js when I have it scan for Bluetooth devices, proving that Bluetooth is working on the computer.
2) The computer does pair with and connect to the Bangle.js, becayuse the popup says "paired", and the button shows "Disconnect" which kinda implies we've got a connection.
It's just that the actual firmware upload fails.
-- LATER --
Doing a little research, it looks like BLE support on the laptop may be a bit dodgy. I tried browsing to the app loader on my smartphone and got a bit further. I got it connected, and the hamburger in the Firmware Update now reports I'm on 2.18, and that 2.19 is available.
Update is in progress now, we'll see how this goes. Thinking ahead, this seems to indicate that I'll have to use my phone to upload apps to the watch. This will be a bit of a pain vs direct upload from the IDE, but any port in a storm, I guess.
-- EVEN LATER --
Yeah, it definitely looks like BLE is pooched on the laptop. I tried it again on the laptop this time from within the IDE. Similar result to App Loader: it sees the Bangle.js claims it's paired, but then hangs at "Connecting".
-
I got my Bangle.js 2 today, and the first thing I did was to head to the app loader to do a firmware update, and set the time.
The Bluetooth connection seems to be very unreliable. I have the device paired, at least it shows that way in the app loader popup, and the button top right shows "Disconnect", implying it's got a connection.
However clicking on the hamburger to configure and upload either produces a popup warning me that this is only good on the Bangle.js 2, never mind that I already told the web page that I have a Bangle.js 2, or it just turns into a spinning icon that spins forever and does nothing.
I'm getting the same results in both Chrome and Edge, so it's not a browser issue.
Before you ask, Bluetooth is turned on and working on both the computer and the Bangle.js 2. I can see both my computer and the Bangle.js 2 advertising when I scan for devices on my phone. Plus the app loader page does show a "Disconnect" button, and the fact that it's paired with the watch, so everything should be working.
-
I plan to leave the button alone since it's used to open the launcher. Doing so adheres to what I consider is a very important concept in programming, the "Principle of least astonishment". This says you should try to avoid doing things that are unexpected and astonish the user.
Intercepting a button and changing it's behaviour from a well established default is a prime example of violating that principle. That said, it appears that I can intercept touch events, so that is the route I plan to take.
As regards the display, I've found that I can get the watch face to look fine in the emulator with just the three bit color, so that works perfectly. It's a pretty minimalistic design: time, dow & date, and time in second zone. Just three sections in cyan, green and yellow respectively.
-
"Configuration data for a watch face?" I hear you asking. Am I crazy? Maybe not. Here's the use case. I have a watch face that I'm working on that includes the display of the time in another timezone.
I personally find it very useful, because I have relatives spread across Europe, family in both England and Switzerland. So it's handy to know what time it is there before sending a text and waking them up at 3:00 AM local time.
The config data is pairs of values:
[
{ "name": "LON", "offset": 480 },
{ "name": "ZUR", "offset": 560 }
]is how it would be represented in JSON. You can work out from these that I live on the west coast of the USofA. What I need is a way for the watch face to get this data, presumably via BLE, and then save it to some sort of persistent storage that will survive across a restart of the watch face.
There's enough information about BLE that I can probably figure that out myself, but I'm at a complete loss as to how to save data permanently in a form that a watch face can access.
On a very closely related topic, is Bangle.js aware oft timezones and daylight savings? Meaning if I tell it that I live in the america/los_angeles timezone, does it know how to change itself every March and November, without needing a connection to a compter or phone?
-
Yes. However I guess it is not the display itself that consumes that much power on update it is the CPU wakeup and activity to produce something drawable before sending the result to display, here it is also the JavaScript interpreter that takes milliseconds to execute even few lines of code
Interesting. That was one of the things that was specifically called out in Pebble development. The display was updated a horizontal row at a time, and a whole row had to be sent. So even if you were only updating a rectangle 10 px high by 3 px wide, you'd still have to send the entire 10 rows. And the display's power consumption increased dramatically when updating. Granted, waking the CPU to do that also took a bit of power, but that was one issue that was raised.
Regarding the second point, with many years of embedded work under my belt, I'm no stranger to keeping the code as simple and fast as possible. That's a necessity on really constrained devices like the Intel 8051 that I first used back in the 1980s. So keeping that mindset will certainly help writing code here.
-
The subject describes me pretty accurately, I owned both an original Pebble and a Pebble Time, and was very familiar with programming them. I'm coming over to Bangle.js because it has all the great features that I loved about the Pebble: Always on display, very easy to program, and an incredibly long battery life.
I've got to the point that I can write something using the web IDE and upload it to the emulator, so the basic workflow is in place. That said, I plan to recreate the watch face that I made for my Pebbles on Bangle.js, but that leads to a few questions.
Firstly, am I correct in thinking that button presses aren't available to a watch face? I checked the list of events at http://www.espruino.com/Reference#Bangle and the closest I could find was event Bangle.touch(button, xy) . This is usable, but I just want to be sure that I'm not missing anything.
Secondly, does the Bangle.js share the same display property that the Pebble had? If the display wasn't changing it only drew a few microamps, the big consumer of battery power was screen updates. For that reason I didn't normally display the seconds, which meant I was only updating once a minute. This really helped to stretch the battery life. It also explains part of the reason for question 1: one user input was to show seconds for a short time if requested.
What I am trying to achieve is the ability to send configuration data to the watch in the absence of an internet connection that gives me access to the app loader.
The italicised text is the key item here. There are times when I wish to modify the configuration data for my watch face, but I do not have an internet connection available. Under these circumstances I can't use the app loader, so I need to do this locally.
I could solve this by writing a custom Android app that sends text to the com.bangle.uart.tx intent, which would allow sending a line of text to the REPL. However I'm guessing that 99.9% of the work is already done in GadgetBridge, which means it might be a relatively quick and easy change.
If not, then I'll just have to write an Android app which will allow me to get where I want to be.