If current node is not undefined, set batteryMeter and ramMeter visible to true, else set to false. Then just move hud update out of the conditional and that should hide the elements when a blockly node isn't active.