I did try to create an 8bpp image I usually get LOW_MEMORY
Yes - you have around 40k memory usable - if you go for full resolution you can't really store a full res image, but if you go for half res, maybe 120*80, that's then 9600 bytes which should fit fine.
for (var i=0;i<256;i++) {
var r = 0 to 255;
var g = 0 to 255;
var b = 0 to 255;
pal[i] = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8); // push the data into 16 bits
}
Or It's actually more sensible to just use pal[i] = g.toColor(r,g,b) (works the same as g.setColor) - I just keep forgetting it's there!
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?
You can just palette shift - so basically the only time you need to redraw with imgGfx is when the time changes.
Then I assume here it's draw image and flip? (or is clear better?)
You don't even need a flip (because you won't be using the double buffered mode any more). You literally just draw.
Because you'll be drawing the new image over what's there already, there shouldn't be any flicker
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.
Yes - you have around 40k memory usable - if you go for full resolution you can't really store a full res image, but if you go for half res, maybe 120*80, that's then 9600 bytes which should fit fine.
Yes - this is just one 16 bit entry for each of the 256 colours you can have in the image. The 16 bits are the form the LCD takes, which is RGB565. For example https://github.com/espruino/BangleApps/blob/master/apps/geissclk/precompute.js#L4
Or It's actually more sensible to just use
pal[i] = g.toColor(r,g,b)
(works the same asg.setColor
) - I just keep forgetting it's there!You can just palette shift - so basically the only time you need to redraw with
imgGfx
is when the time changes.You don't even need a flip (because you won't be using the double buffered mode any more). You literally just draw.
Because you'll be drawing the new image over what's there already, there shouldn't be any flicker