Fade without interruptions?

Hi, I am trying to do the sleep for a battery operated device, and I wonder how can I do a x seconds fade without being interrupted?

Is it ok to use something like (this is in the loop, called every 100 ms):

  if (strip.getBrightness() == 0)
    esp_deep_sleep_start(); // real sleep here

  bri = strip.getBrightness() - 1;
  strip.setBrightness(bri);
  colorUpdated(CALL_MODE_DIRECT_CHANGE);

But how can I prevent the user to increase the brightness via the webUI while the fading is happening?