Reworked state signal output algorithm

Needs testing on board.