A 58-year-old man is being weaned from the ventilator via a tracheostomy. He is on T-piece trials for increasing duration. During a trial, he develops SpO2 88%, RR 35, HR 120, and appears distressed. The team terminates the T-piece trial and reconnects ventilatory support. What physiological parameter should be checked to exclude reversible causes of weaning failure?