Putting the vesc to sleep in low current mode

I am trying to put my vesc to sleep when the motor is running and the current consumption by the motor lower than X amps. Can someone direct me where in the VESC code can I go and make that change? or find that function?

Thanks!