I think it might be safer to just have two draw functions rather than trying to decide which one to queue (which I think is what you're asking?). So use @malaire's code but with:
function draw() {
if (unlocked) draw1() else draw2();
queueDraw();
}
as well as loading a background image from heatshrink, all depending on lock state.
Not quite sure what you have in mind here, but if you store the background image as a file (uncompressed), drawImage can draw that file directly without ever loading it into RAM - it's likely to be faster and use less memory than trying to use heatshrink.
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.
I think it might be safer to just have two draw functions rather than trying to decide which one to queue (which I think is what you're asking?). So use @malaire's code but with:
Not quite sure what you have in mind here, but if you store the background image as a file (uncompressed), drawImage can draw that file directly without ever loading it into RAM - it's likely to be faster and use less memory than trying to use heatshrink.