[SOLVED] Bangle.js 2 Bangle.on('lcdPower') not working

Posted on
  • Hi there,

    I started getting into developing. I followed the Clock face tutorial. Later into the tuorial, power saving is introduced. It uses the Bangle.on('lcdPower') to stop the interval for drawing the clock and resumes it if the event is on, at least from my understanding.

    This didn't work when my screen went dark, so I added a Terminal.println("Work"); to the function block, and it didn't show up on screen either (Debug Info is set to show ofc). Either I misunderstand this event handling, the event itself, the terminal call, or some other code in this mix and its supposed to not show this, or the event doesn't work.

    MWE to paste into the left side of the IDE, per my understanding:

    Bangle.on('lcdPower',on=>{Terminal.printĀ­ln("Work");});
    

    Firmware is the latest released: 2v11, 531080858

    Glad to hear where I went wrong :D
    ~Poolitzer

  • Use Bangle.lock() instead. If i understand correctly, lcdPower would only be called if the screen was actually turned off (blank, not dark).

  • Aha, thats a neat trick. Will lock work as well on the Bangle.js 1? Then I can PR a fix to the docs.

  • On bangle 2 the screen is always on, so there is no point in stopping the clock.

  • I don't know. This time of year I often wish to stop the clock ;).

  • I mean. Tbh, why not? Maybe stopping it completely might be too much, but the tutorial implements a per second watch, and one could turn that into a per minute one when the screen locks, and into a per second one when it unlocks. And I bet there are many other applications where it makes sense to do something ressource hungry only when the user unlocks the screen, so I think having the idea for that in the tutorial makes sense.

  • With my clock (Dozenal Time 2), I've found that drawing it continually may create a notable drain on the battery. (I'm testing it, and I realize the drain may result partly from the way the code works.) The version waiting to get into the public Bangle.js 2 app loader draws the clock for 15 seconds, within which the initial backlit time is determined by the LCD setting.

    I first thought that that's enough. But I've run my Bangle.js 2 now with the backlight-off option (clock still running) for several days. It's better that way, more like the usual watch faces that don't disappear, and there's not often a need to activate the backlight, which there would be with the display off.

  • If you find a way to make the clock go back a few years let me know.

  • [Original post here deleted. See below for why.]

  • I do think Hugh just wanted to get some years of his life back :D

  • If he goes back too far, there won't be any smart watches :-)

  • Hopefully he can make sandwiches then.

  • I missed the jest because I didn't see initially whom he was responding to.

    Given the wacky things I've done in online clocks (including in some having the numerals move throughout the day, and in others using negative numbers), I tend to take any clock request seriously. I shouldn't.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

[SOLVED] Bangle.js 2 Bangle.on('lcdPower') not working

Posted by Avatar for Poolitzer @Poolitzer

Actions