The Health app doesn't turn off the HRM when the watch is motionless, BUT the HRM itself (in Bangle.js 2) detects when it's not in contact with the skin and goes into a low power mode (you'll see if doesn't flash green unless it's very close to your skin) - so actually the power consumption is tiny if the Bangle is just sitting on your desk.
Ah, that makes sense why I couldn't see any code for this - it's implemented at a lower level (hardware or HRM integrated firmware). That's pretty cool.
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.
The Health app doesn't turn off the HRM when the watch is motionless, BUT the HRM itself (in Bangle.js 2) detects when it's not in contact with the skin and goes into a low power mode (you'll see if doesn't flash green unless it's very close to your skin) - so actually the power consumption is tiny if the Bangle is just sitting on your desk.