Detection of tissue devitalisation by square-wave analysis