Avatar for tanepiper

tanepiper

Member since Feb 2021 • Last active Apr 2021
  • 5 conversations
  • 11 comments

Most recent activity

  • in Bangle.js
    Avatar for tanepiper

    OK @Gordon I understand the concept, but I'm missing some details (I was never good at graphics programming)

    First off, before I did try to create an 8bpp image I usually get LOW_MEMORY warnings - so I gave up and stuck to the doublebuffer and drawing.

    I looked at the animated clock example - I see they have a pre-computed palette file that is some binary data? For the Uint16Array I don't quite understand what needs to go in it?

    At the moment I'm using RGB values, and when drawing converting them to the correct 0...1 value.

    I assume from what I'm reading the array maps to each individual pixel? Instead of shifting the data, I'd just move the palette X pixels to the left to right? In that case, do I need to draw a background, or am I just palette shifting at this point to get the same desired effect?

    Then I assume here it's draw image and flip? (or is clear better?)

  • in Bangle.js
    Avatar for tanepiper

    Thinking about I'm wondering - would it be better to generate an image from the array,it would need to be a full 8bpp, could probably get away with 5 or 6.

    If I can make the image roll around the screen then I can use that as the pre-calculated background?
    I think having to shift or unshift the arrays is where it's slowing down so it seems like a good place generate it once and reuse it

    For the effect, Each filled rectangle width is (screen width / total gradient array length) so you get the effect of each colour at the edge and the wide bar of each colour, and a pretty smooth gradient effect.

    I was thinking also pre-storing all the theme steps instead of generating them each time, but if it's only run once I think having the function seems better as it's only a single calculation each time.

    I also wanted a random option, but BangleJS's Math.random isn't random enough! I even tried adding a multiplier from the accelerator each time the function was called to make it more random but it was still generating colour combinations too close to each other.

  • in Bangle.js
    Avatar for tanepiper

    Also in the emulator, it works - but the background animation doesn't happen (it's just still) but all other functions work - and with doublebuffered it's very flickery around the top where the widgets should be

  • in Bangle.js
    Avatar for tanepiper

    Hey,

    I'm working on a clock face - It's a gradient generator with some themes and configuration.

    The themes are each two colours, and a function in the watch generates more colours based on the passed number of steps.

    It then creates an array and appends the reversed version to it to create one smooth gradient field.

    Using the accelerometer to decide the direction the gradient moves in so you get an effect of the background moving - you can also switch it between horizontal and vertical

    To get this working effectively I'm using LCD Mode "doublebuffered" which works great - if I try it in normal I get a lot of flickering and haven't really figured of if it's possible with that I'm doing to do in that mode.

    But I've noticed that despite my best efforts, the screen never goes off with the LCD Timeout, and I'm wondering what I'm doing wrong? This isn't the most memory-efficient clock, and it does a lot of drawing (once per 100ms to be smooth) by shifting the entire array of colours so when the screen isn't on I'd definitely like to stop any running timers.

    Can anyone spot what I'm doing wrong?

  • in Bangle.js
    Avatar for tanepiper

    Hey @Gordon - thanks for the feedback.

    The final idea would be to have something that is zero dependencies and fully tree-shakable, but for now, it's just a concept idea - I've got some kind of pipeline compiling the library to a IIFE version and appending it with the app code, which is also IIFE and it works fine - but yes it's pulling 10K for that file.

    I'm trying for the library being ESM/UMD which means it's importable and tree-shakable, and the output code being UMD with bundled dependencies but it seems a pain right now. It's something I might come back to.

    (As it is if I made that select component more compact would it be useful in the core? It's an alternative to a menu but allowing a user prompt)

  • in Bangle.js
    Avatar for tanepiper

    Hi, I've had a look and couldn't find anything on getting a screen dump of the current view on the watch - I tried a few of the things from the Graphics library like fromBPM but that gives me:

    Uncaught Error: asBMP/asURL only works on 1bpp/24bpp Graphics

    And if I try getImage with an object or string I get:

    Interpreter error: [
      "LOW_MEMORY",
      "MEMORY"
     ]
    New interpreter error: LOW_MEMORY,MEMORY
    

    g.buffer seems to be undefined - I was trying to see if I could convert it to a UInt8Array and then to string.

    Does anyone have any suggestions?

  • in JavaScript
    Avatar for tanepiper

    Option 2 would be nice here - it seems a bit of a waste of cycles to have to read an entire file just to get the latest entry. The solution I've come up with is to read the file into an array, unshift with the latest row then re-write the file. With this case, I can make each line a valid JSON separated by a line break and it works reasonably efficiently, and I can just get the first line for the latest data.

Actions