Avatar for diego

diego

Member since Jan 2022 • Last active Jan 2022
  • 3 conversations
  • 37 comments

Most recent activity

  • in Bangle.js
    Avatar for diego

    Also, I've just made a pex (executable) file from the sample script I've sent earlier, it's attached, if you want to try it out.

    The pex is just a glorified zip file, so you can open it and check out inside, but you can execute with: ./send_time.pex 'aa:bb:cc:dd:ee:ff'

    The usage:

    usage: send_time.py [-h] [--correction CORRECTION] address
    
    Bangle send time
    
    positional arguments:
      address               bluetooth address to connect
    
    optional arguments:
      -h, --help            show this help message and exit
      --correction CORRECTION
                            milliseconds to add to time to compensate for connection time
    
  • in Bangle.js
    Avatar for diego

    Sorry, @Numerist, I think I was still a bit programmy on my response.
    In more broad terms, the script above when executed on a computer with bluetooth sets the clock on the bangle to the time of the computer.

    As the communication of the command between pc and bangle is kind of fast, there's little need for compensating (50ms in my tests, but you can antecipate and correct for that if you wanted)

  • in Bangle.js
    Avatar for diego

    This is one approach: it connect to bangle then sends the computer time (hopefully a good time)
    within the command to update bangle. Then you have only the delay of the communication with the device, which can be measured and adjusted.

    On my device, this is the average for 100 samples: 0.05636221885681152s, so I could adjust to add 50ms on the time sent to the device to compensate.

  • in Bangle.js
    Avatar for diego

    Yes, I don't use the gadgetbridge, so it works for me.

  • in Bangle.js
    Avatar for diego

    Hi, the code below should work to send the time to the device: it opens the connection, sends the command to update date, and then closes the connection.

    import asyncio
    from time import time
    from bleak import BleakClient
    
    
    UUID_NORDIC_TX = "6e400002-b5a3-f393-e0a9-e50e24dcca9e"
    UUID_NORDIC_RX = "6e400003-b5a3-f393-e0a9-e50e24dcca9e"
    
    
    async def main(address):
        buffer_size = 20
    
        print(f"Connecting to {address}...")
    
        async def send_command(command):
            c = command
            while len(c) > 0:
                await client.write_gatt_char(UUID_NORDIC_TX, bytearray(c[0:buffer_size]), True)
                c = c[buffer_size:]
    
        async with BleakClient(address) as client:
            print("Connected")
            print(f"Time: {time()}")
            await send_command(bytes(f"setTime({time()});\­n", "utf-8"))
    
    asyncio.run(main("d8:ee:7c:31:a9:c0"))
    

    I'm using something similar to this to periodically sync weather data and my personal agenda with the device

  • in Bangle.js
    Avatar for diego

    I've used some transparent varnish, but I think I'll replace with black acrylic paint for the same reason you used white: to be sure that it's there. I think it's holding up, but I'm not sure and I also think I'm getting some corrosion so better safe than sorry.

  • in Bangle.js
    Avatar for diego

    Yes, I think that's it: there is more touch area to the right of the screen that I can reach with touch or drag, but is seems to be definitely offscreen.

    And then there is the other thing with touch, where sometimes the touch is a little bit off the touch point, that's what misguided me to think I needed to readjust the positions, some confirmation bias I guess.

  • in Bangle.js
    Avatar for diego

    @rigrig I don't intend to do anything like that anytime soon, BUT I really liked the concept here, thanks for the idea in general.

  • in Bangle.js
    Avatar for diego

    @Gordon just tested, and it worked fine. I don't have a stylus so you'll have to take this with a grain of salt, :P

    After this, I've made a second test with the following codes:

    Bangle.on("touch", function (button, tap) {
      g.setColor("#000");
      g.fillCircle(tap.x, tap.y, 5);
    });
    
      Bangle.on("drag", function (tap) {
        g.setColor("#000");
        g.fillCircle(tap.x, tap.y, 5);
      });
    

    What I've found is: drag is really consistent, touch has a few odd positions here and there.

  • in Bangle.js
    Avatar for diego

    +1 for the idea, I also think it's a good solution.

    One thing to notice, I don't know how many of you do the same, but I've changed my apps.json to only show the apps that I've changed on my github, so it's easier to understand, move around, etc.

    On local file, it's easy: just edit the apps.json, but on github, how would that be done? Removing the metadata from everything else? Maybe some kind of whitelist config I can push?

Actions