Hi - the issue is that the framebuffer isn't entirely linear (and arraybuffer assumes it is) - because it's sent direct to the LCD via DMA it contains a few command bytes at the beginning of each line. Plus I guess as you found out, having 3 bit color isn't desperately easy to work with.
The code in that app is very impressive, but I feel like trying to access the framebuffer directly is going to be a complete nightmare... Apart from the way it moves around every release, Bangle.js does background DMA after you flip - so you may well end up altering the buffer contents while it's being send to the LCD which will cause tearing.
We could add a function to get the address of the buffer I guess that could wait for DMA to finish, but it's still a bit iffy - if you accidentally overwrite those command bytes the screen will no longer update correctly.
Have you checked the speed difference from just having a pre-allocated ArrayBuffer Graphics object that you write to (in maybe a more sensible bit depth) and blitting that to the screen? I'd have thought that might be reasonably quick.
Or even I wonder if your triangle draw implementation is actually that much faster than Bangle's own one, since it seems they do work in a pretty similar way... I guess it's just actually being able to call Bangle.js's one fast enough!
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi - the issue is that the framebuffer isn't entirely linear (and arraybuffer assumes it is) - because it's sent direct to the LCD via DMA it contains a few command bytes at the beginning of each line. Plus I guess as you found out, having 3 bit color isn't desperately easy to work with.
The code in that app is very impressive, but I feel like trying to access the framebuffer directly is going to be a complete nightmare... Apart from the way it moves around every release, Bangle.js does background DMA after you flip - so you may well end up altering the buffer contents while it's being send to the LCD which will cause tearing.
We could add a function to get the address of the buffer I guess that could wait for DMA to finish, but it's still a bit iffy - if you accidentally overwrite those command bytes the screen will no longer update correctly.
Have you checked the speed difference from just having a pre-allocated ArrayBuffer Graphics object that you write to (in maybe a more sensible bit depth) and blitting that to the screen? I'd have thought that might be reasonably quick.
Or even I wonder if your triangle draw implementation is actually that much faster than Bangle's own one, since it seems they do work in a pretty similar way... I guess it's just actually being able to call Bangle.js's one fast enough!