Problem programming a conveyor to stop near a proximity sensor

Ok, so the system has three "states"

1 - moving the bowl into sensor range. lets call this 'get_bowl'
2 - pause while the bowl fills. let's call this 'fill_bowl'.
3 - moving the bowl out of sensor range. Let's call this 'bowl_done

The transition from one state into another is caused by an external event. When the transition happens, the arduino needs to do something.

In state 1, a transition to state t happens when the sensor detects the bowl. The sketch needs to stop the conveyor, start pouring, and make a note of the current time

In state 2, the transition to state 3 happens when the time runs out. The sketch needs to stop pouring and start the conveyor

In state 3, the transition back to state 1 happens when the bowl moves out of sensor range. The sketch doesn't need to do anything but go back to state 1.

I like using enums and switch cases for this sort of thing:

enum State {
  GET_BOWL, FULL_BOWL, BOWL_DONE
} state = GET_BOWL;

uint32_t fillTimer;

void loop() {
  switch(state) {
  case GET_BOWL:
    if(the sensor has detected the bowl) {
      turn conveyor off;
      turn filler on;
      fillTimer = millis();
      state = FILL_BOWL;
    }
    break;

  case FILL_BOWL:
    if(we have been filling for 24.8 seconds) {
      turn filler off;
      turn conveyor on;
      state = BOWL_DONE;
    }
    break;

  case BOWL_DONE:
    if(the bowl is no longer being detected) {
      state = GET_BOWL;
    }
    break;
  }
}

like that.