As per the title, I'm working on a clock that has different color schemes based on whether the bangle.js2 is locked or unlocked. I'll be drawing strings, filled polygons, and circles, as well as loading a background image from heatshrink, all depending on lock state.
For the sake of best practices, ram usage, etc. I'm wondering if I should have two different conditions within the same function, and using if(Bangle.isLocked()) within that function to decide at each updateinterval what background image to load, FG and BG colors, and what to draw... or should I have two separate functions that are called/killed depending on state? If the latter, how do I kill a function that is currently running?
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.
As per the title, I'm working on a clock that has different color schemes based on whether the bangle.js2 is locked or unlocked. I'll be drawing strings, filled polygons, and circles, as well as loading a background image from heatshrink, all depending on lock state.
For the sake of best practices, ram usage, etc. I'm wondering if I should have two different conditions within the same function, and using
if(Bangle.isLocked())
within that function to decide at each updateinterval what background image to load, FG and BG colors, and what to draw... or should I have two separate functions that are called/killed depending on state? If the latter, how do I kill a function that is currently running?