Avatar for Tobias

Tobias

Member since Mar 2022 • Last active Mar 2022
  • 2 conversations
  • 5 comments

Most recent activity

  • in Bangle.js
    Avatar for Tobias

    Thanks a lot, I had a look at the tutorials but did not find something very usefull. But thanks for all the suggestions. I will give it a try!

  • in Bangle.js
    Avatar for Tobias

    Thanks, I guess I gonna look into this a bit further.

    • 7 comments
    • 1,032 views
  • in Bangle.js
    Avatar for Tobias

    Hello everyone,

    for my future Bangle.js project I need to send data from my Android device to the watch. Since I'm experienced in the Android development part, I only struggle with the watch side.
    I would assume there should be a simple way of receiving data via Bluetooth (LE) that just reacts to incoming "streams" from the phone.

    Could anyone point me in the right direction?

    I found that one
    http://forum.espruino.com/conversations/­364065/#comment16008718
    but it doesn't seem to be exactly what I need. Especially since it's pretty much code where as I would simply be happy with a minimal example like sending a String to the watch and printing it.

    Thanks for any assistance.

  • in Bangle.js
    Avatar for Tobias

    Okay, some updates.

    I made it. The issue was I had to define a palette myself. I falsely assumed there was one already existing.

    However there seems to be still an issue.

    I defined this:

    var pal = new Uint16Array([
    0x0000, //0000000000000000 BLACK
    0xF800, //1111100000000000 5 bit RED
    0x07E0, //0000011111100000 6 bits GREEN
    0x001F, //0000000000011111 5 bit BLUE
    0x0000, //0000000000000000 BLACK
    0xF800, //1111100000000000 5 bit RED
    0x07E0, //0000011111100000 6 bits GREEN
    0x001F, //0000000000011111 5 bit BLUE
    ]);
    
    var colors = new Uint8Array([
      0b00110011, 0b00110010,
      0b00110011, 0b00110010,
      0b00110011, 0b00110010,
      0b00110011, 0b00110010,
    ]);
    
    var img = {
      width : 4, height : 4, bpp : 4,
      palette:pal,
      buffer : colors.buffer
    };
    
    g.drawImage(img, 10, 10)
    

    But the error I get goes as follows:

    Uncaught Error: Palette specified, but must be a flat Uint16Array of 2,4,8,16,256 elements
    at line 1 col 24

    But I have 8 elements there. If I chose 2, 4 or 16 everything works fine. So is this a bug? Am I missing something? Why would it tell me 8 colors are fine when they are obviously not?

  • in Bangle.js
    Avatar for Tobias

    Sorry for posting this twice. I'm not sure which board is the right one to ask something for my Bangle.js project. Please close the wrong one if needed (http://forum.espruino.com/conversations/­373677/#comment16426952)


    Hello everyone,
    in my project for my Bangle.js I need to draw a picture from an Array.
    Since it has to be performant - and the display isn't capable of many more colors - I was thinking of using the 4bit images.
    The API
    https://www.espruino.com/Reference#l_Gra­phics_drawImage
    states
    "On Bangle.js, 4 bit images use the Apple Mac 16 color palette"
    However, I don't seem to understand how this palette is organized.

    From what I understand when painting the image, defining the bpp to 4 enables this dirctly. And the values that are drawn are not color values (e.g. RGB) but values of a fixed color set. E.g. 0 = black, 1 = yellow or such kind)

    So I made a minimal example code like this hoping to see some colors:

    var colorPalette3 = new Uint8Array([
         0b00010000
    ]);
    
    var img = {
      width : 1, height : 1, bpp : 4,
      buffer : colorPalette3.buffer
    };
    
    g.drawImage(img, 10, 10)
    

    However this is almost all the time showing a black pixel. Some values lead to other colors but I can't understand the pattern. I also tried it with integer values hoping to understand the palette but without success.

    Could anyone help me with that? Or maybe a like would be nice.
    I even tried the color scheme I saw on Wikipedia where each bit suggests the color canal to be 1 or 0. But even then a 001 should not be black, right?
    https://en.wikipedia.org/wiki/List_of_mo­nochrome_and_RGB_color_formats#3-bit_RGB­

    Thanks for the help!

Actions