refactor to allow measurement calculation and led color updates