Temperature-compensated sensing